Search in sources :

Example 1 with MutableConfigurationSource

use of org.apache.hadoop.hdds.conf.MutableConfigurationSource in project ozone by apache.

the class TestOMStorage method testGetOmDbDir.

/**
 * Test {@link OMStorage#getOmDbDir}.
 */
@Test
public void testGetOmDbDir() {
    final File testDir = createTestDir();
    final File dbDir = new File(testDir, "omDbDir");
    // should be ignored.
    final File metaDir = new File(testDir, "metaDir");
    final MutableConfigurationSource conf = new OzoneConfiguration();
    conf.set(OMConfigKeys.OZONE_OM_DB_DIRS, dbDir.getPath());
    conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDir.getPath());
    try {
        assertEquals(dbDir, OMStorage.getOmDbDir(conf));
        // should have been created.
        assertTrue(dbDir.exists());
    } finally {
        FileUtils.deleteQuietly(dbDir);
    }
}
Also used : OzoneConfiguration(org.apache.hadoop.hdds.conf.OzoneConfiguration) File(java.io.File) MutableConfigurationSource(org.apache.hadoop.hdds.conf.MutableConfigurationSource) Test(org.junit.Test)

Example 2 with MutableConfigurationSource

use of org.apache.hadoop.hdds.conf.MutableConfigurationSource in project ozone by apache.

the class TestReplicationConfigValidator method testWithoutValidation.

@Test
public void testWithoutValidation() {
    MutableConfigurationSource config = new InMemoryConfiguration();
    config.set("ozone.replication.allowed-configs", "");
    final ReplicationConfigValidator validator = config.getObject(ReplicationConfigValidator.class);
    validator.validate(RatisReplicationConfig.getInstance(THREE));
    validator.validate(StandaloneReplicationConfig.getInstance(ONE));
}
Also used : InMemoryConfiguration(org.apache.hadoop.hdds.conf.InMemoryConfiguration) MutableConfigurationSource(org.apache.hadoop.hdds.conf.MutableConfigurationSource) Test(org.junit.Test)

Example 3 with MutableConfigurationSource

use of org.apache.hadoop.hdds.conf.MutableConfigurationSource in project ozone by apache.

the class TestReplicationConfigValidator method testCustomValidation.

@Test(expected = IllegalArgumentException.class)
public void testCustomValidation() {
    MutableConfigurationSource config = new InMemoryConfiguration();
    config.set("ozone.replication.allowed-configs", "RATIS/THREE");
    final ReplicationConfigValidator validator = config.getObject(ReplicationConfigValidator.class);
    validator.validate(RatisReplicationConfig.getInstance(THREE));
    validator.validate(RatisReplicationConfig.getInstance(ONE));
// exception is expected
}
Also used : InMemoryConfiguration(org.apache.hadoop.hdds.conf.InMemoryConfiguration) MutableConfigurationSource(org.apache.hadoop.hdds.conf.MutableConfigurationSource) Test(org.junit.Test)

Example 4 with MutableConfigurationSource

use of org.apache.hadoop.hdds.conf.MutableConfigurationSource in project ozone by apache.

the class TestReplicationConfigValidator method testValidation.

@Test
public void testValidation() {
    MutableConfigurationSource config = new InMemoryConfiguration();
    final ReplicationConfigValidator validator = config.getObject(ReplicationConfigValidator.class);
    validator.validate(RatisReplicationConfig.getInstance(THREE));
    validator.validate(RatisReplicationConfig.getInstance(ONE));
    validator.validate(StandaloneReplicationConfig.getInstance(THREE));
    validator.validate(StandaloneReplicationConfig.getInstance(ONE));
}
Also used : InMemoryConfiguration(org.apache.hadoop.hdds.conf.InMemoryConfiguration) MutableConfigurationSource(org.apache.hadoop.hdds.conf.MutableConfigurationSource) Test(org.junit.Test)

Example 5 with MutableConfigurationSource

use of org.apache.hadoop.hdds.conf.MutableConfigurationSource in project ozone by apache.

the class TestTracingUtil method tracingEnabled.

private static MutableConfigurationSource tracingEnabled() {
    MutableConfigurationSource config = new InMemoryConfiguration();
    config.setBoolean(ScmConfigKeys.HDDS_TRACING_ENABLED, true);
    return config;
}
Also used : InMemoryConfiguration(org.apache.hadoop.hdds.conf.InMemoryConfiguration) MutableConfigurationSource(org.apache.hadoop.hdds.conf.MutableConfigurationSource)

Aggregations

MutableConfigurationSource (org.apache.hadoop.hdds.conf.MutableConfigurationSource)7 Test (org.junit.Test)5 InMemoryConfiguration (org.apache.hadoop.hdds.conf.InMemoryConfiguration)4 File (java.io.File)2 OzoneConfiguration (org.apache.hadoop.hdds.conf.OzoneConfiguration)2 URI (java.net.URI)1 ConfigurationSource (org.apache.hadoop.hdds.conf.ConfigurationSource)1 LegacyHadoopConfigurationSource (org.apache.hadoop.hdds.utils.LegacyHadoopConfigurationSource)1 AccessControlList (org.apache.hadoop.security.authorize.AccessControlList)1