Example usage for org.apache.commons.configuration PropertiesConfiguration getProperty

List of usage examples for org.apache.commons.configuration PropertiesConfiguration getProperty

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration getProperty.

Prototype

public Object getProperty(String key) 

Source Link

Usage

From source file:org.xwiki.wikistream.confluence.xml.internal.ConfluenceXMLPackage.java

private void readPageObject(XMLStreamReader xmlReader) throws IOException, NumberFormatException,
        XMLStreamException, ConfigurationException, WikiStreamException {
    PropertiesConfiguration properties = newProperties();

    int pageId = readObjectProperties(xmlReader, properties);

    // Save page//www  .  j  av  a  2s  .c  o m
    savePageProperties(properties, pageId);

    // Register only current pages (they will take care of handling there history)
    Integer originalVersion = (Integer) properties.getProperty("originalVersion");
    if (originalVersion == null) {
        Integer spaceId = (Integer) properties.getInteger("space", null);
        List<Integer> spacePages = this.pages.get(spaceId);
        if (spacePages == null) {
            spacePages = new LinkedList<Integer>();
            this.pages.put(spaceId, spacePages);
        }
        spacePages.add(pageId);
    }
}

From source file:ubic.basecode.util.ConfigUtilsTest.java

@Test
public void testLoadConfigFile() throws Exception {
    PropertiesConfiguration config = ConfigUtils.loadConfig(new File(testConfigPath));
    assertNotNull(config);/*w  w w  .j  a v  a 2  s. c o m*/
    assertEquals("bar", config.getProperty("foo"));
}

From source file:ubic.basecode.util.ConfigUtilsTest.java

@Test
public void testLoadConfigFileNew() throws Exception {
    PropertiesConfiguration config = ConfigUtils.loadConfig(new File(tmpPath));
    assertNotNull(config);//from w  w w. j ava  2 s  .c o m

    config.setProperty("foo", "bar");
    assertEquals("bar", config.getProperty("foo"));
}

From source file:ubic.basecode.util.ConfigUtilsTest.java

@Test
public void testLoadConfigStringNew() throws Exception {
    PropertiesConfiguration config = ConfigUtils.loadConfig(tmpPath);
    assertNotNull(config);/*from   w  w  w .  j a v a 2 s .  c om*/
    config.setProperty("foo", "bar");
    assertEquals("bar", config.getProperty("foo"));
}

From source file:ubic.basecode.util.ConfigUtilsTest.java

@Test
public void testLoadConfigStringNewName() throws Exception {
    PropertiesConfiguration config = ConfigUtils.loadConfig("testtemp.properties");
    assertNotNull(config);/*  w  ww.  j  a va 2  s  .  c o m*/
    config.setProperty("foo", "bar");
    assertEquals("bar", config.getProperty("foo"));
    new File(FileUtils.getUserDirectory(), "testtemp.properties").delete();
}

From source file:ubic.basecode.util.ConfigUtilsTest.java

@Test
public void testLoadConfigURLNew() throws Exception {
    PropertiesConfiguration config = ConfigUtils.loadConfig(new File(tmpPath).toURI().toURL());
    assertNotNull(config);/*from   w  w w . j a va 2s  .  co m*/
    config.setProperty("foo", "bar");
    assertEquals("bar", config.getProperty("foo"));
}

From source file:webservice.adeers.AdeersIntegrationTestCase.java

@Override
public void setUp() throws Exception {
    super.setUp();
    PropertiesConfiguration testprops = new PropertiesConfiguration("test-caaers-adeers-ws-su.properties");
    adeersWebServiceAddress = (String) testprops.getProperty("adeers.report.service.url");
    adeersUserName = (String) testprops.getProperty("adeers.username");
    adeersPassword = (String) testprops.getProperty("adeers.password");
}