[jboss-cvs] JBoss Messaging SVN: r2487 - in trunk/tests/src/org/jboss/test/messaging: jms/clustering and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Feb 27 22:58:22 EST 2007
Author: ovidiu.feodorov at jboss.com
Date: 2007-02-27 22:58:22 -0500 (Tue, 27 Feb 2007)
New Revision: 2487
Removed:
trunk/tests/src/org/jboss/test/messaging/graveyard/ClusteredConnectionFactoryGraveyardTest.java
Modified:
trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-900
Deleted: trunk/tests/src/org/jboss/test/messaging/graveyard/ClusteredConnectionFactoryGraveyardTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/graveyard/ClusteredConnectionFactoryGraveyardTest.java 2007-02-28 03:28:49 UTC (rev 2486)
+++ trunk/tests/src/org/jboss/test/messaging/graveyard/ClusteredConnectionFactoryGraveyardTest.java 2007-02-28 03:58:22 UTC (rev 2487)
@@ -1,154 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.test.messaging.graveyard;
-
-import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
-import org.jboss.test.messaging.tools.ServerManagement;
-import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
-import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.ClientAOPStackLoader;
-import javax.jms.Connection;
-import java.lang.reflect.Field;
-
-/**
- * There are tests that should be on ClusteredConnectionFActoryTest that will need to kill server0
- * to validate AOP configs.
- *
- * However it's not allowed to kill these servers under our regular scenario.
- *
- * So.. I'm adding these tests here to the graveyard, so we could run them manually
- * until we figure out how to resurrect them.. what means.. how to avoid/allow killing server0
- *
- * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
- * @version <tt>$Revision$</tt>
- * $Id$
- */
-public class ClusteredConnectionFactoryGraveyardTest extends ClusteringTestBase
-{
-
- // Constants ------------------------------------------------------------------------------------
-
- // Attributes -----------------------------------------------------------------------------------
-
- // Static ---------------------------------------------------------------------------------------
-
- // Constructors ---------------------------------------------------------------------------------
-
- public ClusteredConnectionFactoryGraveyardTest(String name)
- {
- super(name);
- }
-
- // Public ---------------------------------------------------------------------------------------
-
- public void testGetAOPBroken() throws Exception
- {
- Connection conn = null;
-
- try
- {
-
- resetAOP();
-
- ServerManagement.killAndWait(2);
- ServerManagement.killAndWait(1);
- ServerManagement.killAndWait(0);
-
- try
- {
- conn = cf.createConnection();
- fail ("This should try an exception as every server is down");
- }
- catch (RuntimeException e)
- {
- log.error(e.toString(), e);
- }
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
- public void testGetAOPBounce() throws Exception
- {
- Connection conn = null;
-
- try
- {
-
- resetAOP();
-
- ServerManagement.killAndWait(0);
- ServerManagement.poisonTheServer(1, PoisonInterceptor.CF_GET_CLIENT_AOP_STACK);
-
- conn = cf.createConnection();
- assertEquals(2, ((JBossConnection)conn).getServerID());
- }
- finally
- {
- if (conn != null)
- {
- conn.close();
- }
- }
- }
-
-
-
- // Package protected ----------------------------------------------------------------------------
-
- // Protected ------------------------------------------------------------------------------------
-
- protected void setUp() throws Exception
- {
- nodeCount = 3;
- super.setUp();
- }
-
- protected void tearDown() throws Exception
- {
- super.tearDown();
- }
-
- private void resetAOP()
- throws NoSuchFieldException, IllegalAccessException
- {
-
- // Using reflection to cleanup AOP status and force to load AOP again
- Field field = ClientAOPStackLoader.class.getDeclaredField("instance");
- field.setAccessible(true);
- log.info("Reseting AOP");
- field.set(null,null);
- }
-
-
-
- // Private --------------------------------------------------------------------------------------
-
- // Inner classes --------------------------------------------------------------------------------
-
-}
Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java 2007-02-28 03:28:49 UTC (rev 2486)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java 2007-02-28 03:58:22 UTC (rev 2487)
@@ -94,6 +94,43 @@
}
}
+ // TODO: Commented out pending resolution.
+ // See http://jira.jboss.org/jira/browse/JBMESSAGING-900
+// public void testGetAOPBounce() throws Exception
+// {
+// Connection conn = null;
+// Server poisonedServer = null;
+//
+// try
+// {
+//
+// resetAOP();
+//
+// ServerManagement.killAndWait(0);
+// poisonedServer =
+// ServerManagement.poisonTheServer(1, PoisonInterceptor.CF_GET_CLIENT_AOP_STACK);
+//
+// conn = cf.createConnection();
+// assertEquals(2, ((JBossConnection)conn).getServerID());
+// }
+// finally
+// {
+// if (conn != null)
+// {
+// conn.close();
+// }
+//
+// // need to re-start 0, it's the RMI server the other servers use
+// ServerManagement.start(0, "all", true);
+//
+// // Kill the poisoned server
+// if (poisonedServer != null)
+// {
+// poisonedServer.kill();
+// }
+// }
+// }
+
public void testCreateConnectionOnBrokenServer() throws Exception
{
Connection conn = null;
Modified: trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-02-28 03:28:49 UTC (rev 2486)
+++ trunk/tests/src/org/jboss/test/messaging/tools/ServerManagement.java 2007-02-28 03:58:22 UTC (rev 2487)
@@ -639,18 +639,24 @@
* Install dynamically an AOP advice that will do "bad things" on the server, simulating all
* sorts of failures. I expect the name of this method to be refactored as we learn more about
* this type of testing.
+ * @return a reference to the server that has been poisoned. Use this reference to kill the
+ * server after use.
*/
- public static void poisonTheServer(int serverIndex, int type) throws Exception
+ public static Server poisonTheServer(int serverIndex, int type) throws Exception
{
insureStarted(serverIndex);
- servers[serverIndex].getServer().poisonTheServer(type);
+ Server poisoned = servers[serverIndex].getServer();
+
// TODO (ovidiu): this is prone to race conditions, as somebody from the client may try to
// use (and create) an new server that is being poisoned, while the poisoned server is
// still alive.
+
servers[serverIndex] = null;
+ poisoned.poisonTheServer(type);
+
+ return poisoned;
}
-
public static Set query(ObjectName pattern) throws Exception
{
insureStarted();
More information about the jboss-cvs-commits
mailing list