Search in sources :

Example 11 with DynamicDistributedLogConfiguration

use of com.twitter.distributedlog.config.DynamicDistributedLogConfiguration in project distributedlog by twitter.

the class TestStreamConfigProvider method testServiceProviderWithMissingConfig.

@Test(timeout = 60000)
public void testServiceProviderWithMissingConfig() throws Exception {
    StreamConfigProvider provider = getServiceProvider(new IdentityStreamPartitionConverter());
    Optional<DynamicDistributedLogConfiguration> config = provider.getDynamicStreamConfig("stream1");
    assertTrue(config.isPresent());
}
Also used : IdentityStreamPartitionConverter(com.twitter.distributedlog.service.streamset.IdentityStreamPartitionConverter) DynamicDistributedLogConfiguration(com.twitter.distributedlog.config.DynamicDistributedLogConfiguration) Test(org.junit.Test)

Example 12 with DynamicDistributedLogConfiguration

use of com.twitter.distributedlog.config.DynamicDistributedLogConfiguration in project distributedlog by twitter.

the class TestStreamConfigProvider method testServiceProviderWithDefaultConfigPath.

@Test(timeout = 60000)
public void testServiceProviderWithDefaultConfigPath() throws Exception {
    // Default config with property set.
    PropertiesWriter writer1 = new PropertiesWriter();
    writer1.setProperty("rpsStreamAcquireServiceLimit", "191919");
    writer1.save();
    String fallbackConfPath1 = writer1.getFile().getPath();
    StreamConfigProvider provider1 = getServiceProvider(new IdentityStreamPartitionConverter(), DEFAULT_CONFIG_DIR, fallbackConfPath1);
    Optional<DynamicDistributedLogConfiguration> config1 = provider1.getDynamicStreamConfig("stream1");
    // Empty default config.
    PropertiesWriter writer2 = new PropertiesWriter();
    writer2.save();
    String fallbackConfPath2 = writer2.getFile().getPath();
    StreamConfigProvider provider2 = getServiceProvider(new IdentityStreamPartitionConverter(), DEFAULT_CONFIG_DIR, fallbackConfPath2);
    Optional<DynamicDistributedLogConfiguration> config2 = provider2.getDynamicStreamConfig("stream1");
    assertEquals(191919, config1.get().getRpsStreamAcquireServiceLimit());
    assertEquals(-1, config2.get().getRpsStreamAcquireServiceLimit());
}
Also used : IdentityStreamPartitionConverter(com.twitter.distributedlog.service.streamset.IdentityStreamPartitionConverter) PropertiesWriter(com.twitter.distributedlog.config.PropertiesWriter) DynamicDistributedLogConfiguration(com.twitter.distributedlog.config.DynamicDistributedLogConfiguration) Test(org.junit.Test)

Example 13 with DynamicDistributedLogConfiguration

use of com.twitter.distributedlog.config.DynamicDistributedLogConfiguration in project distributedlog by twitter.

the class TestStreamConfigProvider method testDefaultProvider.

@Test(timeout = 60000)
public void testDefaultProvider() throws Exception {
    PropertiesWriter writer = new PropertiesWriter();
    writer.setProperty(BKDL_RETENTION_PERIOD_IN_HOURS, "99");
    writer.save();
    StreamConfigProvider provider = getDefaultProvider(writer.getFile().getPath());
    Optional<DynamicDistributedLogConfiguration> config1 = provider.getDynamicStreamConfig("stream1");
    Optional<DynamicDistributedLogConfiguration> config2 = provider.getDynamicStreamConfig("stream2");
    assertTrue(config1.isPresent());
    assertTrue(config1.get() == config2.get());
    assertEquals(99, config1.get().getRetentionPeriodHours());
}
Also used : PropertiesWriter(com.twitter.distributedlog.config.PropertiesWriter) DynamicDistributedLogConfiguration(com.twitter.distributedlog.config.DynamicDistributedLogConfiguration) Test(org.junit.Test)

Aggregations

DynamicDistributedLogConfiguration (com.twitter.distributedlog.config.DynamicDistributedLogConfiguration)13 Test (org.junit.Test)9 DistributedLogConfiguration (com.twitter.distributedlog.DistributedLogConfiguration)6 ConcurrentConstConfiguration (com.twitter.distributedlog.config.ConcurrentConstConfiguration)4 DistributedLogNamespace (com.twitter.distributedlog.namespace.DistributedLogNamespace)3 StreamConfigProvider (com.twitter.distributedlog.service.config.StreamConfigProvider)3 IdentityStreamPartitionConverter (com.twitter.distributedlog.service.streamset.IdentityStreamPartitionConverter)3 StreamPartitionConverter (com.twitter.distributedlog.service.streamset.StreamPartitionConverter)3 SettableFeature (org.apache.bookkeeper.feature.SettableFeature)3 PropertiesWriter (com.twitter.distributedlog.config.PropertiesWriter)2 Partition (com.twitter.distributedlog.service.streamset.Partition)2 URI (java.net.URI)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 LedgerAllocator (com.twitter.distributedlog.bk.LedgerAllocator)1 ConcurrentBaseConfiguration (com.twitter.distributedlog.config.ConcurrentBaseConfiguration)1 DynamicConfigurationFactory (com.twitter.distributedlog.config.DynamicConfigurationFactory)1 StreamUnavailableException (com.twitter.distributedlog.exceptions.StreamUnavailableException)1 NOPAnnouncer (com.twitter.distributedlog.service.announcer.NOPAnnouncer)1 ServerSetAnnouncer (com.twitter.distributedlog.service.announcer.ServerSetAnnouncer)1