Search in sources :

Example 11 with MatchingPointConfigPatternMatcher

use of com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher 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)

Example 12 with MatchingPointConfigPatternMatcher

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

the class Jet method configureJetService.

static void configureJetService(JetConfig jetConfig) {
    if (!(jetConfig.getHazelcastConfig().getConfigPatternMatcher() instanceof MatchingPointConfigPatternMatcher)) {
        throw new UnsupportedOperationException("Custom config pattern matcher is not supported in Jet");
    }
    jetConfig.getHazelcastConfig().getServicesConfig().addServiceConfig(new ServiceConfig().setEnabled(true).setName(JetService.SERVICE_NAME).setClassName(JetService.class.getName()).setConfigObject(jetConfig));
    jetConfig.getHazelcastConfig().addMapConfig(new MapConfig(INTERNAL_JET_OBJECTS_PREFIX + "*").setBackupCount(jetConfig.getInstanceConfig().getBackupCount()).setStatisticsEnabled(false).setMergePolicy(IgnoreMergingEntryMapMergePolicy.class.getName()));
}
Also used : JetService(com.hazelcast.jet.impl.JetService) ServiceConfig(com.hazelcast.config.ServiceConfig) MapConfig(com.hazelcast.config.MapConfig) MatchingPointConfigPatternMatcher(com.hazelcast.config.matcher.MatchingPointConfigPatternMatcher)

Example 13 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testQueueConfigWithoutWildcard.

@Test
public void testQueueConfigWithoutWildcard() {
    QueueConfig queueConfig = new QueueConfig().setName("someQueue");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addQueueConfig(queueConfig);
    assertEquals(queueConfig, config.getQueueConfig("someQueue"));
    assertEquals(queueConfig, config.getQueueConfig("someQueue@foo"));
    // non-matching name
    assertNotEquals(queueConfig, config.getQueueConfig("doesNotExist"));
    // non-matching case
    assertNotEquals(queueConfig, config.getQueueConfig("SomeQueue"));
}
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 14 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testQueueConfigWildcardDocumentationExample1.

@Test
public void testQueueConfigWildcardDocumentationExample1() {
    QueueConfig queueConfig = new QueueConfig().setName("*hazelcast.test.myQueue");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addQueueConfig(queueConfig);
    assertEquals(queueConfig, config.getQueueConfig("com.hazelcast.test.myQueue"));
}
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 15 with MatchingPointConfigPatternMatcher

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

the class MatchingPointConfigPatternMatcherTest method testQueueConfigWildcardDocumentationExample2.

@Test
public void testQueueConfigWildcardDocumentationExample2() {
    QueueConfig queueConfig = new QueueConfig().setName("com.hazelcast.*.myQueue");
    Config config = new Config();
    config.setConfigPatternMatcher(new MatchingPointConfigPatternMatcher());
    config.addQueueConfig(queueConfig);
    assertEquals(queueConfig, config.getQueueConfig("com.hazelcast.test.myQueue"));
}
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