Author: ron.sigal(a)jboss.com
Date: 2010-11-13 11:35:15 -0500 (Sat, 13 Nov 2010)
New Revision: 6148
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointConfigurationTestCase.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/EndpointConfigurationTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointConfigurationTestCase.java 2010-11-13
16:34:06 UTC (rev 6147)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointConfigurationTestCase.java 2010-11-13
16:35:15 UTC (rev 6148)
@@ -28,6 +28,7 @@
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.URI;
+import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executor;
@@ -77,14 +78,16 @@
private static final Logger log =
Logger.getLogger(EndpointConfigurationTestCase.class);
+ @SuppressWarnings("unchecked")
@BeforeMethod
public void setUp() {
System.clearProperty("remoting.property.file");
try {
- Field configuredEndpoint =
Remoting.class.getDeclaredField("configuredEndpoint");
- configuredEndpoint.setAccessible(true);
- configuredEndpoint.set(null, null);
- System.out.println(configuredEndpoint.get(null));
+ Field field = Remoting.class.getDeclaredField("configuredEndpoints");
+ field.setAccessible(true);
+ Map<Map<Object, Object>, Endpoint> configuredEndpoints =
(Map<Map<Object, Object>, Endpoint>) field.get(null);
+ configuredEndpoints.clear();
+ System.out.println(configuredEndpoints.get(null));
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
@@ -176,7 +179,10 @@
enter();
try {
- 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);
assertSame(MockConnectionProviderFactory.providerInterface,
endpoint.getConnectionProviderInterface("mockTransport",
MockConnectionProviderFactory.MockProviderInterface.class));
ConnectionProviderContext context = MockConnectionProviderFactory.context;
assertTrue(context.getProtocolServiceProvider(ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY,
"mockClassExternalizerFactory_sd") instanceof MockClassExternalizerFactory);
@@ -200,8 +206,11 @@
try {
System.setProperty("remoting.property.file",
"protocols.test.remoting.properties");
+ String s = "xnio" + String.valueOf(Math.abs(random.nextInt()));
+ log.info(this + " creating xnio: " + s);
+ OptionMap optionMap = OptionMap.builder().set(XNIO_ID, s).getMap();
@SuppressWarnings("unused")
- Endpoint endpoint = Remoting.getConfiguredEndpoint();
+ Endpoint endpoint = Remoting.getConfiguredEndpoint(optionMap);
ConnectionProviderContext context = MockConnectionProviderFactory.context;
assertTrue(context.getProtocolServiceProvider(ProtocolServiceType.CLASS_EXTERNALIZER_FACTORY,
"mockClassExternalizerFactory_pf") instanceof MockClassExternalizerFactory);
assertTrue(context.getProtocolServiceProvider(ProtocolServiceType.CLASS_RESOLVER,
"mockClassResolver_pf") instanceof MockClassResolver);
Show replies by date