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

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

Introduction

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

Prototype

public boolean containsKey(String key) 

Source Link

Usage

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the use_memory_mapped_buffers properties in the configuration file.
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 *//*from w  ww .j a  v  a2  s . co m*/
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceTrueBooleanUseMemoryMappedBuffersOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS, true);
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS)
            .equals(BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.TRUE.toString());
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the use_memory_mapped_buffers properties in the configuration file.
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 *//*ww w.  j  ava 2 s  .  c  o  m*/
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceFalseBooleanUseMemoryMappedBuffersOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS, false);
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS)
            .equals(BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.FALSE.toString());
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the strings_mapped_memory properties in the configuration file (with
 * a positive value)./*ww  w  .  jav  a  2 s  .c  o m*/
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourcePositiveStringsMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY, "64M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY)
            .equals("64M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the strings_mapped_memory properties in the configuration file (with
 * a value set to 0M).//w w w . j  a  va2 s. com
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceNullStringsMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY, "0M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_STRINGS_MAPPED_MEMORY)
            .equals("0M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the properties_mapped_memory properties in the configuration file (with
 * a positive value)./*from w w  w . j ava2s .  c om*/
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourcePositivePropertiesMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY, "64M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY)
            .equals("64M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the properties_mapped_memory properties in the configuration file (with
 * a value set to 0M)./*from w w w .j av  a2 s.c  o m*/
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceNullPropertiesMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY, "0M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_PROPERTIES_MAPPED_MEMORY)
            .equals("0M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the relationships_mapped_memory properties in the configuration file (with
 * a positive value).//from   w w w.  jav  a 2s.  c  o m
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourcePositiveRelationshipsMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY, "64M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY)
            .equals("64M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the relationships_mapped_memory properties in the configuration file (with
 * a value set to 0M).//w  ww. ja va  2s.  c o m
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceNullRelationshipsMappedMemoryOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY, "0M");
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_RELATIONSHIPS_MAPPED_MEMORY)
            .equals("0M");
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the use_memory_mapped_buffers properties in the configuration file.
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 */// w  ww .  j av  a2  s . co m
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceTrueUseMemoryMappedBuffersOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS,
            BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.TRUE);
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS)
            .equals(BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.TRUE.toString());
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}

From source file:fr.inria.atlanmod.neoemf.graph.blueprints.neo4j.resources.BlueprintsNeo4jResourceSaveTest.java

/**
 * Test the existence of the use_memory_mapped_buffers properties in the configuration file.
 * This test use the option @see{BlueprintsNeo4jResourceOptions.OPTIONS_GRAPH_TYPE_NEO4J}
 * but does not test it (it is done in @see{testSaveGraphNeo4jResourceNeo4jTypeOption()})
 * In addition, there is no verification on the OPTIONS_GRAPH_NEO4J_STORE_DIR (it is done in
 * @see{testSaveGraphNeo4jResourceNeo4jTypeOption()}
 *///from  ww w  .ja  v a 2 s.  co m
@SuppressWarnings("unchecked")
@Test
public void testSaveGraphNeo4jResourceFalseUseMemoryMappedBuffersOption()
        throws IOException, ConfigurationException {
    options.put(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS,
            BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.FALSE);
    resource.save(options);
    File configFile = new File(testFilePath + configFileName);
    assert configFile.exists();
    PropertiesConfiguration configuration = new PropertiesConfiguration(configFile);
    assert configuration
            .containsKey(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS);
    assert configuration
            .getString(BlueprintsNeo4jResourceOptions.OPTIONS_BLUEPRINTS_NEO4J_USE_MEMORY_MAPPED_BUFFERS)
            .equals(BlueprintsNeo4jResourceOptions.USE_MEMORY_MAPPED_BUFFER.FALSE.toString());
    assert getKeyCount(configuration) == defaultPropertyCount
            + 1 : "The number of properties in the configuration file is not consistent with the given options";
}