Search in sources :

Example 1 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardEndsWith.

@Test
public void testMapConfigWildcardEndsWith() {
    MapConfig mapConfig = new MapConfig().setName("*ab");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addMapConfig(mapConfig);
    // we should match this
    assertEquals(mapConfig, config.getMapConfig("xyz.ab"));
    assertEquals(mapConfig, config.getMapConfig("xyz.ab@foo"));
    // we should not match this anymore (endsWith)
    assertNotEquals(mapConfig, config.getMapConfig("xyz.abc"));
    assertNotEquals(mapConfig, config.getMapConfig("xyz.abc@foo"));
}
Also used : MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 2 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardDocumentationExample1.

@Test
public void testMapConfigWildcardDocumentationExample1() {
    MapConfig mapConfig = new MapConfig().setName("com.hazelcast.test.*");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addMapConfig(mapConfig);
    assertEquals(mapConfig, config.getMapConfig("com.hazelcast.test.myMap"));
}
Also used : MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardMultipleConfigs.

@Test
public void testMapConfigWildcardMultipleConfigs() {
    MapConfig mapConfig1 = new MapConfig().setName("com.hazelcast.*");
    MapConfig mapConfig2 = new MapConfig().setName("com.hazelcast.test.*");
    MapConfig mapConfig3 = new MapConfig().setName("com.hazelcast.test.sub.*");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addMapConfig(mapConfig1);
    config.addMapConfig(mapConfig2);
    config.addMapConfig(mapConfig3);
    // we get the best match
    assertEquals(mapConfig1, config.getMapConfig("com.hazelcast.myMap"));
    assertEquals(mapConfig2, config.getMapConfig("com.hazelcast.test.myMap"));
    assertEquals(mapConfig3, config.getMapConfig("com.hazelcast.test.sub.myMap"));
}
Also used : MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 4 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardStartsWith.

@Test
public void testMapConfigWildcardStartsWith() {
    MapConfig mapConfig = new MapConfig().setName("bc*");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addMapConfig(mapConfig);
    // we should match this
    assertEquals(mapConfig, config.getMapConfig("bc.xyz"));
    assertEquals(mapConfig, config.getMapConfig("bc.xyz@foo"));
    // we should not match this anymore (startsWith)
    assertNotEquals(mapConfig, config.getMapConfig("abc.xyz"));
    assertNotEquals(mapConfig, config.getMapConfig("abc.xyz@foo"));
}
Also used : MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 5 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testMapConfigWildcardDocumentationExample3.

@Test
public void testMapConfigWildcardDocumentationExample3() {
    MapConfig mapConfig = new MapConfig().setName("*.test.myMap");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addMapConfig(mapConfig);
    assertEquals(mapConfig, config.getMapConfig("com.hazelcast.test.myMap"));
}
Also used : 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