[Jboss-cvs] JBoss Messaging SVN: r1282 - in branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms: . crash
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Sep 12 20:15:00 EDT 2006
Author: clebert.suconic at jboss.com
Date: 2006-09-12 20:14:58 -0400 (Tue, 12 Sep 2006)
New Revision: 1282
Modified:
branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/CreateTwoClientOnServerCommand.java
branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
Log:
JBMESSAGING-541 - simplifying testcase to the minimal failure point
Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/CreateTwoClientOnServerCommand.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/CreateTwoClientOnServerCommand.java 2006-09-12 22:00:54 UTC (rev 1281)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/CreateTwoClientOnServerCommand.java 2006-09-13 00:14:58 UTC (rev 1282)
@@ -97,44 +97,12 @@
conn2.setClientID("test2");
conn2.start();
- sess1 = conn1.createSession(true, Session.AUTO_ACKNOWLEDGE);
- sess2 = conn2.createSession(true, Session.AUTO_ACKNOWLEDGE);
+ conn1.close();
- MessageProducer prod = sess1.createProducer(topic);
- prod.setDeliveryMode(DeliveryMode.PERSISTENT);
-
- durable = sess1.createDurableSubscriber(topic, "subs1");
- durable2 = sess2.createDurableSubscriber(topic, "subs2");
-
-
- for (int i=0;i<10;i++)
- {
- prod.send(sess1.createTextMessage("k"+i));
- }
- sess1.commit();
-
- for (int i=0;i<2;i++)
- {
- TextMessage tm = (TextMessage)durable.receive(1000);
- sess1.commit();
- System.out.println(tm.getText());
- }
-
- Object read = durable2.receive(1000);
- if (read==null)
- {
- throw new RuntimeException("Couldn't read message from durable2");
- }
-
- System.out.println("Object read now=" + read);
-
String arrays[] = new String[2];
arrays[0] = ((JBossConnection)conn1).getRemotingClientSessionId();
arrays[1] = ((JBossConnection)conn2).getRemotingClientSessionId();
-
- System.out.println("conn1=" + arrays[0]);
- System.out.println("conn2=" + arrays[1]);
-
+
//Return the remoting client session id for the connection
return arrays;
}
Modified: branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java
===================================================================
--- branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2006-09-12 22:00:54 UTC (rev 1281)
+++ branches/Branch_1_0/tests/src/org/jboss/test/messaging/jms/crash/ClientCrashTest.java 2006-09-13 00:14:58 UTC (rev 1282)
@@ -152,7 +152,7 @@
CreateTwoClientOnServerCommand command = new CreateTwoClientOnServerCommand(cf,topic, true);
- String[] remotingSessionId = (String[])remoteServer.executeCommand(command);
+ String remotingSessionId[] = (String[])remoteServer.executeCommand(command);
ConnectionManager cm = localServer.getServerPeer().getConnectionManager();
@@ -160,75 +160,28 @@
log.info("server(1) = " + remotingSessionId[1]);
log.info("we have = " + ((SimpleConnectionManager)cm).getClients().size() + " clients registered on SimpleconnectionManager");
- assertTrue(cm.containsSession(remotingSessionId[0]));
+ //assertTrue(cm.containsSession(remotingSessionId[0]));
assertTrue(cm.containsSession(remotingSessionId[1]));
// Now we should have a client connection from the remote server to the local server
-
remoteServer.exit();
log.info("killed remote server");
// Wait for connection resources to be cleared up
- Thread.sleep(30000);
+ Thread.sleep(25000);
// See if we still have a connection with this id
//Connection state shouldn't have been cleared up by now
assertFalse(cm.containsSession(remotingSessionId[0]));
- assertFalse(cm.containsSession(remotingSessionId[1]));
+ assertFalse(cm.containsSession(remotingSessionId[1]));
log.info("Servers = " + ((SimpleConnectionManager)cm).getClients().size());
assertEquals(0,((SimpleConnectionManager)cm).getClients().size());
-
-
- executeRecoveryAfterCrash(cf, topic);
}
- private void executeRecoveryAfterCrash(ConnectionFactory cf, Topic topic) throws Exception
- {
- Connection conn = null;
- Session s = null;
- MessageConsumer durable = null;
-
- Connection conn2 = cf.createConnection();
- conn2.setClientID("client2");
- conn2.start();
- Session s2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageConsumer durable2 = s2.createDurableSubscriber(topic, "subs2");
-
- conn = cf.createConnection();
- conn.setClientID("client1");
- conn.start();
- s = conn.createSession(true, Session.AUTO_ACKNOWLEDGE);
- durable = s.createDurableSubscriber(topic, "subs1");
-
- int count=0;
- for (int i=2;i<10;i++)
- {
- TextMessage tm = (TextMessage)durable.receive(1000);
- assertNotNull(tm);
- s.commit();
- count++;
- }
-
- assertEquals(count,8);
-
- count=0;
- for (int i=0;i<9;i++)
- {
- count++;
- TextMessage tm = (TextMessage)durable2.receive(1000);
- assertNotNull(tm);
- tm.acknowledge();
- }
-
- assertEquals(count,9);
- }
-
-
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
More information about the jboss-cvs-commits
mailing list