Search in sources :

Example 26 with Config

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);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) RingbufferConfig(com.hazelcast.config.RingbufferConfig) Config(com.hazelcast.config.Config) RingbufferConfig(com.hazelcast.config.RingbufferConfig) Before(org.junit.Before)

Example 27 with Config

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;
}
Also used : Config(com.hazelcast.config.Config)

Example 28 with 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);
}
Also used : Config(com.hazelcast.config.Config) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 29 with 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());
    }
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Config(com.hazelcast.config.Config) Map(java.util.Map) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 30 with Config

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());
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Address(com.hazelcast.nio.Address) Config(com.hazelcast.config.Config) OperationService(com.hazelcast.spi.OperationService) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Config (com.hazelcast.config.Config)2458 Test (org.junit.Test)1570 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1465 QuickTest (com.hazelcast.test.annotation.QuickTest)1286 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1003 MapConfig (com.hazelcast.config.MapConfig)599 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)497 MapStoreConfig (com.hazelcast.config.MapStoreConfig)300 NearCacheConfig (com.hazelcast.config.NearCacheConfig)270 Before (org.junit.Before)242 ClientConfig (com.hazelcast.client.config.ClientConfig)228 SlowTest (com.hazelcast.test.annotation.SlowTest)204 NightlyTest (com.hazelcast.test.annotation.NightlyTest)186 CountDownLatch (java.util.concurrent.CountDownLatch)182 IndexConfig (com.hazelcast.config.IndexConfig)162 JoinConfig (com.hazelcast.config.JoinConfig)142 ParallelTest (com.hazelcast.test.annotation.ParallelTest)141 AssertTask (com.hazelcast.test.AssertTask)131 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)126 CacheSimpleConfig (com.hazelcast.config.CacheSimpleConfig)125