Author: ron.sigal(a)jboss.com
Date: 2010-11-13 11:41:37 -0500 (Sat, 13 Nov 2010)
New Revision: 6150
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalCallbackTestCase.java
Log:
JBREM-1256: (1) Uses Random from RemotingRootTestBase; (2) made some protected members
public.
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalCallbackTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalCallbackTestCase.java 2010-11-13
16:39:49 UTC (rev 6149)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/LocalCallbackTestCase.java 2010-11-13
16:41:37 UTC (rev 6150)
@@ -53,15 +53,13 @@
@Test(suiteName = "LocalCallback")
public class LocalCallbackTestCase extends RemotingLocalTestBase {
- protected static final String SERVICE_TYPE = "testservice";
- protected static final String INSTANCE_NAME= "testinstance";
- protected static final String CALLBACK_REQUEST = "callbackRequest";
- protected static final String CALLBACK = "callback";
- protected static final String OK = "ok";
+ public static final String SERVICE_TYPE = "testservice";
+ public static final String INSTANCE_NAME= "testinstance";
+ public static final String CALLBACK_REQUEST = "callbackRequest";
+ public static final String CALLBACK = "callback";
+ public static final String OK = "ok";
private static final Logger log = Logger.getLogger(LocalCallbackTestCase.class);
-
- private static int counter;
@BeforeMethod
public void setUp() {
@@ -79,7 +77,7 @@
Client<Object, Object> client = null;
try {
- int id = counter++;
+ int id = Math.abs(random.nextInt());
// Set up service.
TestRequestListener testRequestListener = new TestRequestListener();
@@ -119,7 +117,7 @@
Client<Object, Object> client = null;
try {
- int id = counter++;
+ int id = Math.abs(random.nextInt());
// Set up service.
TestRequestListener testRequestListener = new TestRequestListener();
@@ -157,14 +155,14 @@
}
}
- protected Connection setupConnection(ServerPackage sp) throws IOException,
URISyntaxException {
+ public Connection setupConnection(ServerPackage sp) throws IOException,
URISyntaxException {
Endpoint endpoint = sp.endpoint;
URI uri = new URI(getRemotingScheme() + "://localhost");
Connection connection = getFutureResult(endpoint.connect(uri,
getConnectionOptionMap(), "user", null, "password".toCharArray()),
"unable to connect to " + uri);
return connection;
}
- protected Client<Object, Object> setupClient(Connection connection, String
serviceType, String instanceName) throws IOException, URISyntaxException {
+ public Client<Object, Object> setupClient(Connection connection, String
serviceType, String instanceName) throws IOException, URISyntaxException {
Client<Object, Object> client =
getFutureResult(connection.openClient(serviceType, instanceName, Object.class,
Object.class), "unable to open client to " + serviceType + ":" +
instanceName);
return client;
}
@@ -176,7 +174,7 @@
public boolean sentCallback;
public TestRequestListener() {
- new Exception(this + ": TestRequestListener()").printStackTrace();
+// new Exception(this + ": TestRequestListener()").printStackTrace();
}
@SuppressWarnings("unchecked")
@@ -201,6 +199,8 @@
sentCallback = OK.equals(callbackClient.invoke(CALLBACK));
requestContext.sendReply(OK);
log.info(this + " sent callback using ClientConnector: " +
sentCallback);
+ } else if (request instanceof InvocationTestObject) {
+ requestContext.sendReply(request);
} else {
throw new RuntimeException("unexpected request: " + request);
}