Search in sources :

Example 1 with WanConsumerConfig

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

the class TestFullApplicationContext method testWanReplicationConfig.

@Test
public void testWanReplicationConfig() {
    WanReplicationConfig wcfg = config.getWanReplicationConfig("testWan");
    assertNotNull(wcfg);
    WanPublisherConfig publisherConfig = wcfg.getWanPublisherConfigs().get(0);
    assertEquals("tokyo", publisherConfig.getGroupName());
    assertEquals("com.hazelcast.enterprise.wan.replication.WanBatchReplication", publisherConfig.getClassName());
    assertEquals(WANQueueFullBehavior.THROW_EXCEPTION, publisherConfig.getQueueFullBehavior());
    assertEquals(1000, publisherConfig.getQueueCapacity());
    Map<String, Comparable> publisherProps = publisherConfig.getProperties();
    assertEquals("50", publisherProps.get("batch.size"));
    assertEquals("3000", publisherProps.get("batch.max.delay.millis"));
    assertEquals("false", publisherProps.get("snapshot.enabled"));
    assertEquals("5000", publisherProps.get("response.timeout.millis"));
    assertEquals(WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE.name(), publisherProps.get("ack.type"));
    assertEquals("pass", publisherProps.get("group.password"));
    WanPublisherConfig customPublisher = wcfg.getWanPublisherConfigs().get(1);
    assertEquals("istanbul", customPublisher.getGroupName());
    assertEquals("com.hazelcast.wan.custom.CustomPublisher", customPublisher.getClassName());
    assertEquals(WANQueueFullBehavior.THROW_EXCEPTION_ONLY_IF_REPLICATION_ACTIVE, customPublisher.getQueueFullBehavior());
    Map<String, Comparable> customPublisherProps = customPublisher.getProperties();
    assertEquals("prop.publisher", customPublisherProps.get("custom.prop.publisher"));
    WanConsumerConfig consumerConfig = wcfg.getWanConsumerConfig();
    assertEquals("com.hazelcast.wan.custom.WanConsumer", consumerConfig.getClassName());
    Map<String, Comparable> consumerProps = consumerConfig.getProperties();
    assertEquals("prop.consumer", consumerProps.get("custom.prop.consumer"));
    WanReplicationConfig config2 = config.getWanReplicationConfig("testWan2");
    WanConsumerConfig consumerConfig2 = config2.getWanConsumerConfig();
    consumerConfig2.setProperties(consumerProps);
    assertInstanceOf(DummyWanConsumer.class, consumerConfig2.getImplementation());
    assertEquals("prop.consumer", consumerConfig2.getProperties().get("custom.prop.consumer"));
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanConsumerConfig(com.hazelcast.config.WanConsumerConfig) WanPublisherConfig(com.hazelcast.config.WanPublisherConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Aggregations

WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)1 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)1 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)1 QuickTest (com.hazelcast.test.annotation.QuickTest)1 Test (org.junit.Test)1