Examples of XmlConfiguration


Examples of org.apache.commons.configuration.XMLConfiguration

  private Map<String, String> parseConfigFile(final String name) {
    Map<String, String> values = new HashMap();

    try {
      final XMLConfiguration initial = new XMLConfiguration(gui.getConfig().getProperty("genericconffile"));
      initial.setExpressionEngine(new XPathExpressionEngine());

      for (final HierarchicalConfiguration subconf : (java.util.List<HierarchicalConfiguration>)
          initial.configurationsAt("/generic/template")) {
        final String subconf_name = subconf.getString("name");
        if (subconf_name != null && subconf_name.equals(name)) {
          for (final String key : new String [] { "name", "title", "cmdline", "filename", "workdir", "unit" })
            values.put(key, subconf.getString(key));
          return values;
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

    }

    public void modifyClusterNodeBdbAddress(int brokerPortNumberToBeMoved, int newBdbPort)
    {
        final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumberToBeMoved);
        final XMLConfiguration virtualHostConfig = brokerConfigHolder.getTestVirtualhosts();

        final String configKey = getConfigKey("highAvailability.nodeHostPort");
        final String oldBdbHostPort = virtualHostConfig.getString(configKey);

        final String[] oldHostAndPort = StringUtils.split(oldBdbHostPort, ":");
        final String oldHost = oldHostAndPort[0];

        final String newBdbHostPort = oldHost + ":" + newBdbPort;

        virtualHostConfig.setProperty(configKey, newBdbHostPort);
        collectConfig(brokerPortNumberToBeMoved, brokerConfigHolder.getTestConfiguration(), virtualHostConfig);
    }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

    }

    private XMLConfiguration createAndSaveVirtualHostConfiguration(String hostName, File configFile, String storeLocation)
            throws ConfigurationException
    {
        XMLConfiguration testConfiguration = new XMLConfiguration();
        testConfiguration.setProperty("virtualhost." + hostName + ".store.class",
                getTestProfileMessageStoreClassName());
        testConfiguration.setProperty("virtualhost." + hostName + ".store.environment-path", storeLocation);
        testConfiguration.save(configFile);
        return testConfiguration;
    }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

        _host = InetAddress.getByName("localhost").getHostAddress();
        _groupName = "group" + getName();
        _masterPort = -1;

        FileUtils.delete(new File(_workDir), true);
        _configXml = new XMLConfiguration();
        _modelVhost = mock(org.apache.qpid.server.model.VirtualHost.class);


        BrokerTestHelper.setUp();
     }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        BrokerTestHelper.setUp();
        _configXml = new XMLConfiguration();
        _configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
        _configXml.addProperty("virtualhosts.virtualhost(-1)."+getName()+".store.class", TestableMemoryMessageStore.class.getName());
        _virtualHostRegistry = new VirtualHostRegistry();
        _broker = mock(Broker.class);
        when(_broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(30000l);
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

public class AlgorithmConfig {
 
  private XMLConfiguration xmlConfig;
 
  public AlgorithmConfig(){
    xmlConfig = new XMLConfiguration();
   
  }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

    this.solutions = null;
  }
 
  public void read(String filename) {
    logger.info("read vrp from file " + filename);
    XMLConfiguration xmlConfig = new XMLConfiguration();
    xmlConfig.setFileName(filename);
    xmlConfig.setAttributeSplittingDisabled(true);
    xmlConfig.setDelimiterParsingDisabled(true);
   
    if(schemaValidation){
      final InputStream resource = Resource.getAsInputStream("vrp_xml_schema.xsd");
      if(resource != null) {
        EntityResolver resolver = new EntityResolver() {

          @Override
          public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
            {
              InputSource is = new InputSource(resource);
              return is;
            }
          }
        };
        xmlConfig.setEntityResolver(resolver);
        xmlConfig.setSchemaValidation(true);
        logger.info("validating " + filename + " with xsd-schema");
      }
      else{
        logger.warn("cannot find schema-xsd file (vrp_xml_schema.xsd). try to read xml without xml-file-validation.");
      }   
    }
    try {
      xmlConfig.load();
    } catch (ConfigurationException e) {
      logger.error(e);
      e.printStackTrace();
      System.exit(1);
    }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

    private XMLConfiguration config;

    protected void setUp() throws Exception
    {
        super.setUp();
        config = new XMLConfiguration();
        config.setExpressionEngine(new XPathExpressionEngine());
    }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

     * Tests to watch a configuration file in a jar. In this case the jar file
     * itself should be monitored.
     */
    public void testFromJar() throws Exception
    {
        XMLConfiguration config = new XMLConfiguration();
        // use some jar: URL
        config.setURL(new URL("jar:" + new File("conf/resources.jar").getAbsoluteFile().toURI().toURL() + "!/test-jar.xml"));
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        config.setReloadingStrategy(strategy);
        File file = strategy.getFile();
        assertNotNull("Strategy's file is null", file);
        assertEquals("Strategy does not monitor the jar file", "resources.jar", file.getName());
    }
View Full Code Here

Examples of org.apache.commons.configuration.XMLConfiguration

        logger.setAdditivity(false);
        ExprLookup.Variables vars = new ExprLookup.Variables();
        vars.add(new ExprLookup.Variable("String", org.apache.commons.lang.StringUtils.class));
        vars.add(new ExprLookup.Variable("Util", new Utility("Hello")));
        vars.add(new ExprLookup.Variable("System", "Class:java.lang.System"));
        XMLConfiguration config = new XMLConfiguration(TEST_FILE);
        config.setLogger(log);
        ExprLookup lookup = new ExprLookup(vars);
        lookup.setConfiguration(config);
        String str = lookup.lookup(PATTERN1);
        assertTrue(str.startsWith("Goodbye"));
        str = lookup.lookup(PATTERN2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.