Search in sources :

Example 76 with RingbufferConfig

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

the class RingbufferAsyncAddWithBackoffStressTest method whenNoTTL.

@Test
public void whenNoTTL() throws Exception {
    RingbufferConfig ringbufferConfig = new RingbufferConfig("foo").setCapacity(200 * 1000).setTimeToLiveSeconds(0);
    test(ringbufferConfig);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 77 with RingbufferConfig

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

the class RingbufferAsyncAddWithBackoffStressTest method test.

public void test(RingbufferConfig ringbufferConfig) throws Exception {
    Config config = new Config();
    config.addRingBufferConfig(ringbufferConfig);
    HazelcastInstance[] instances = createHazelcastInstanceFactory(2).newInstances(config);
    ringbuffer = instances[0].getRingbuffer(ringbufferConfig.getName());
    ConsumeThread consumer1 = new ConsumeThread(1);
    consumer1.start();
    ConsumeThread consumer2 = new ConsumeThread(2);
    consumer2.start();
    sleepSeconds(2);
    ProduceThread producer = new ProduceThread();
    producer.start();
    sleepAndStop(stop, 3 * 60);
    System.out.println("Waiting for completion");
    producer.assertSucceedsEventually();
    consumer1.assertSucceedsEventually();
    consumer2.assertSucceedsEventually();
    System.out.println("producer.produced:" + producer.produced);
    assertEquals(producer.produced, consumer1.seq);
    assertEquals(producer.produced, consumer2.seq);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) RingbufferConfig(com.hazelcast.config.RingbufferConfig)

Example 78 with RingbufferConfig

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

the class RingbufferAsyncAddWithBackoffStressTest method whenShortTTLAndBigBuffer.

@Test(timeout = 15 * 60 * 1000)
public void whenShortTTLAndBigBuffer() throws Exception {
    RingbufferConfig ringbufferConfig = new RingbufferConfig("foo").setCapacity(10 * 1000 * 1000).setTimeToLiveSeconds(3);
    test(ringbufferConfig);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) NightlyTest(com.hazelcast.test.annotation.NightlyTest) Test(org.junit.Test)

Example 79 with RingbufferConfig

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

the class RingbufferContainerTest method add_whenBinaryInMemoryFormat.

@Test
public void add_whenBinaryInMemoryFormat() {
    RingbufferConfig config = new RingbufferConfig("foo").setInMemoryFormat(InMemoryFormat.BINARY);
    RingbufferContainer<Data, Data> container = getRingbufferContainer(config);
    ArrayRingbuffer ringbuffer = (ArrayRingbuffer) container.getRingbuffer();
    container.add(toData("foo"));
    assertInstanceOf(Data.class, ringbuffer.getItems()[0]);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) Data(com.hazelcast.internal.serialization.Data) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 80 with RingbufferConfig

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

the class RingbufferContainerTest method add_inObjectInMemoryFormat.

@Test
public void add_inObjectInMemoryFormat() {
    RingbufferConfig config = new RingbufferConfig("foo").setInMemoryFormat(InMemoryFormat.OBJECT);
    RingbufferContainer<Object, String> container = getRingbufferContainer(config);
    ArrayRingbuffer ringbuffer = (ArrayRingbuffer) container.getRingbuffer();
    container.add("foo");
    assertInstanceOf(String.class, ringbuffer.getItems()[0]);
    container.add(toData("bar"));
    assertInstanceOf(String.class, ringbuffer.getItems()[1]);
}
Also used : RingbufferConfig(com.hazelcast.config.RingbufferConfig) 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