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"));
}
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"));
}
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");
}
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"));
}
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"));
}
Aggregations