[jboss-remoting-commits] JBoss Remoting SVN: r5380 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Aug 19 22:04:33 EDT 2009


Author: ron.sigal at jboss.com
Date: 2009-08-19 22:04:33 -0400 (Wed, 19 Aug 2009)
New Revision: 5380

Modified:
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketControlConnectionReplacementTestCase.java
Log:
JBREM-1147: Allow more initial writes for jdk 1.4.

Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketControlConnectionReplacementTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketControlConnectionReplacementTestCase.java	2009-08-20 01:43:47 UTC (rev 5379)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/transport/bisocket/BisocketControlConnectionReplacementTestCase.java	2009-08-20 02:04:33 UTC (rev 5380)
@@ -69,6 +69,7 @@
 {
    private static Logger log = Logger.getLogger(BisocketControlConnectionReplacementTestCase.class);
    
+   protected static int INITIAL_WRITES;
    protected static boolean firstTime = true;
    protected static int secondaryServerSocketPort;
    protected static int numberOfCallbacks = 10;
@@ -93,7 +94,18 @@
          String pattern = "[%d{ABSOLUTE}] [%t] %5p (%F:%L) - %m%n";
          PatternLayout layout = new PatternLayout(pattern);
          ConsoleAppender consoleAppender = new ConsoleAppender(layout);
-         Logger.getRootLogger().addAppender(consoleAppender);  
+         Logger.getRootLogger().addAppender(consoleAppender);
+         
+         String jdkVersion = System.getProperty("java.version");
+         log.info("jdk version: " + jdkVersion);
+         if (jdkVersion != null && jdkVersion.indexOf("1.4") >= 0)
+         {
+            INITIAL_WRITES = 5;
+         }
+         else
+         {
+            INITIAL_WRITES = 2;
+         }
       }
    }
 
@@ -179,6 +191,7 @@
       secondaryServerSocketPort = PortUtil.findFreePort(host);
       config.put(Bisocket.SECONDARY_BIND_PORT, Integer.toString(secondaryServerSocketPort));
       config.put(ServerInvoker.SERVER_SOCKET_FACTORY, getServerSocketName());
+      config.put("numberOfCallRetries", "5");
       addExtraServerConfig(config);
       connector = new Connector(serverLocator, config);
       connector.create();
@@ -274,7 +287,7 @@
       public TestServerSocketFactory()
       {
          this.timeout = 5000;
-         this.initialWrites = 2;
+         this.initialWrites = INITIAL_WRITES;
       }      
       public TestServerSocketFactory(int timeout, int initialWrites)
       {
@@ -283,7 +296,7 @@
       }
       public ServerSocket createServerSocket() throws IOException
       {
-         ServerSocket ss = new TestServerSocket(timeout, initialWrites);
+         ServerSocket ss = ServerSocketFactory.getDefault().createServerSocket();
          log.info("returning: " + ss);
          return ss;
       }
@@ -457,6 +470,12 @@
       }
       public void write(byte b[], int off, int len) throws IOException
       {
+         for (int i = 0; i < len; i++)
+         {
+            System.out.print(b[i] + " ");
+         }
+         System.out.println("");
+         
          if (closed)
          {
             log.info("TestOutputStream closed, cannot write");



More information about the jboss-remoting-commits mailing list