Search in sources :

Example 96 with NearCacheConfig

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

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcardOnly.

@Test
public void testNearCacheConfigWildcardOnly() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setName("*");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig);
    assertEquals(nearCacheConfig, config.getNearCacheConfig("com.hazelcast.myNearCache"));
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 97 with NearCacheConfig

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

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcard1.

@Test
public void testNearCacheConfigWildcard1() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setName("*hazelcast.test.myNearCache");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig);
    assertEquals(nearCacheConfig, config.getNearCacheConfig("com.hazelcast.test.myNearCache"));
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 98 with NearCacheConfig

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

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcard3.

@Test
public void testNearCacheConfigWildcard3() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setName("com.hazelcast.test.*");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig);
    assertEquals(nearCacheConfig, config.getNearCacheConfig("com.hazelcast.test.myNearCache"));
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 99 with NearCacheConfig

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

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcardMultipleConfigs.

@Test
public void testNearCacheConfigWildcardMultipleConfigs() {
    NearCacheConfig nearCacheConfig1 = new NearCacheConfig().setName("com.hazelcast.*");
    NearCacheConfig nearCacheConfig2 = new NearCacheConfig().setName("com.hazelcast.test.*");
    NearCacheConfig nearCacheConfig3 = new NearCacheConfig().setName("com.hazelcast.test.sub.*");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig1);
    config.addNearCacheConfig(nearCacheConfig2);
    config.addNearCacheConfig(nearCacheConfig3);
    // we should get the best matching result
    assertEquals(nearCacheConfig1, config.getNearCacheConfig("com.hazelcast.myNearCache"));
    assertEquals(nearCacheConfig2, config.getNearCacheConfig("com.hazelcast.test.myNearCache"));
    assertEquals(nearCacheConfig3, config.getNearCacheConfig("com.hazelcast.test.sub.myNearCache"));
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 100 with NearCacheConfig

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

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcardMatchingPointEndsWith.

@Test
public void testNearCacheConfigWildcardMatchingPointEndsWith() {
    NearCacheConfig nearCacheConfig1 = new NearCacheConfig().setName("*.sub");
    NearCacheConfig nearCacheConfig2 = new NearCacheConfig().setName("*.test.sub");
    NearCacheConfig nearCacheConfig3 = new NearCacheConfig().setName("*.hazelcast.test.sub");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig1);
    config.addNearCacheConfig(nearCacheConfig2);
    config.addNearCacheConfig(nearCacheConfig3);
    // we should not match any of the configs (endsWith)
    assertNull(config.getNearCacheConfig("com.hazelFast.Fast.sub.myNearCache"));
    assertNull(config.getNearCacheConfig("hazelFast.test.sub.myNearCache"));
    assertNull(config.getNearCacheConfig("test.sub.myNearCache"));
}
Also used : NearCacheConfig(com.hazelcast.config.NearCacheConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

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