[jboss-cvs] JBoss Messaging SVN: r1817 - in trunk: src/main/org/jboss/messaging/core/plugin/postoffice/cluster tests/src/org/jboss/test/messaging/jms/clustering/base tests/src/org/jboss/test/messaging/jms/crash tests/src/org/jboss/test/messaging/tools tests/src/org/jboss/test/messaging/tools/jmx tests/src/org/jboss/test/messaging/tools/jmx/rmi
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Dec 19 00:41:21 EST 2006
Author: ovidiu.feodorov at jboss.com
Date: 2006-12-19 00:41:14 -0500 (Tue, 19 Dec 2006)
New Revision: 1817
Modified:
trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/SendTransactionRequest.java
trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
Log:
Fixed DistributedDestinationsTest.testClusteredTopicDurablePersistent()
The test was failing because all nodes in the cluster cleared the database,
while they also relied on shared counter values that shouldn't have been cleaned.
Fixed by allowing only the first node to clean the database.
Modified: trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/SendTransactionRequest.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/SendTransactionRequest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/src/main/org/jboss/messaging/core/plugin/postoffice/cluster/SendTransactionRequest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -169,12 +169,19 @@
public String toString()
{
StringBuffer sb = new StringBuffer("SendTransactionRequest[");
- for(Iterator i = messageHolders.iterator(); i.hasNext(); )
+ if (messageHolders == null)
{
- sb.append(((MessageHolder)i.next()).getMessage());
- if (i.hasNext())
+ sb.append("EMPTY");
+ }
+ else
+ {
+ for(Iterator i = messageHolders.iterator(); i.hasNext(); )
{
- sb.append(',');
+ sb.append(((MessageHolder)i.next()).getMessage());
+ if (i.hasNext())
+ {
+ sb.append(',');
+ }
}
}
sb.append("]");
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -91,8 +91,10 @@
for(int i = 0; i < nodeCount; i++)
{
- // make sure all servers are created and started
- ServerManagement.start(i, "all");
+ // make sure all servers are created and started; make sure that database is zapped
+ // ONLY for the first server, the others rely on values they expect to find in shared
+ // tables; don't clear the database for those.
+ ServerManagement.start(i, "all", i == 0);
ServerManagement.deployClusteredQueue("testDistributedQueue", i);
ServerManagement.deployClusteredTopic("testDistributedTopic", i);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/CallbackFailureTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -73,7 +73,7 @@
localServer = new LocalTestServer();
//Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
localServer.deployQueue("Queue", null, false);
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashLargeLeaseTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -73,7 +73,7 @@
localServer = new LocalTestServer();
// Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
localServer.setAttribute(ServiceContainer.REMOTING_OBJECT_NAME, "LeasePeriod", "30000");
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashNegativeLeaseTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -73,7 +73,7 @@
localServer = new LocalTestServer();
// Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
//Set lease period to -1 --> this should disable leasing so the state won't be cleared up
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -73,7 +73,7 @@
localServer = new LocalTestServer();
// Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
// This crash test is relying on a precise value of LeaseInterval, so we don't rely on
// the default, whatever that is ...
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTwoConnectionsTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -75,7 +75,7 @@
localServer = new LocalTestServer();
// Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
// This crash test is relying on a precise value of LeaseInterval, so we don't rely on
// the default, whatever that is ...
Modified: trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashZeroLeaseTest.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -73,7 +73,7 @@
localServer = new LocalTestServer();
// Start all the services locally
- localServer.start("all");
+ localServer.start("all", true);
//Set lease period to 0 --> this should disable leasing so the state won't be cleared up
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -160,16 +160,29 @@
}
+ /**
+ * Will clear the database at startup.
+ */
public static synchronized void start(String config) throws Exception
{
- start(0, config);
+ start(0, config, true);
}
/**
+ * Will clear the database at startup.
+ */
+ public static synchronized void start(int i, String config) throws Exception
+ {
+ start(i, config, true);
+ }
+
+
+ /**
* When this method correctly completes, the server (local or remote) is started and fully
* operational (the service container and the server peer are created and started)
*/
- public static synchronized void start(int i, String config) throws Exception
+ public static synchronized void start(int i, String config, boolean clearDatabase)
+ throws Exception
{
Server s = create(i);
@@ -177,7 +190,7 @@
log.info("starting server " + i);
- s.start(config);
+ s.start(config, clearDatabase);
log.info("server " + i + " started");
}
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/ServiceContainer.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -288,8 +288,18 @@
// Public --------------------------------------------------------
+
+ /**
+ * By default, starting the container DELETES ALL DATA previously existing in the database.
+ */
public void start() throws Exception
{
+ start(true);
+ }
+
+
+ public void start(boolean cleanDatabase) throws Exception
+ {
try
{
readConfigurationFile();
@@ -380,20 +390,12 @@
startSecurityManager();
}
- if (database && transaction && jca)
+ if (database && transaction && jca && cleanDatabase)
{
// We make sure the database is clean (only if we have all dependencies the database,
// othewise we'll get an access error)
deleteAllData();
}
- else
- {
- if (database)
- {
- log.warn("Previous data has not been cleared, there may be " + "" +
- "garbage lying around in the database!");
- }
- }
loadJNDIContexts();
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/LocalTestServer.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -61,7 +61,7 @@
private static final Logger log = Logger.getLogger(LocalTestServer.class);
- // Static --------------------------------------------------------
+ // Static -------------------------------------------------------- 4
public static void setEnvironmentServerIndex(int serverIndex)
{
@@ -113,7 +113,7 @@
return serverIndex;
}
- public synchronized void start(String containerConfig) throws Exception
+ public synchronized void start(String containerConfig, boolean clearDatabase) throws Exception
{
if (isStarted())
{
@@ -127,7 +127,7 @@
setEnvironmentServerIndex(serverIndex);
sc = new ServiceContainer(containerConfig, null, serverIndex);
- sc.start();
+ sc.start(clearDatabase);
if (this.getDatabaseType().equals("hsqldb") && sc.isClustered())
{
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/RMITestServer.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -139,9 +139,9 @@
return server.getServerID();
}
- public void start(String containerConfig) throws Exception
+ public void start(String containerConfig, boolean clearDatabase) throws Exception
{
- server.start(containerConfig);
+ server.start(containerConfig, clearDatabase);
}
public boolean stop() throws Exception
Modified: trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-12-19 05:15:12 UTC (rev 1816)
+++ trunk/tests/src/org/jboss/test/messaging/tools/jmx/rmi/Server.java 2006-12-19 05:41:14 UTC (rev 1817)
@@ -47,7 +47,7 @@
{
int getServerID() throws Exception;
- void start(String containerConfig) throws Exception;
+ void start(String containerConfig, boolean clearDatabase) throws Exception;
/**
* @return true if the server was stopped indeed, or false if the server was stopped already
More information about the jboss-cvs-commits
mailing list