Search in sources :

Example 1 with StringConfiguration

use of com.mesosphere.sdk.config.StringConfiguration in project dcos-commons by mesosphere.

the class ConfigStoreTest method beforeEach.

@Before
public void beforeEach() throws Exception {
    persister = new MemPersister();
    store = new ConfigStore<StringConfiguration>(new StringConfiguration.Factory(), persister);
    testConfig = new StringConfiguration("test-config");
}
Also used : StringConfiguration(com.mesosphere.sdk.config.StringConfiguration) MemPersister(com.mesosphere.sdk.storage.MemPersister) Before(org.junit.Before)

Example 2 with StringConfiguration

use of com.mesosphere.sdk.config.StringConfiguration in project dcos-commons by mesosphere.

the class ConfigStoreTest method testNamespacedPathMapping.

@Test
public void testNamespacedPathMapping() throws Exception {
    store = new ConfigStore<StringConfiguration>(new StringConfiguration.Factory(), persister, NAMESPACE);
    UUID id = store.store(testConfig);
    store.setTargetConfig(id);
    // Check that data is in namespaced path:
    Assert.assertEquals(id.toString(), new String(persister.get(NAMESPACE_PATH + "/ConfigTarget"), StandardCharsets.UTF_8));
    Assert.assertNotEquals(0, persister.get(NAMESPACE_PATH + "/Configurations/" + id.toString()).length);
    // Check that data is NOT in root path:
    checkPathNotFound("ConfigTarget");
    checkPathNotFound("Configurations/" + id.toString());
    // Check that data is accessible as expected:
    Assert.assertEquals(id, store.getTargetConfig());
    Assert.assertEquals(testConfig, store.fetch(id));
}
Also used : StringConfiguration(com.mesosphere.sdk.config.StringConfiguration) UUID(java.util.UUID) Test(org.junit.Test)

Example 3 with StringConfiguration

use of com.mesosphere.sdk.config.StringConfiguration in project dcos-commons by mesosphere.

the class ConfigStoreTest method testStoreFetchConfig.

@Test
public void testStoreFetchConfig() throws Exception {
    UUID testId = store.store(testConfig);
    StringConfiguration config = store.fetch(testId);
    Assert.assertEquals(testConfig, config);
}
Also used : StringConfiguration(com.mesosphere.sdk.config.StringConfiguration) UUID(java.util.UUID) Test(org.junit.Test)

Aggregations

StringConfiguration (com.mesosphere.sdk.config.StringConfiguration)3 UUID (java.util.UUID)2 Test (org.junit.Test)2 MemPersister (com.mesosphere.sdk.storage.MemPersister)1 Before (org.junit.Before)1