Search in sources :

Example 21 with NearCacheConfig

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

the class ClientNearCacheTestSupport method testNearCacheExpiration_withMaxIdle.

protected void testNearCacheExpiration_withMaxIdle(InMemoryFormat inMemoryFormat) {
    NearCacheConfig nearCacheConfig = createNearCacheConfig(inMemoryFormat);
    nearCacheConfig.setTimeToLiveSeconds(MAX_IDLE_SECONDS);
    testNearCacheExpiration(nearCacheConfig, MAX_IDLE_SECONDS);
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Example 22 with NearCacheConfig

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

the class XmlClientConfigBuilderTest method testNearCacheConfig_withEvictionConfig_withPreloaderConfig.

@Test
public void testNearCacheConfig_withEvictionConfig_withPreloaderConfig() throws IOException {
    URL schemaResource = XMLConfigBuilderTest.class.getClassLoader().getResource("hazelcast-client-test.xml");
    ClientConfig clientConfig = new XmlClientConfigBuilder(schemaResource).build();
    assertEquals("MyInstanceName", clientConfig.getInstanceName());
    NearCacheConfig nearCacheConfig = clientConfig.getNearCacheConfig("nearCacheWithEvictionAndPreloader");
    assertEquals(10000, nearCacheConfig.getTimeToLiveSeconds());
    assertEquals(5000, nearCacheConfig.getMaxIdleSeconds());
    assertFalse(nearCacheConfig.isInvalidateOnChange());
    assertEquals(InMemoryFormat.OBJECT, nearCacheConfig.getInMemoryFormat());
    assertTrue(nearCacheConfig.isCacheLocalEntries());
    assertNotNull(nearCacheConfig.getEvictionConfig());
    assertEquals(100, nearCacheConfig.getEvictionConfig().getSize());
    assertEquals(EvictionConfig.MaxSizePolicy.ENTRY_COUNT, nearCacheConfig.getEvictionConfig().getMaximumSizePolicy());
    assertEquals(EvictionPolicy.LFU, nearCacheConfig.getEvictionConfig().getEvictionPolicy());
    assertNotNull(nearCacheConfig.getPreloaderConfig());
    assertTrue(nearCacheConfig.getPreloaderConfig().isEnabled());
    assertEquals("/tmp/myNearCache", nearCacheConfig.getPreloaderConfig().getDirectory());
    assertEquals(2342, nearCacheConfig.getPreloaderConfig().getStoreInitialDelaySeconds());
    assertEquals(4223, nearCacheConfig.getPreloaderConfig().getStoreIntervalSeconds());
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest) URL(java.net.URL) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) XMLConfigBuilderTest(com.hazelcast.config.XMLConfigBuilderTest)

Example 23 with NearCacheConfig

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

the class ClientMapNearCacheStalenessTest method getClientConfig.

protected ClientConfig getClientConfig(String mapName) {
    NearCacheConfig nearCacheConfig = getNearCacheConfig(mapName);
    ClientConfig clientConfig = new ClientConfig();
    clientConfig.addNearCacheConfig(nearCacheConfig);
    return clientConfig;
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) ClientConfig(com.hazelcast.client.config.ClientConfig)

Example 24 with NearCacheConfig

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

the class ClientMapNearCacheStalenessTest method getNearCacheConfig.

private NearCacheConfig getNearCacheConfig(String mapName) {
    NearCacheConfig nearCacheConfig = new NearCacheConfig(mapName);
    nearCacheConfig.setInvalidateOnChange(true);
    return nearCacheConfig;
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Example 25 with NearCacheConfig

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

the class ClientMapRecordStateStressTest method newNearCacheConfig.

protected NearCacheConfig newNearCacheConfig() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig();
    nearCacheConfig.setName(mapName);
    nearCacheConfig.setInvalidateOnChange(true);
    return nearCacheConfig;
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig)

Aggregations

NearCacheConfig (com.hazelcast.config.NearCacheConfig)212 Test (org.junit.Test)89 QuickTest (com.hazelcast.test.annotation.QuickTest)82 Config (com.hazelcast.config.Config)66 HazelcastInstance (com.hazelcast.core.HazelcastInstance)65 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)62 ClientConfig (com.hazelcast.client.config.ClientConfig)51 MapConfig (com.hazelcast.config.MapConfig)37 EvictionConfig (com.hazelcast.config.EvictionConfig)24 Before (org.junit.Before)17 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)16 CacheConfig (com.hazelcast.config.CacheConfig)15 ParallelTest (com.hazelcast.test.annotation.ParallelTest)15 NearCacheTestUtils.getBaseConfig (com.hazelcast.internal.nearcache.impl.NearCacheTestUtils.getBaseConfig)14 AssertTask (com.hazelcast.test.AssertTask)14 NightlyTest (com.hazelcast.test.annotation.NightlyTest)12 MapStoreConfig (com.hazelcast.config.MapStoreConfig)11 Data (com.hazelcast.nio.serialization.Data)11 MatchingPointConfigPatternMatcher (com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher)10 CachingProvider (javax.cache.spi.CachingProvider)10