Search in sources :

Example 21 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher in project hazelcast by hazelcast.

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcardMatchingPointStartsWith.

@Test
public void testNearCacheConfigWildcardMatchingPointStartsWith() {
    NearCacheConfig nearCacheConfig1 = new NearCacheConfig().setName("hazelcast.*");
    NearCacheConfig nearCacheConfig2 = new NearCacheConfig().setName("hazelcast.test.*");
    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 (startsWith)
    assertNull(config.getNearCacheConfig("com.hazelcast.myNearCache"));
    assertNull(config.getNearCacheConfig("com.hazelcast.test.myNearCache"));
    assertNull(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 22 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher in project hazelcast by hazelcast.

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcard2.

@Test
public void testNearCacheConfigWildcard2() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setName("com.hazelcast.*.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 23 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher in project hazelcast by hazelcast.

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardMultipleAmbiguousConfigs.

@Test(expected = InvalidConfigurationException.class)
public void testMapConfigWildcardMultipleAmbiguousConfigs() {
    NearCacheConfig nearCacheConfig1 = new NearCacheConfig().setName("com.hazelcast*");
    NearCacheConfig nearCacheConfig2 = new NearCacheConfig().setName("*com.hazelcast");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig1);
    config.addNearCacheConfig(nearCacheConfig2);
    config.getNearCacheConfig("com.hazelcast");
}
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 24 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher in project hazelcast by hazelcast.

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWildcardOnlyMultipleConfigs.

@Test
public void testNearCacheConfigWildcardOnlyMultipleConfigs() {
    NearCacheConfig nearCacheConfig1 = new NearCacheConfig().setName("*");
    NearCacheConfig nearCacheConfig2 = new NearCacheConfig().setName("com.hazelcast.*");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig1);
    config.addNearCacheConfig(nearCacheConfig2);
    // we should get the best matching result
    assertEquals(nearCacheConfig2, 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 25 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher in project hazelcast by hazelcast.

the class MatchingPointConfigPatternMatcherTest method testNearCacheConfigWithoutWildcard.

@Test
public void testNearCacheConfigWithoutWildcard() {
    NearCacheConfig nearCacheConfig = new NearCacheConfig().setName("someNearCache");
    ClientConfig config = new ClientConfig();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addNearCacheConfig(nearCacheConfig);
    assertEquals(nearCacheConfig, config.getNearCacheConfig("someNearCache"));
    // non-matching name
    assertNotEquals(nearCacheConfig, config.getNearCacheConfig("doesNotExist"));
    // non-matching case
    assertNotEquals(nearCacheConfig, config.getNearCacheConfig("SomeNearCache"));
}
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

MatchingPointConfigPatternMatcher (com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher)25 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)24 QuickTest (com.hazelcast.test.annotation.QuickTest)24 Test (org.junit.Test)24 NearCacheConfig (com.hazelcast.config.NearCacheConfig)10 MapConfig (com.hazelcast.config.MapConfig)1 ServiceConfig (com.hazelcast.config.ServiceConfig)1 JetService (com.hazelcast.jet.impl.JetService)1