[jboss-cvs] JBossAS SVN: r71729 - in trunk/testsuite/src/main/org/jboss/test/cluster: invokerha and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Apr 4 15:09:22 EDT 2008
Author: galder.zamarreno at jboss.com
Date: 2008-04-04 15:09:21 -0400 (Fri, 04 Apr 2008)
New Revision: 71729
Modified:
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/UnifiedInvokerHaUnitTestCase.java
trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
Log:
[JBAS-5364] Added test that slow downs client.connect() in Remoting. Without synchronising getClient in UnifiedInvokerHAProxy, this new test would fail.
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/UnifiedInvokerHaUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/UnifiedInvokerHaUnitTestCase.java 2008-04-04 18:31:34 UTC (rev 71728)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/UnifiedInvokerHaUnitTestCase.java 2008-04-04 19:09:21 UTC (rev 71729)
@@ -33,6 +33,7 @@
import org.jboss.remoting.InvokerLocator;
import org.jboss.test.cluster.invokerha.AbstractInvokerHa;
import org.jboss.test.cluster.invokerha.InvokerHaInfrastructure;
+import org.jboss.test.cluster.invokerha.UnifiedInvokerHaMockUtils;
import org.jboss.test.cluster.invokerha.InvokerHaInfrastructure.InvokerHaFactory;
import org.jboss.test.cluster.invokerha.InvokerHaInfrastructure.TraceRoundRobin;
import org.jboss.test.cluster.invokerha.UnifiedInvokerHaMockUtils.MockInvokerLocator;
@@ -63,6 +64,13 @@
public void testProxyThreadSafety() throws Throwable
{
performConcurrentCalls(50, 50, TraceRoundRobin.class);
+ }
+
+ public void testProxyThreadSafetyNullPointerException() throws Throwable
+ {
+ UnifiedInvokerHaMockUtils.SLOW_DOWN_CLIENT_CONNECT = true;
+ performConcurrentCalls(5, 5, TraceRoundRobin.class);
+ UnifiedInvokerHaMockUtils.SLOW_DOWN_CLIENT_CONNECT = false;
}
/** Classes **/
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java 2008-04-04 18:31:34 UTC (rev 71728)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/invokerha/UnifiedInvokerHaMockUtils.java 2008-04-04 19:09:21 UTC (rev 71729)
@@ -54,6 +54,8 @@
*/
public class UnifiedInvokerHaMockUtils
{
+ public static boolean SLOW_DOWN_CLIENT_CONNECT = false;
+
public static class MockUnifiedInvokerHA extends UnifiedInvokerHA
{
private String name;
@@ -180,16 +182,25 @@
public static class MockClient extends Client
{
+ /* temporary invoker locator to be able to mimic what remoting does
+ * setting the invoker in connect() */
+ private InvokerLocator locatorTmp;
+
public MockClient(InvokerLocator locator) throws Exception
{
super(locator);
- setInvoker(new MockClientInvoker(locator));
+ locatorTmp = locator;
}
@Override
public void connect() throws Exception
{
- /* do nothing on connect for unit tests */
+ if (SLOW_DOWN_CLIENT_CONNECT)
+ {
+ Thread.sleep(50);
+ }
+
+ setInvoker(new MockClientInvoker(locatorTmp));
}
@Override
More information about the jboss-cvs-commits
mailing list