Package org.hornetq.core.deployers.impl

Examples of org.hornetq.core.deployers.impl.FileConfigurationParser


   public HornetQConfigParserDeployer(final String name)
   {
      super(Configuration.class);

      this.parser = new FileConfigurationParser();
     
      this.setSuffix(name);
   }
View Full Code Here


public class FileConfigurationParserTest extends UnitTestCase
{
  
   public void testParsingDefaultServerConfig() throws Exception
   {
      FileConfigurationParser parser = new FileConfigurationParser();
     
      String configStr = firstPart + lastPart;
      ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes("UTF-8"));
     
      Configuration config = parser.parseMainConfig(input);
     
      String clusterPassword = config.getClusterPassword();
     
      assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, clusterPassword);
     
      //if we add cluster-password, it should be default plain text
      String clusterPasswordPart = "<cluster-password>helloworld</cluster-password>";
     
      configStr = firstPart + clusterPasswordPart + lastPart;
     
      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));
     
      assertEquals("helloworld", config.getClusterPassword());

      //if we add mask, it should be able to decode correctly
      DefaultSensitiveStringCodec codec = new DefaultSensitiveStringCodec();
      String mask = (String)codec.encode("helloworld");
     
      String maskPasswordPart = "<mask-password>true</mask-password>";
      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";
     
      configStr = firstPart + clusterPasswordPart + maskPasswordPart + lastPart;
     
      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));
     
      assertEquals("helloworld", config.getClusterPassword());
     
      //if we change key, it should be able to decode correctly
      codec = new DefaultSensitiveStringCodec();
      Map<String, String> prop = new HashMap<String, String>();
      prop.put("key", "newkey");
      codec.init(prop);
     
      mask = (String)codec.encode("newpassword");
     
      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";
     
      String codecPart = "<password-codec>" + "org.hornetq.utils.DefaultSensitiveStringCodec" +
                         ";key=newkey</password-codec>";
     
      configStr = firstPart + clusterPasswordPart + maskPasswordPart + codecPart + lastPart;
     
      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));
     
      assertEquals("newpassword", config.getClusterPassword());
   }
View Full Code Here

public class FileConfigurationParserTest extends UnitTestCase
{

   public void testParsingDefaultServerConfig() throws Exception
   {
      FileConfigurationParser parser = new FileConfigurationParser();

      String configStr = firstPart + lastPart;
      ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes("UTF-8"));

      Configuration config = parser.parseMainConfig(input);

      String clusterPassword = config.getClusterPassword();

      assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, clusterPassword);

      //if we add cluster-password, it should be default plain text
      String clusterPasswordPart = "<cluster-password>helloworld</cluster-password>";

      configStr = firstPart + clusterPasswordPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("helloworld", config.getClusterPassword());

      //if we add mask, it should be able to decode correctly
      DefaultSensitiveStringCodec codec = new DefaultSensitiveStringCodec();
      String mask = (String)codec.encode("helloworld");

      String maskPasswordPart = "<mask-password>true</mask-password>";
      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";

      configStr = firstPart + clusterPasswordPart + maskPasswordPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("helloworld", config.getClusterPassword());

      //if we change key, it should be able to decode correctly
      codec = new DefaultSensitiveStringCodec();
      Map<String, String> prop = new HashMap<String, String>();
      prop.put("key", "newkey");
      codec.init(prop);

      mask = (String)codec.encode("newpassword");

      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";

      String codecPart = "<password-codec>" + "org.hornetq.utils.DefaultSensitiveStringCodec" +
                         ";key=newkey</password-codec>";

      configStr = firstPart + clusterPasswordPart + maskPasswordPart + codecPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("newpassword", config.getClusterPassword());
   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);
     
      FileConfigurationParser parser = new FileConfigurationParser();

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);

      FileConfigurationParser parser = new FileConfigurationParser();

      // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
      //     starting the server
      //     and we don't want to do it when deploying hornetq-queues.xml which uses the same parser and XML format
      parser.setValidateAIO(true);

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);

      FileConfigurationParser parser = new FileConfigurationParser();

      // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
      //     starting the server
      //     and we don't want to do it when deploying hornetq-queues.xml which uses the same parser and XML format
      parser.setValidateAIO(true);

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);

      FileConfigurationParser parser = new FileConfigurationParser();

      // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
      //     starting the server
      //     and we don't want to do it when deploying hornetq-queues.xml which uses the same parser and XML format
      parser.setValidateAIO(true);

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);

      FileConfigurationParser parser = new FileConfigurationParser();

      // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
      //     starting the server
      //     and we don't want to do it when deploying hornetq-queues.xml which uses the same parser and XML format
      parser.setValidateAIO(true);

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

      Reader reader = new InputStreamReader(url.openStream());
      String xml = org.hornetq.utils.XMLUtil.readerToString(reader);
      xml = XMLUtil.replaceSystemProps(xml);
      Element e = org.hornetq.utils.XMLUtil.stringToElement(xml);
     
      FileConfigurationParser parser = new FileConfigurationParser();
     
      // https://jira.jboss.org/browse/HORNETQ-478 - We only want to validate AIO when
      //     starting the server
      //     and we don't want to do it when deploying hornetq-queues.xml which uses the same parser and XML format
      parser.setValidateAIO(true);

      parser.parseMainConfig(e, this);

      started = true;

   }
View Full Code Here

public class FileConfigurationParserTest extends UnitTestCase
{

   public void testParsingDefaultServerConfig() throws Exception
   {
      FileConfigurationParser parser = new FileConfigurationParser();

      String configStr = firstPart + lastPart;
      ByteArrayInputStream input = new ByteArrayInputStream(configStr.getBytes("UTF-8"));

      Configuration config = parser.parseMainConfig(input);

      String clusterPassword = config.getClusterPassword();

      assertEquals(ConfigurationImpl.DEFAULT_CLUSTER_PASSWORD, clusterPassword);

      //if we add cluster-password, it should be default plain text
      String clusterPasswordPart = "<cluster-password>helloworld</cluster-password>";

      configStr = firstPart + clusterPasswordPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("helloworld", config.getClusterPassword());

      //if we add mask, it should be able to decode correctly
      DefaultSensitiveStringCodec codec = new DefaultSensitiveStringCodec();
      String mask = (String)codec.encode("helloworld");

      String maskPasswordPart = "<mask-password>true</mask-password>";
      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";

      configStr = firstPart + clusterPasswordPart + maskPasswordPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("helloworld", config.getClusterPassword());

      //if we change key, it should be able to decode correctly
      codec = new DefaultSensitiveStringCodec();
      Map<String, String> prop = new HashMap<String, String>();
      prop.put("key", "newkey");
      codec.init(prop);

      mask = (String)codec.encode("newpassword");

      clusterPasswordPart = "<cluster-password>" + mask + "</cluster-password>";

      String codecPart = "<password-codec>" + "org.hornetq.utils.DefaultSensitiveStringCodec" +
                         ";key=newkey</password-codec>";

      configStr = firstPart + clusterPasswordPart + maskPasswordPart + codecPart + lastPart;

      config = parser.parseMainConfig(new ByteArrayInputStream(configStr.getBytes("UTF-8")));

      assertEquals("newpassword", config.getClusterPassword());
   }
View Full Code Here

TOP

Related Classes of org.hornetq.core.deployers.impl.FileConfigurationParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.