Search in sources :

Example 1 with SessionInfo

use of com.orbitz.consul.model.session.SessionInfo in project exhibitor by soabase.

the class TestConsulConfigProvider method testBasic.

@Test
public void testBasic() throws Exception {
    ConsulConfigProvider config = new ConsulConfigProvider(client, "prefix", new Properties());
    try {
        config.start();
        config.loadConfig();
        Properties properties = new Properties();
        properties.setProperty(PropertyBasedInstanceConfig.toName(StringConfigs.ZOO_CFG_EXTRA, PropertyBasedInstanceConfig.ROOT_PROPERTY_PREFIX), "1,2,3");
        config.storeConfig(new PropertyBasedInstanceConfig(properties, new Properties()), 0);
        timing.sleepABit();
        LoadedInstanceConfig instanceConfig = config.loadConfig();
        Assert.assertEquals(instanceConfig.getConfig().getRootConfig().getString(StringConfigs.ZOO_CFG_EXTRA), "1,2,3");
        List<SessionInfo> sessions = client.sessionClient().listSessions();
        Assert.assertEquals(sessions.size(), 0, "Consul session still exists!");
    } finally {
        CloseableUtils.closeQuietly(config);
    }
}
Also used : PropertyBasedInstanceConfig(com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig) SessionInfo(com.orbitz.consul.model.session.SessionInfo) Properties(java.util.Properties) LoadedInstanceConfig(com.netflix.exhibitor.core.config.LoadedInstanceConfig)

Aggregations

LoadedInstanceConfig (com.netflix.exhibitor.core.config.LoadedInstanceConfig)1 PropertyBasedInstanceConfig (com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig)1 SessionInfo (com.orbitz.consul.model.session.SessionInfo)1 Properties (java.util.Properties)1