activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: ARTEMIS-1253 Renaming NetworkReplicationTest to NetworkIsolationTest
Date Tue, 27 Jun 2017 16:24:33 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 4d6956c29 -> 437232b50


ARTEMIS-1253 Renaming NetworkReplicationTest to NetworkIsolationTest


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/437232b5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/437232b5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/437232b5

Branch: refs/heads/master
Commit: 437232b50ef8b9f21daf3196bc316c62e5b37c57
Parents: 4d6956c
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Tue Jun 27 12:21:37 2017 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Tue Jun 27 12:21:37 2017 -0400

----------------------------------------------------------------------
 .../cluster/failover/NetworkIsolationTest.java  | 198 +++++++++++++++++++
 .../failover/NetworkReplicationTest.java        | 198 -------------------
 2 files changed, 198 insertions(+), 198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/437232b5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java
new file mode 100644
index 0000000..6daa546
--- /dev/null
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkIsolationTest.java
@@ -0,0 +1,198 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.tests.integration.cluster.failover;
+
+import java.net.InetAddress;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.client.ClientSession;
+import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
+import org.apache.activemq.artemis.api.core.client.ServerLocator;
+import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
+import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
+import org.apache.activemq.artemis.tests.util.Wait;
+import org.jboss.logging.Logger;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class NetworkIsolationTest extends FailoverTestBase {
+
+   private static final Logger logger = Logger.getLogger(NetworkIsolationTest.class);
+
+   // This address is guaranteed to fail... reserved for documentation https://tools.ietf.org/html/rfc5737
+   private static final String badAddress = "203.0.113.1";
+
+   @Before
+   @Override
+   public void setUp() throws Exception {
+      this.startBackupServer = false;
+      super.setUp();
+   }
+
+   @Override
+   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live)
{
+      return TransportConfigurationUtils.getNettyAcceptor(live, 1);
+   }
+
+   @Override
+   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live)
{
+      return TransportConfigurationUtils.getNettyConnector(live, 1);
+   }
+
+   protected ClientSession createSession(ClientSessionFactory sf1,
+                                         boolean xa,
+                                         boolean autoCommitSends,
+                                         boolean autoCommitAcks) throws Exception {
+      return addClientSession(sf1.createSession(xa, autoCommitSends, autoCommitAcks));
+   }
+
+   @Test
+   public void testReactivate() throws Exception {
+      liveServer.getServer().getConfiguration().setNetworkCheckPeriod(100).setNetworkCheckTimeout(200);
+      liveServer.start();
+
+      Assert.assertTrue(Wait.waitFor(liveServer::isActive));
+
+      liveServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
+
+      Assert.assertTrue(Wait.waitFor(() -> !liveServer.isStarted()));
+
+      liveServer.getServer().getNetworkHealthCheck().clearAddresses();
+
+      Assert.assertTrue(Wait.waitFor(liveServer::isStarted));
+   }
+
+   @Test
+   public void testDoNotActivateOnIsolation() throws Exception {
+      AssertionLoggerHandler.startCapture();
+
+      try {
+         ServerLocator locator = getServerLocator();
+
+         // this block here is just to validate if ignoring loopback addresses logic is in
place
+         {
+            backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName("127.0.0.1"));
+
+            Assert.assertTrue(AssertionLoggerHandler.findText("AMQ202001"));
+
+            AssertionLoggerHandler.clear();
+
+            backupServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
+
+            Assert.assertFalse(AssertionLoggerHandler.findText("AMQ202001"));
+
+            backupServer.getServer().getNetworkHealthCheck().clearAddresses();
+         }
+
+         backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
+         backupServer.getServer().start();
+
+         ClientSessionFactory sf = addSessionFactory(locator.createSessionFactory());
+
+         ClientSession session = createSession(sf, false, true, true);
+
+         session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
+
+         Assert.assertFalse(backupServer.getServer().getNetworkHealthCheck().check());
+
+         crash(false, true, session);
+
+         for (int i = 0; i < 1000 && !backupServer.isStarted(); i++) {
+            Thread.sleep(10);
+         }
+
+         Assert.assertTrue(backupServer.isStarted());
+         Assert.assertFalse(backupServer.isActive());
+
+         liveServer.start();
+
+         for (int i = 0; i < 1000 && backupServer.getServer().getReplicationEndpoint()
!= null && !backupServer.getServer().getReplicationEndpoint().isStarted(); i++) {
+            Thread.sleep(10);
+         }
+
+         backupServer.getServer().getNetworkHealthCheck().clearAddresses();
+
+         // This will make sure the backup got synchronized after the network was activated
again
+         Assert.assertTrue(backupServer.getServer().getReplicationEndpoint().isStarted());
+      } finally {
+         AssertionLoggerHandler.stopCapture();
+      }
+   }
+
+   @Test
+   public void testLiveIsolated() throws Exception {
+      backupServer.stop();
+
+      liveServer.stop();
+      liveServer.getServer().getConfiguration().setNetworkCheckList(badAddress).
+         setNetworkCheckPeriod(100).setNetworkCheckTimeout(100);
+
+      try {
+
+         liveServer.start();
+
+         Assert.assertEquals(100L, liveServer.getServer().getNetworkHealthCheck().getPeriod());
+
+         liveServer.getServer().getNetworkHealthCheck().setTimeUnit(TimeUnit.MILLISECONDS);
+
+         Assert.assertFalse(liveServer.getServer().getNetworkHealthCheck().check());
+
+         long timeout = System.currentTimeMillis() + 30000;
+         while (liveServer.isStarted() && System.currentTimeMillis() < timeout)
{
+            Thread.sleep(100);
+         }
+
+         Assert.assertFalse(liveServer.isStarted());
+
+         liveServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
+
+         timeout = System.currentTimeMillis() + 30000;
+         while (!liveServer.isStarted() && System.currentTimeMillis() < timeout)
{
+            Thread.sleep(100);
+         }
+
+         Assert.assertTrue(liveServer.isStarted());
+      } catch (Throwable e) {
+         logger.warn(e.getMessage(), e);
+         throw e;
+      } finally {
+         liveServer.getServer().stop();
+         backupServer.getServer().stop();
+      }
+
+   }
+
+   @Override
+   protected void createConfigs() throws Exception {
+      createReplicatedConfigs();
+   }
+
+   @Override
+   protected void crash(boolean failover, boolean waitFailure, ClientSession... sessions)
throws Exception {
+      if (sessions.length > 0) {
+         for (ClientSession session : sessions) {
+            waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
+         }
+      } else {
+         waitForRemoteBackup(null, 5, true, backupServer.getServer());
+      }
+      super.crash(failover, waitFailure, sessions);
+   }
+}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/437232b5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
deleted file mode 100644
index 98b169a..0000000
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NetworkReplicationTest.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.activemq.artemis.tests.integration.cluster.failover;
-
-import java.net.InetAddress;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.activemq.artemis.api.core.TransportConfiguration;
-import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.api.core.client.ServerLocator;
-import org.apache.activemq.artemis.logs.AssertionLoggerHandler;
-import org.apache.activemq.artemis.tests.util.TransportConfigurationUtils;
-import org.apache.activemq.artemis.tests.util.Wait;
-import org.jboss.logging.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NetworkReplicationTest extends FailoverTestBase {
-
-   private static final Logger logger = Logger.getLogger(NetworkReplicationTest.class);
-
-   // This address is guaranteed to fail... reserved for documentation https://tools.ietf.org/html/rfc5737
-   private static final String badAddress = "203.0.113.1";
-
-   @Before
-   @Override
-   public void setUp() throws Exception {
-      this.startBackupServer = false;
-      super.setUp();
-   }
-
-   @Override
-   protected TransportConfiguration getAcceptorTransportConfiguration(final boolean live)
{
-      return TransportConfigurationUtils.getNettyAcceptor(live, 1);
-   }
-
-   @Override
-   protected TransportConfiguration getConnectorTransportConfiguration(final boolean live)
{
-      return TransportConfigurationUtils.getNettyConnector(live, 1);
-   }
-
-   protected ClientSession createSession(ClientSessionFactory sf1,
-                                         boolean xa,
-                                         boolean autoCommitSends,
-                                         boolean autoCommitAcks) throws Exception {
-      return addClientSession(sf1.createSession(xa, autoCommitSends, autoCommitAcks));
-   }
-
-   @Test
-   public void testReactivate() throws Exception {
-      liveServer.getServer().getConfiguration().setNetworkCheckPeriod(100).setNetworkCheckTimeout(200);
-      liveServer.start();
-
-      Assert.assertTrue(Wait.waitFor(liveServer::isActive));
-
-      liveServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
-
-      Assert.assertTrue(Wait.waitFor(() -> !liveServer.isStarted()));
-
-      liveServer.getServer().getNetworkHealthCheck().clearAddresses();
-
-      Assert.assertTrue(Wait.waitFor(liveServer::isStarted));
-   }
-
-   @Test
-   public void testDoNotActivateOnIsolation() throws Exception {
-      AssertionLoggerHandler.startCapture();
-
-      try {
-         ServerLocator locator = getServerLocator();
-
-         // this block here is just to validate if ignoring loopback addresses logic is in
place
-         {
-            backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName("127.0.0.1"));
-
-            Assert.assertTrue(AssertionLoggerHandler.findText("AMQ202001"));
-
-            AssertionLoggerHandler.clear();
-
-            backupServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
-
-            Assert.assertFalse(AssertionLoggerHandler.findText("AMQ202001"));
-
-            backupServer.getServer().getNetworkHealthCheck().clearAddresses();
-         }
-
-         backupServer.getServer().getNetworkHealthCheck().addAddress(InetAddress.getByName(badAddress));
-         backupServer.getServer().start();
-
-         ClientSessionFactory sf = addSessionFactory(locator.createSessionFactory());
-
-         ClientSession session = createSession(sf, false, true, true);
-
-         session.createQueue(FailoverTestBase.ADDRESS, FailoverTestBase.ADDRESS, null, true);
-
-         Assert.assertFalse(backupServer.getServer().getNetworkHealthCheck().check());
-
-         crash(false, true, session);
-
-         for (int i = 0; i < 1000 && !backupServer.isStarted(); i++) {
-            Thread.sleep(10);
-         }
-
-         Assert.assertTrue(backupServer.isStarted());
-         Assert.assertFalse(backupServer.isActive());
-
-         liveServer.start();
-
-         for (int i = 0; i < 1000 && backupServer.getServer().getReplicationEndpoint()
!= null && !backupServer.getServer().getReplicationEndpoint().isStarted(); i++) {
-            Thread.sleep(10);
-         }
-
-         backupServer.getServer().getNetworkHealthCheck().clearAddresses();
-
-         // This will make sure the backup got synchronized after the network was activated
again
-         Assert.assertTrue(backupServer.getServer().getReplicationEndpoint().isStarted());
-      } finally {
-         AssertionLoggerHandler.stopCapture();
-      }
-   }
-
-   @Test
-   public void testLiveIsolated() throws Exception {
-      backupServer.stop();
-
-      liveServer.stop();
-      liveServer.getServer().getConfiguration().setNetworkCheckList(badAddress).
-         setNetworkCheckPeriod(100).setNetworkCheckTimeout(100);
-
-      try {
-
-         liveServer.start();
-
-         Assert.assertEquals(100L, liveServer.getServer().getNetworkHealthCheck().getPeriod());
-
-         liveServer.getServer().getNetworkHealthCheck().setTimeUnit(TimeUnit.MILLISECONDS);
-
-         Assert.assertFalse(liveServer.getServer().getNetworkHealthCheck().check());
-
-         long timeout = System.currentTimeMillis() + 30000;
-         while (liveServer.isStarted() && System.currentTimeMillis() < timeout)
{
-            Thread.sleep(100);
-         }
-
-         Assert.assertFalse(liveServer.isStarted());
-
-         liveServer.getServer().getNetworkHealthCheck().setIgnoreLoopback(true).addAddress(InetAddress.getByName("127.0.0.1"));
-
-         timeout = System.currentTimeMillis() + 30000;
-         while (!liveServer.isStarted() && System.currentTimeMillis() < timeout)
{
-            Thread.sleep(100);
-         }
-
-         Assert.assertTrue(liveServer.isStarted());
-      } catch (Throwable e) {
-         logger.warn(e.getMessage(), e);
-         throw e;
-      } finally {
-         liveServer.getServer().stop();
-         backupServer.getServer().stop();
-      }
-
-   }
-
-   @Override
-   protected void createConfigs() throws Exception {
-      createReplicatedConfigs();
-   }
-
-   @Override
-   protected void crash(boolean failover, boolean waitFailure, ClientSession... sessions)
throws Exception {
-      if (sessions.length > 0) {
-         for (ClientSession session : sessions) {
-            waitForRemoteBackup(session.getSessionFactory(), 5, true, backupServer.getServer());
-         }
-      } else {
-         waitForRemoteBackup(null, 5, true, backupServer.getServer());
-      }
-      super.crash(failover, waitFailure, sessions);
-   }
-}


Mime
View raw message