JBoss Remoting SVN: r6157 - remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test.
by jboss-remoting-commits@lists.jboss.org
Author: ron.sigal(a)jboss.com
Date: 2010-11-13 11:50:16 -0500 (Sat, 13 Nov 2010)
New Revision: 6157
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/ServiceRegistrationTestCase.java
Log:
JBREM-1256: Uses Random from RemotingRootTestBase and Remoting.getConfiguredEndpoint(OptionMap optionMap).
Modified: remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/ServiceRegistrationTestCase.java
===================================================================
--- remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/ServiceRegistrationTestCase.java 2010-11-13 16:49:27 UTC (rev 6156)
+++ remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/ServiceRegistrationTestCase.java 2010-11-13 16:50:16 UTC (rev 6157)
@@ -78,7 +78,10 @@
public void testRegistrationErrors() throws Exception {
enter();
- Endpoint endpoint = Remoting.getConfiguredEndpoint();
+ String s = "xnio" + String.valueOf(Math.abs(random.nextInt()));
+ log.info(this + " creating xnio: " + s);
+ OptionMap optionMap1 = OptionMap.builder().set(XNIO_ID, s).getMap();
+ Endpoint endpoint = Remoting.getConfiguredEndpoint(optionMap1);
final ServiceBuilder<?, ?> sb = endpoint.serviceBuilder();
sb.setInstanceName("instance");
testIllegalArgumentException(sb, new TestAction() {public void run() throws Exception {sb.register();}});
@@ -93,8 +96,8 @@
testIllegalArgumentException(sb, new TestAction() {public void run() throws Exception {sb.setOptionMap(null);}});
final ServiceBuilder<RequestType, ReplyType> sb2 = (ServiceBuilder<RequestType, ReplyType>) sb;
sb2.setClientListener(new TestClientListener());
- OptionMap optionMap = OptionMap.builder().set(RemotingOptions.METRIC, -1).getMap();
- sb2.setOptionMap(optionMap);
+ OptionMap optionMap2 = OptionMap.builder().set(RemotingOptions.METRIC, -1).getMap();
+ sb2.setOptionMap(optionMap2);
testIllegalArgumentException(sb, new TestAction() {public void run() throws Exception {sb.register();}});
sb.setOptionMap(OptionMap.EMPTY);
sb.setInstanceName(":instance");
@@ -110,7 +113,10 @@
@Test
public void testRegistration() throws Exception {
enter();
- Endpoint endpoint = Remoting.getConfiguredEndpoint();
+ String s = "xnio" + String.valueOf(Math.abs(random.nextInt()));
+ log.info(this + " creating xnio: " + s);
+ OptionMap optionMap = OptionMap.builder().set(XNIO_ID, s).getMap();
+ Endpoint endpoint = Remoting.getConfiguredEndpoint(optionMap);
// Register listener before registering a service.
TestServiceRegistrationListener registrationListener1 = new TestServiceRegistrationListener();
@@ -128,8 +134,8 @@
sb.setServiceType("service");
sb.setRequestType(SuperRequestType.class);
sb.setReplyType(SubReplyType.class);
- OptionMap optionMap = buildOptionMap();
- sb.setOptionMap(optionMap);
+ OptionMap optionMap2 = buildOptionMap();
+ sb.setOptionMap(optionMap2);
sb.setClientListener(testClientListener);
registration = sb.register();
@@ -143,7 +149,7 @@
assertEquals("service", registrationListener1.info.getServiceType());
assertEquals(SuperRequestType.class, registrationListener1.info.getRequestClass());
assertEquals(SubReplyType.class, registrationListener1.info.getReplyClass());
- assertSame(optionMap, registrationListener1.info.getOptionMap());
+ assertSame(optionMap2, registrationListener1.info.getOptionMap());
// Register a listener after registering a service.
TestServiceRegistrationListener registrationListener2 = new TestServiceRegistrationListener();
@@ -159,7 +165,7 @@
assertEquals("service", registrationListener2.info.getServiceType());
assertEquals(SuperRequestType.class, registrationListener2.info.getRequestClass());
assertEquals(SubReplyType.class, registrationListener2.info.getReplyClass());
- assertSame(optionMap, registrationListener2.info.getOptionMap());
+ assertSame(optionMap2, registrationListener2.info.getOptionMap());
log.debug(getName() + " PASSES");