[jboss-cvs] JBossRemoting/src/tests/org/jboss/test/remoting/transport/bisocket ...
Ron Sigal
ron_sigal at yahoo.com
Fri Feb 23 01:59:23 EST 2007
User: rsigal
Date: 07/02/23 01:59:23
Modified: src/tests/org/jboss/test/remoting/transport/bisocket
BisocketTestCase.java
Log:
JBREM-650: Added testConfiguration().
Revision Changes Path
1.8 +55 -1 JBossRemoting/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketTestCase.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BisocketTestCase.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketTestCase.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- BisocketTestCase.java 17 Feb 2007 07:56:16 -0000 1.7
+++ BisocketTestCase.java 23 Feb 2007 06:59:23 -0000 1.8
@@ -64,7 +64,7 @@
/**
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* <p>
* Copyright Nov 25, 2006
* </p>
@@ -81,6 +81,8 @@
private static final String TEST_PING_FREQUENCY_STRING = "1000";
private static final int TEST_PING_FREQUENCY = 1000;
+ private static final String TEST_PING_WINDOW_FACTOR_STRING = "3";
+ private static final int TEST_PING_WINDOW_FACTOR = 3;
private static final String TEST_MAX_POOL_SIZE_STRING = "5";
private static final int TEST_MAX_POOL_SIZE = 5;
@@ -143,6 +145,58 @@
}
+ public void testConfiguration() throws Throwable
+ {
+ log.info("entering " + getName());
+ connector.stop();
+
+ String host = InetAddress.getLocalHost().getHostAddress();
+ int port = PortUtil.findFreePort(host);
+ String locatorURI = getTransport() + "://" + host + ":" + port;
+ InvokerLocator serverLocator = new InvokerLocator(locatorURI);
+ System.out.println("Starting remoting server with locator uri of: " + locatorURI);
+ HashMap serverConfig = new HashMap();
+ serverConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ serverConfig.put(Bisocket.PING_FREQUENCY, TEST_PING_FREQUENCY_STRING);
+ serverConfig.put(Bisocket.PING_WINDOW_FACTOR, TEST_PING_WINDOW_FACTOR_STRING);
+ addExtraServerConfig(serverConfig);
+ connector = new Connector(serverLocator, serverConfig);
+ connector.create();
+ invocationHandler = new SampleInvocationHandler();
+ connector.addInvocationHandler("sample", invocationHandler);
+ connector.start();
+
+ HashMap clientConfig = new HashMap();
+ clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
+ clientConfig.put(Bisocket.PING_FREQUENCY, TEST_PING_FREQUENCY_STRING);
+ addExtraClientConfig(clientConfig);
+ Client client = new Client(serverLocator, clientConfig);
+ client.connect();
+ log.info("client is connected");
+
+ Integer count = new Integer(17);
+ HashMap metadata = new HashMap();
+ metadata.put(COUNTER, count);
+ Integer response = (Integer) client.invoke(INVOCATION_TEST, metadata);
+ assertEquals(17, response.intValue());
+
+ assertTrue(connector.getServerInvoker() instanceof BisocketServerInvoker);
+ BisocketServerInvoker serverInvoker = (BisocketServerInvoker) connector.getServerInvoker();
+ assertEquals(TEST_PING_FREQUENCY, serverInvoker.getPingFrequency());
+ assertEquals(TEST_PING_WINDOW_FACTOR, serverInvoker.getPingWindowFactor());
+ Field field = BisocketServerInvoker.class.getDeclaredField("pingWindow");
+ field.setAccessible(true);
+ int pingWindow = ((Integer) field.get(serverInvoker)).intValue();
+ assertEquals(TEST_PING_WINDOW_FACTOR * TEST_PING_FREQUENCY, pingWindow);
+
+ assertTrue(client.getInvoker() instanceof BisocketClientInvoker);
+ BisocketClientInvoker clientInvoker = (BisocketClientInvoker) client.getInvoker();
+ assertEquals(TEST_PING_FREQUENCY, clientInvoker.getPingFrequency());
+
+ client.disconnect();
+ }
+
+
public void testInvocations() throws Throwable
{
log.info("entering " + getName());
More information about the jboss-cvs-commits
mailing list