Search in sources :

Example 51 with RingbufferConfig

use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.

the class DynamicConfigYamlGenerator method ringbufferYamlGenerator.

public static void ringbufferYamlGenerator(Map<String, Object> parent, Config config) {
    if (config.getRingbufferConfigs().isEmpty()) {
        return;
    }
    Map<String, Object> child = new LinkedHashMap<>();
    for (RingbufferConfig subConfigAsObject : config.getRingbufferConfigs().values()) {
        Map<String, Object> subConfigAsMap = new LinkedHashMap<>();
        addNonNullToMap(subConfigAsMap, "capacity", subConfigAsObject.getCapacity());
        addNonNullToMap(subConfigAsMap, "time-to-live-seconds", subConfigAsObject.getTimeToLiveSeconds());
        addNonNullToMap(subConfigAsMap, "backup-count", subConfigAsObject.getBackupCount());
        addNonNullToMap(subConfigAsMap, "async-backup-count", subConfigAsObject.getAsyncBackupCount());
        addNonNullToMap(subConfigAsMap, "split-brain-protection-ref", subConfigAsObject.getSplitBrainProtectionName());
        addNonNullToMap(subConfigAsMap, "in-memory-format", subConfigAsObject.getInMemoryFormat().name());
        addNonNullToMap(subConfigAsMap, "ringbuffer-store", getRingbufferStoreConfigAsMap(subConfigAsObject.getRingbufferStoreConfig()));
        addNonNullToMap(subConfigAsMap, "merge-policy", getMergePolicyConfigAsMap(subConfigAsObject.getMergePolicyConfig()));
        child.put(subConfigAsObject.getName(), subConfigAsMap);
    }
    parent.put("ringbuffer", child);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) LinkedHashMap(java.util.LinkedHashMap)

Example 52 with RingbufferConfig

use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.

the class ConfigSearchTest method testRingbufferConfig_Static.

@Test
public void testRingbufferConfig_Static() {
    TestCase<RingbufferConfig> testCase = new TestCase<RingbufferConfig>(new RingbufferConfig().setName(STATIC_NAME), new RingbufferConfig().setName(DYNAMIC_NAME), false) {

        @Override
        void addStaticConfig(Config config) {
            config.addRingBufferConfig(this.staticConfig);
        }

        @Override
        void addDynamicConfig(HazelcastInstance hazelcastInstance) {
            hazelcastInstance.getConfig().addRingBufferConfig(this.dynamicConfig);
        }

        @Override
        void asserts() {
            RingbufferConfig dataConfig = hazelcastInstance.getConfig().findRingbufferConfig(DYNAMIC_NAME);
            assertThat(dataConfig.getName(), equalTo(STATIC_NAME));
        }
    };
    testTemplate(testCase);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ListConfig(com.hazelcast.config.ListConfig) SetConfig(com.hazelcast.config.SetConfig) PNCounterConfig(com.hazelcast.config.PNCounterConfig) QueueConfig(com.hazelcast.config.QueueConfig) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) MapConfig(com.hazelcast.config.MapConfig) CardinalityEstimatorConfig(com.hazelcast.config.CardinalityEstimatorConfig) MultiMapConfig(com.hazelcast.config.MultiMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ExecutorConfig(com.hazelcast.config.ExecutorConfig) ScheduledExecutorConfig(com.hazelcast.config.ScheduledExecutorConfig) TopicConfig(com.hazelcast.config.TopicConfig) Config(com.hazelcast.config.Config) DurableExecutorConfig(com.hazelcast.config.DurableExecutorConfig) FlakeIdGeneratorConfig(com.hazelcast.config.FlakeIdGeneratorConfig) ReplicatedMapConfig(com.hazelcast.config.ReplicatedMapConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 53 with RingbufferConfig

use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.

the class ClientReliableTopicStressTest method setup.

@Before
public void setup() {
    logger = Logger.getLogger(getClass());
    Config config = new Config();
    RingbufferConfig ringbufferConfig = new RingbufferConfig("foobar");
    ringbufferConfig.setCapacity(10000000);
    config.addRingBufferConfig(ringbufferConfig);
    ClientConfig clientConfig = new ClientConfig();
    ClientReliableTopicConfig topicConfig = new ClientReliableTopicConfig("foobar");
    clientConfig.addReliableTopicConfig(topicConfig);
    HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
    HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
    topic = client.getReliableTopic(topicConfig.getName());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientReliableTopicConfig(com.hazelcast.client.config.ClientReliableTopicConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Config(com.hazelcast.config.Config) ClientReliableTopicConfig(com.hazelcast.client.config.ClientReliableTopicConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) ClientConfig(com.hazelcast.client.config.ClientConfig) Before(org.junit.Before)

Example 54 with RingbufferConfig

use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.

the class DynamicConfigTest method testRingbufferConfig_whenConfiguredWithRingbufferStore_byStoreImplementation.

@Test
public void testRingbufferConfig_whenConfiguredWithRingbufferStore_byStoreImplementation() {
    RingbufferConfig config = getRingbufferConfig();
    config.getRingbufferStoreConfig().setEnabled(true).setStoreImplementation(new SampleRingbufferStore());
    driver.getConfig().addRingBufferConfig(config);
    assertConfigurationsEqualOnAllMembers(config);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 55 with RingbufferConfig

use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.

the class DynamicConfigTest method testRingbufferConfig_whenConfiguredWithRingbufferStore_byFactoryClassName.

@Test
public void testRingbufferConfig_whenConfiguredWithRingbufferStore_byFactoryClassName() {
    RingbufferConfig config = getRingbufferConfig();
    config.getRingbufferStoreConfig().setEnabled(true).setFactoryClassName("com.hazelcast.FactoryFoo");
    driver.getConfig().addRingBufferConfig(config);
    assertConfigurationsEqualOnAllMembers(config);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

RingbufferConfig (com.hazelcast.config.RingbufferConfig)91 Test (org.junit.Test)43 Config (com.hazelcast.config.Config)35 QuickTest (com.hazelcast.test.annotation.QuickTest)26 HazelcastInstance (com.hazelcast.core.HazelcastInstance)22 Before (org.junit.Before)21 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)11 RingbufferStoreConfig (com.hazelcast.config.RingbufferStoreConfig)9 Data (com.hazelcast.internal.serialization.Data)7 TopicConfig (com.hazelcast.config.TopicConfig)6 ClientConfig (com.hazelcast.client.config.ClientConfig)5 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)5 CardinalityEstimatorConfig (com.hazelcast.config.CardinalityEstimatorConfig)5 DurableExecutorConfig (com.hazelcast.config.DurableExecutorConfig)5 ExecutorConfig (com.hazelcast.config.ExecutorConfig)5 FlakeIdGeneratorConfig (com.hazelcast.config.FlakeIdGeneratorConfig)5 ListConfig (com.hazelcast.config.ListConfig)5 MapConfig (com.hazelcast.config.MapConfig)5