@Test
 public void testWanConfig() {
   String xml =
       "<hazelcast xmlns=\"http://www.hazelcast.com/schema/config\">\n"
           + "<wan-replication name=\"my-wan-cluster\" snapshot-enabled=\"true\">\n"
           + "    <target-cluster group-name=\"test-cluster-1\" group-password=\"test-pass\">\n"
           + "       <replication-impl>com.hazelcast.enterprise.wan.replication.WanBatchReplication</replication-impl>\n"
           + "       <end-points>\n"
           + "          <address>20.30.40.50:5701</address>\n"
           + "          <address>20.30.40.50:5702</address>\n"
           + "       </end-points>\n"
           + "    </target-cluster>\n"
           + "</wan-replication>\n"
           + "</hazelcast>";
   Config config = buildConfig(xml);
   WanReplicationConfig wanConfig = config.getWanReplicationConfig("my-wan-cluster");
   assertNotNull(wanConfig);
   assertTrue(wanConfig.isSnapshotEnabled());
   List<WanTargetClusterConfig> targetClusterConfigs = wanConfig.getTargetClusterConfigs();
   assertEquals(1, targetClusterConfigs.size());
   WanTargetClusterConfig targetClusterConfig = targetClusterConfigs.get(0);
   assertEquals("test-cluster-1", targetClusterConfig.getGroupName());
   assertEquals("test-pass", targetClusterConfig.getGroupPassword());
   List<String> targetEndpoints = targetClusterConfig.getEndpoints();
   assertEquals(2, targetEndpoints.size());
   assertTrue(targetEndpoints.contains("20.30.40.50:5701"));
   assertTrue(targetEndpoints.contains("20.30.40.50:5702"));
 }
 @Test
 public void testWanReplicationConfig() {
   WanReplicationConfig wcfg = config.getWanReplicationConfig("testWan");
   assertNotNull(wcfg);
   assertEquals(2, wcfg.getTargetClusterConfigs().size());
   WanTargetClusterConfig targetCfg = wcfg.getTargetClusterConfigs().get(0);
   assertNotNull(targetCfg);
   assertEquals("tokyo", targetCfg.getGroupName());
   assertEquals("tokyo-pass", targetCfg.getGroupPassword());
   assertEquals("com.hazelcast.wan.WanNoDelayReplication", targetCfg.getReplicationImpl());
   assertEquals(2, targetCfg.getEndpoints().size());
   assertEquals("10.2.1.1:5701", targetCfg.getEndpoints().get(0));
   assertEquals("10.2.1.2:5701", targetCfg.getEndpoints().get(1));
   assertEquals(wanReplication, wcfg.getTargetClusterConfigs().get(1).getReplicationImplObject());
 }
 @Test
 public void testWanConfig() {
   String xml =
       HAZELCAST_START_TAG
           + "<wan-replication name=\"my-wan-cluster\" snapshot-enabled=\"true\">\n"
           + "    <target-cluster group-name=\"test-cluster-1\" group-password=\"test-pass\">\n"
           + "       <replication-impl>com.hazelcast.enterprise.wan.replication.WanBatchReplication</replication-impl>\n"
           + "       <end-points>\n"
           + "          <address>20.30.40.50:5701</address>\n"
           + "          <address>20.30.40.50:5702</address>\n"
           + "       </end-points>\n"
           + "       <acknowledge-type>ACK_ON_RECEIPT</acknowledge-type>\n"
           + "       <queue-full-behavior>THROW_EXCEPTION</queue-full-behavior>\n"
           + "       <batch-size>7</batch-size>"
           + "       <batch-max-delay-millis>14</batch-max-delay-millis>\n"
           + "       <queue-capacity>21</queue-capacity>\n"
           + "       <response-timeout-millis>28</response-timeout-millis>\n"
           + "    </target-cluster>\n"
           + "</wan-replication>\n"
           + "</hazelcast>";
   Config config = buildConfig(xml);
   WanReplicationConfig wanConfig = config.getWanReplicationConfig("my-wan-cluster");
   assertNotNull(wanConfig);
   assertTrue(wanConfig.isSnapshotEnabled());
   List<WanTargetClusterConfig> targetClusterConfigs = wanConfig.getTargetClusterConfigs();
   assertEquals(1, targetClusterConfigs.size());
   WanTargetClusterConfig targetClusterConfig = targetClusterConfigs.get(0);
   assertEquals("test-cluster-1", targetClusterConfig.getGroupName());
   assertEquals("test-pass", targetClusterConfig.getGroupPassword());
   List<String> targetEndpoints = targetClusterConfig.getEndpoints();
   assertEquals(2, targetEndpoints.size());
   assertTrue(targetEndpoints.contains("20.30.40.50:5701"));
   assertTrue(targetEndpoints.contains("20.30.40.50:5702"));
   assertEquals(WanAcknowledgeType.ACK_ON_RECEIPT, targetClusterConfig.getAcknowledgeType());
   assertEquals(WANQueueFullBehavior.THROW_EXCEPTION, targetClusterConfig.getQueueFullBehavior());
   assertEquals(7, targetClusterConfig.getBatchSize());
   assertEquals(14, targetClusterConfig.getBatchMaxDelayMillis());
   assertEquals(21, targetClusterConfig.getQueueCapacity());
   assertEquals(28, targetClusterConfig.getResponseTimeoutMillis());
 }
Exemple #4
0
 public Config addWanReplicationConfig(WanReplicationConfig wanReplicationConfig) {
   wanReplicationConfigs.put(wanReplicationConfig.getName(), wanReplicationConfig);
   return this;
 }