[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/byvalue ...
Tom Elrod
tom.elrod at jboss.com
Mon Jan 22 11:37:44 EST 2007
User: telrod
Date: 07/01/22 11:37:44
Modified: src/tests/org/jboss/test/remoting/byvalue Tag: remoting_2_x
ByValueInvocationTestCase.java
Log:
JBREM-683 - fixed broken test.
Revision Changes Path
No revision
No revision
1.5.4.1 +66 -45 JBossRemoting/src/tests/org/jboss/test/remoting/byvalue/ByValueInvocationTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ByValueInvocationTestCase.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/byvalue/ByValueInvocationTestCase.java,v
retrieving revision 1.5
retrieving revision 1.5.4.1
diff -u -b -r1.5 -r1.5.4.1
--- ByValueInvocationTestCase.java 7 Jul 2006 20:50:13 -0000 1.5
+++ ByValueInvocationTestCase.java 22 Jan 2007 16:37:44 -0000 1.5.4.1
@@ -38,14 +38,11 @@
*/
public class ByValueInvocationTestCase extends TestCase
{
- public ByValueInvocationTestCase(String name)
- {
- super(name);
- }
+ private Connector connector = null;
- public static void setupConfiguration(InvokerLocator locator, ServerInvocationHandler invocationHandler) throws Exception
+ public void setupConfiguration(InvokerLocator locator, ServerInvocationHandler invocationHandler) throws Exception
{
- Connector connector = new Connector();
+ connector = new Connector();
connector.setInvokerLocator(locator.getLocatorURI());
connector.start();
connector.addInvocationHandler("mock", invocationHandler);
@@ -57,8 +54,10 @@
InvokerLocator.BYVALUE + "=" + Boolean.TRUE.toString());
ServerInvocationHandler invocationHandler = new MockServerInvocationHandler();
+ try
+ {
// set up
- ByValueInvocationTestCase.setupConfiguration(locator, invocationHandler);
+ setupConfiguration(locator, invocationHandler);
Thread.sleep(3000);
@@ -72,7 +71,7 @@
null);
System.out.println("Invocation response: " + response);
- if(response instanceof Boolean)
+ if (response instanceof Boolean)
{
assertTrue("Result of testByValue is false.", ((Boolean) response).booleanValue());
}
@@ -81,18 +80,30 @@
assertTrue("Result of testByValue was not even of type Boolean.", false);
}
remotingClient.disconnect();
+ }
+ finally
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ connector.destroy();
+ connector = null;
+ }
+ }
}
public void testJBossInvocation() throws Throwable
{
- InvokerLocator locator = new InvokerLocator("rmi://localhost:5400/?" +
+ InvokerLocator locator = new InvokerLocator("rmi://localhost:5401/?" +
InvokerLocator.BYVALUE + "=" + Boolean.TRUE.toString() + "&" +
InvokerLocator.SERIALIZATIONTYPE + "=" + "jboss");
ServerInvocationHandler invocationHandler = new MockServerInvocationHandler();
+ try
+ {
// set up
- ByValueInvocationTestCase.setupConfiguration(locator, invocationHandler);
+ setupConfiguration(locator, invocationHandler);
Thread.sleep(3000);
@@ -106,7 +117,7 @@
null);
System.out.println("Invocation response: " + response);
- if(response instanceof Boolean)
+ if (response instanceof Boolean)
{
assertTrue("Result of testByValue is false.", ((Boolean) response).booleanValue());
}
@@ -115,6 +126,16 @@
assertTrue("Result of testByValue was not even of type Boolean.", false);
}
remotingClient.disconnect();
+ }
+ finally
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ connector.destroy();
+ connector = null;
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list