use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class RingbufferAbstractTest method setup.
@Before
public void setup() {
config = new Config();
config.addRingBufferConfig(new RingbufferConfig("add_overwritingOldData*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("add_manyTimesRoundTheRing*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_whenBeforeHead*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_whenObjectInMemoryFormat*").setCapacity(5).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("readManyAsync_whenEnoughItems_andObjectInMemoryFormat*").setCapacity(5).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andNoTTL*").setCapacity(300).setTimeToLiveSeconds(0));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_whenCollectionExceedsCapacity*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_manyTimesRoundTheRing*").setCapacity(50));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_whenObjectInMemoryFormat*").setCapacity(50).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("addAsync_fail_whenNoSpace*").setCapacity(300).setTimeToLiveSeconds(10));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andTTL*").setCapacity(300));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andNoTTL*").setCapacity(300).setTimeToLiveSeconds(0));
config.addRingBufferConfig(new RingbufferConfig("remainingCapacity*").setCapacity(300).setTimeToLiveSeconds(10));
config.addRingBufferConfig(new RingbufferConfig("readOne_staleSequence*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_futureSequence*").setCapacity(5));
instances = newInstances(config);
local = instances[0];
HazelcastInstance target = instances[instances.length - 1];
name = HazelcastTestSupport.randomNameOwnedBy(target, getTestMethodName());
ringbuffer = local.getRingbuffer(name);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class ReplicatedMapLiteMemberTest method buildConfig.
private Config buildConfig(final boolean liteMember) {
final Config config = new Config();
config.setLiteMember(liteMember);
return config;
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class ReplicatedMapTest method testAddBinarySyncFillup.
@Test
public void testAddBinarySyncFillup() throws Exception {
Config config = buildConfig(InMemoryFormat.BINARY);
config.getReplicatedMapConfig("default").setAsyncFillup(false);
testFillUp(config);
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class OperationServiceImpl_invokeOnPartitionsTest method test.
@Test
public void test() throws Exception {
Config config = new Config().setProperty(PARTITION_COUNT.getName(), "" + 100);
config.getSerializationConfig().addDataSerializableFactory(123, new SlowOperationSerializationFactory());
HazelcastInstance hz = createHazelcastInstance(config);
OperationServiceImpl opService = getOperationServiceImpl(hz);
Map<Integer, Object> result = opService.invokeOnAllPartitions(null, new OperationFactoryImpl());
assertEquals(100, result.size());
for (Map.Entry<Integer, Object> entry : result.entrySet()) {
int partitionId = entry.getKey();
assertEquals(partitionId * 2, entry.getValue());
}
}
use of com.hazelcast.config.Config in project hazelcast by hazelcast.
the class OperationServiceImpl_timeoutTest method testOperationTimeoutForLongRunningRemoteOperation.
@Test
public void testOperationTimeoutForLongRunningRemoteOperation() throws Exception {
int callTimeoutMillis = 3000;
Config config = new Config().setProperty(OPERATION_CALL_TIMEOUT_MILLIS.getName(), "" + callTimeoutMillis);
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance hz1 = factory.newHazelcastInstance(config);
HazelcastInstance hz2 = factory.newHazelcastInstance(config);
// invoke on the "remote" member
Address remoteAddress = getNode(hz2).getThisAddress();
OperationService operationService = getNode(hz1).getNodeEngine().getOperationService();
ICompletableFuture<Boolean> future = operationService.invokeOnTarget(null, new SleepingOperation(callTimeoutMillis * 5), remoteAddress);
// wait more than operation timeout
sleepAtLeastMillis(callTimeoutMillis * 3);
assertTrue(future.get());
}
Aggregations