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);
}
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);
}
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);
}
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]);
}
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]);
}
Aggregations