Search in sources :

Example 6 with WanReplicationConfig

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

the class AddWanConfigOperation method readInternal.

@Override
protected void readInternal(ObjectDataInput in) throws IOException {
    wanReplicationConfig = new WanReplicationConfig();
    wanReplicationConfig.readData(in);
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig)

Example 7 with WanReplicationConfig

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

the class RestTest method addWanConfig.

@Test
public void addWanConfig() throws Exception {
    WanReplicationConfig wanConfig = new WanReplicationConfig();
    wanConfig.setName("test");
    WanReplicationConfigDTO dto = new WanReplicationConfigDTO(wanConfig);
    String result = communicator.addWanConfig(dto.toJson().toString());
    assertEquals("{\"status\":\"fail\",\"message\":\"java.lang.UnsupportedOperationException: Adding new WAN config is not supported.\"}", result);
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanReplicationConfigDTO(com.hazelcast.internal.management.dto.WanReplicationConfigDTO) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 8 with WanReplicationConfig

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

Example 9 with WanReplicationConfig

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

the class ClientMapWANExceptionTest method getConfig.

@Override
protected Config getConfig() {
    Config config = new Config();
    WanReplicationConfig wanConfig = new WanReplicationConfig();
    wanConfig.setName("dummyWan");
    wanConfig.addWanPublisherConfig(getWanPublisherConfig());
    WanReplicationRef wanRef = new WanReplicationRef();
    wanRef.setName("dummyWan");
    wanRef.setMergePolicy(PassThroughMergePolicy.class.getName());
    config.addWanReplicationConfig(wanConfig);
    config.getMapConfig("default").setWanReplicationRef(wanRef);
    return config;
}
Also used : WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) PassThroughMergePolicy(com.hazelcast.map.merge.PassThroughMergePolicy) WanReplicationRef(com.hazelcast.config.WanReplicationRef) Config(com.hazelcast.config.Config) WanReplicationConfig(com.hazelcast.config.WanReplicationConfig) WanPublisherConfig(com.hazelcast.config.WanPublisherConfig)

Aggregations

WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)9 WanPublisherConfig (com.hazelcast.config.WanPublisherConfig)6 QuickTest (com.hazelcast.test.annotation.QuickTest)3 Test (org.junit.Test)3 Config (com.hazelcast.config.Config)2 WanReplicationRef (com.hazelcast.config.WanReplicationRef)2 WanReplicationConfigDTO (com.hazelcast.internal.management.dto.WanReplicationConfigDTO)2 PassThroughMergePolicy (com.hazelcast.map.merge.PassThroughMergePolicy)2 JsonArray (com.eclipsesource.json.JsonArray)1 JsonObject (com.eclipsesource.json.JsonObject)1 WanConsumerConfig (com.hazelcast.config.WanConsumerConfig)1 Member (com.hazelcast.core.Member)1 AddWanConfigOperation (com.hazelcast.internal.management.operation.AddWanConfigOperation)1 InternalCompletableFuture (com.hazelcast.spi.InternalCompletableFuture)1 OperationService (com.hazelcast.spi.OperationService)1 ParallelTest (com.hazelcast.test.annotation.ParallelTest)1 StringUtil.bytesToString (com.hazelcast.util.StringUtil.bytesToString)1 WanReplicationEndpoint (com.hazelcast.wan.WanReplicationEndpoint)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1