Author: borges
Date: 2011-12-06 05:27:49 -0500 (Tue, 06 Dec 2011)
New Revision: 11850
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
Log:
Delete unnecessary tearDown code.
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -18,13 +18,10 @@
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
import org.hornetq.api.core.client.ClientSessionFactory;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.message.impl.MessageImpl;
public class ClusterHeadersRemovedTest extends ClusterTestBase
{
- private static final Logger log = Logger.getLogger(ClusterHeadersRemovedTest.class);
-
@Override
protected void setUp() throws Exception
{
@@ -34,25 +31,11 @@
setupServer(1, isFileStorage(), isNetty());
}
- @Override
- protected void tearDown() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
}
-
+
public void testHeadersRemoved() throws Exception
{
setupClusterConnection("cluster1", 0, 1, "queues", false, 1,
isNetty(), false);
@@ -64,14 +47,14 @@
createQueue(0, "queues.testaddress", "queue0", null, false);
createQueue(1, "queues.testaddress", "queue0", null, false);
-
+
addConsumer(1, 1, "queue0", null);
-
+
waitForBindings(0, "queues.testaddress", 1, 0, true);
waitForBindings(0, "queues.testaddress", 1, 1, false);
-
+
waitForBindings(1, "queues.testaddress", 1, 1, true);
-
+
ClientSessionFactory sf = sfs[0];
ClientSession session0 = sf.createSession(false, true, true);
@@ -91,15 +74,15 @@
{
session0.close();
}
-
+
ClientConsumer consumer = super.getConsumer(1);
-
+
for (int i = 0; i < 10; i++)
{
ClientMessage message = consumer.receive(5000);
-
+
assertNotNull(message);
-
+
assertFalse(message.containsProperty(MessageImpl.HDR_ROUTE_TO_IDS));
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -168,18 +168,23 @@
{
if (servers[i] == null)
continue;
-
- final ClusterManager clusterManager = servers[i].getClusterManager();
- if (clusterManager != null)
+ try
{
- for (ClusterConnection cc : clusterManager.getClusterConnections())
+ final ClusterManager clusterManager = servers[i].getClusterManager();
+ if (clusterManager != null)
{
- cc.stop();
+ for (ClusterConnection cc : clusterManager.getClusterConnections())
+ {
+ cc.stop();
+ }
}
}
+ catch (Exception e)
+ {
+ // no-op
+ }
stopComponent(servers[i]);
-
- }
+ }
for (int i = 0; i < MAX_SERVERS; i++)
{
stopComponent(nodeManagers[i]);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusterWithBackupTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -46,14 +46,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -134,16 +126,4 @@
setupLiveServer(5, isFileStorage(), true, isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4, 5);
- }
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -1047,12 +1047,6 @@
}
}
- @Override
- protected void tearDown() throws Exception
- {
- super.tearDown(); //To change body of overridden methods use File | Settings |
File Templates.
- }
-
public boolean isNetty()
{
return true;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -36,14 +36,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -162,16 +154,4 @@
setupServer(3, isFileStorage(), isNetty());
setupServer(4, isFileStorage(), isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4);
- }
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -22,7 +22,6 @@
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientProducer;
import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.settings.impl.AddressSettings;
/**
@@ -34,8 +33,6 @@
*/
public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
{
- private static final Logger log =
Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
-
protected final String groupAddress = getUDPDiscoveryAddress();
protected final int groupPort = getUDPDiscoveryPort();
@@ -45,25 +42,13 @@
return false;
}
+ @Override
protected void setUp() throws Exception
{
super.setUp();
setupCluster();
}
- protected void tearDown() throws Exception
- {
- for (int i = 0; i < servers.length; i++)
- {
- if (servers[i] != null)
- {
- servers[i].stop();
- servers[i] = null;
- }
- }
- super.tearDown();
- }
-
protected void setupCluster() throws Exception
{
setupCluster(false);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -13,14 +13,14 @@
package org.hornetq.tests.integration.cluster.distribution;
+import java.util.Map;
+import java.util.Set;
+
import org.hornetq.core.logging.Logger;
import org.hornetq.core.server.cluster.ClusterConnection;
import org.hornetq.core.server.cluster.MessageFlowRecord;
import org.hornetq.core.server.cluster.impl.ClusterConnectionImpl;
-import java.util.Map;
-import java.util.Set;
-
/**
* A OneWayChainClusterTest
*
@@ -46,20 +46,6 @@
setupServer(4, isFileStorage(), isNetty());
}
- @Override
- protected void tearDown() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1, 2, 3, 4);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -396,6 +382,5 @@
records = ccon.getRecords();
assertNotNull(records);
assertEquals(records.size(), 1);
-
System.out.println("OneWayChainClusterTest.testChainClusterConnections");
}
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -44,21 +44,6 @@
setupClusterConnection("clusterX", 1, -1, "queues", false, 1,
isNetty(), true);
}
- @Override
- protected void tearDown() throws Exception
- {
- log.info("#test Tear down");
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -41,6 +41,7 @@
// Public --------------------------------------------------------
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -55,6 +56,7 @@
* @param pairs
* @return
*/
+ @Override
protected ClusterConnectionConfiguration createClusterConfig(final String name,
final String address,
final boolean
forwardWhenNoConsumers,
@@ -75,13 +77,6 @@
return clusterConf;
}
- public void tearDown() throws Exception
- {
- log.info("#test tearDown " + loopNumber);
- stopServers(0, 1, 2, 3, 4);
- super.tearDown();
- }
-
public boolean isNetty()
{
return false;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -18,7 +18,6 @@
import org.hornetq.api.core.client.ClientConsumer;
import org.hornetq.api.core.client.ClientMessage;
import org.hornetq.api.core.client.ClientSession;
-import org.hornetq.core.logging.Logger;
/**
* A TemporaryQueueClusterTest
@@ -30,17 +29,6 @@
public class TemporaryQueueClusterTest extends ClusterTestBase
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
- private static final Logger log =
Logger.getLogger(ClusteredRequestResponseTest.class);
-
@Override
protected void setUp() throws Exception
{
@@ -49,14 +37,6 @@
setupServers();
}
- @Override
- protected void tearDown() throws Exception
- {
- stopServers();
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
@@ -124,24 +104,4 @@
setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty());
}
-
- protected void stopServers() throws Exception
- {
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
}
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -49,21 +49,6 @@
setupClusterConnection("cluster1", 1, 0, "queues", false, 1,
isNetty(), false);
}
- @Override
- protected void tearDown() throws Exception
- {
- log.info("#test tearDown");
- closeAllConsumers();
-
- closeAllSessionFactories();
-
- closeAllServerLocatorsFactories();
-
- stopServers(0, 1);
-
- super.tearDown();
- }
-
protected boolean isNetty()
{
return false;
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/ReplicatedDistributionTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -236,12 +236,21 @@
@Override
protected void tearDown() throws Exception
{
- if (sessionOne != null)
- sessionOne.close();
- if (sessionThree != null)
- sessionThree.close();
-
- super.tearDown();
+ try
+ {
+ if (consThree != null)
+ consThree.close();
+ if (producer != null)
+ producer.close();
+ if (sessionOne != null)
+ sessionOne.close();
+ if (sessionThree != null)
+ sessionThree.close();
+ }
+ finally
+ {
+ super.tearDown();
+ }
}
protected boolean isShared()
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -16,20 +16,19 @@
import org.hornetq.api.core.TransportConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.logging.Logger;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class HAClientTopologyTest extends TopologyClusterTestBase
{
- private static final Logger log = Logger.getLogger(HAClientTopologyTest.class);
-
+ @Override
protected boolean isNetty()
{
return false;
}
+ @Override
protected void setupCluster() throws Exception
{
setupCluster(false);
@@ -44,6 +43,7 @@
setupClusterConnection("cluster4", "queues",
forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
}
+ @Override
protected void setupServers() throws Exception
{
setupServer(0, isFileStorage(), isNetty());
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -16,24 +16,23 @@
import org.hornetq.api.core.DiscoveryGroupConfiguration;
import org.hornetq.api.core.client.HornetQClient;
import org.hornetq.api.core.client.ServerLocator;
-import org.hornetq.core.logging.Logger;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
*/
public class HAClientTopologyWithDiscoveryTest extends TopologyClusterTestBase
{
- private static final Logger log =
Logger.getLogger(HAClientTopologyWithDiscoveryTest.class);
-
protected final String groupAddress = getUDPDiscoveryAddress();
protected final int groupPort = getUDPDiscoveryPort();
+ @Override
protected boolean isNetty()
{
return false;
}
+ @Override
protected void setupCluster() throws Exception
{
setupCluster(false);
@@ -48,6 +47,7 @@
setupDiscoveryClusterConnection("cluster4", 4, "dg1",
"queues", forwardWhenNoConsumers, 1, isNetty());
}
+ @Override
protected void setupServers() throws Exception
{
setupLiveServerWithDiscovery(0, groupAddress, groupPort, isFileStorage(),
isNetty(), false);
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-06
10:08:37 UTC (rev 11849)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/topology/TopologyClusterTestBase.java 2011-12-06
10:27:49 UTC (rev 11850)
@@ -44,20 +44,6 @@
public abstract class TopologyClusterTestBase extends ClusterTestBase
{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
private static final Logger log = Logger.getLogger(TopologyClusterTestBase.class);
private static final long WAIT_TIMEOUT = 5000;
@@ -110,9 +96,9 @@
continue;
}
boolean ok = true;
- for (int i = 0; i < expected.length; i++)
+ for (int element : expected)
{
- ok = (ok && actual.contains(nodeIDs[expected[i]]));
+ ok = (ok && actual.contains(nodeIDs[element]));
}
if (ok)
{
@@ -480,9 +466,8 @@
assertTrue("Was not notified that all servers are Down", ok);
checkContains(new int[] { 0 }, nodeIDs, nodes);
- for (int i = 0; i < sfs.length; i++)
+ for (ClientSessionFactory sf : sfs)
{
- ClientSessionFactory sf = sfs[i];
sf.close();
}