예제 #1
0
 @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);
   assertFalse(wcfg.isSnapshotEnabled());
   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.impl.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());
   WanTargetClusterConfig targetClusterConfig0 = wcfg.getTargetClusterConfigs().get(0);
   WanTargetClusterConfig targetClusterConfig1 = wcfg.getTargetClusterConfigs().get(1);
   assertEquals(
       WanAcknowledgeType.ACK_ON_OPERATION_COMPLETE, targetClusterConfig0.getAcknowledgeType());
   assertEquals(WanAcknowledgeType.ACK_ON_RECEIPT, targetClusterConfig1.getAcknowledgeType());
   assertEquals(WANQueueFullBehavior.THROW_EXCEPTION, targetClusterConfig0.getQueueFullBehavior());
   assertEquals(7, targetClusterConfig0.getBatchSize());
   assertEquals(14, targetClusterConfig0.getBatchMaxDelayMillis());
   assertEquals(21, targetClusterConfig0.getQueueCapacity());
   assertEquals(28, targetClusterConfig0.getResponseTimeoutMillis());
 }
 @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());
 }
예제 #4
0
 @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());
 }