[hornetq-commits] JBoss hornetq SVN: r11646 - branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 2 20:36:59 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-11-02 20:36:59 -0400 (Wed, 02 Nov 2011)
New Revision: 11646

Modified:
   branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
Log:
Fix on test for solaris

Modified: branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java
===================================================================
--- branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2011-11-02 22:48:24 UTC (rev 11645)
+++ branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/IncompatibleVersionTest.java	2011-11-03 00:36:59 UTC (rev 11646)
@@ -14,14 +14,10 @@
 package org.hornetq.tests.integration.client;
 
 import static org.hornetq.tests.util.RandomUtil.randomString;
-import org.hornetq.tests.util.SpawnedVMSupport;
 
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
 
 import org.hornetq.api.core.HornetQException;
 import org.hornetq.api.core.TransportConfiguration;
@@ -37,12 +33,12 @@
 import org.hornetq.core.protocol.core.Packet;
 import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionMessage;
 import org.hornetq.core.protocol.core.impl.wireformat.CreateSessionResponseMessage;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
 import org.hornetq.core.remoting.server.impl.RemotingServiceImpl;
 import org.hornetq.core.server.HornetQServer;
 import org.hornetq.core.server.HornetQServers;
 import org.hornetq.core.version.impl.VersionImpl;
 import org.hornetq.tests.util.ServiceTestBase;
+import org.hornetq.tests.util.SpawnedVMSupport;
 import org.hornetq.utils.VersionLoader;
 
 /**
@@ -55,15 +51,19 @@
 public class IncompatibleVersionTest extends ServiceTestBase
 {
    private static final Logger log = Logger.getLogger(IncompatibleVersionTest.class);
+
    // Constants -----------------------------------------------------
 
    // Attributes ----------------------------------------------------
 
    private HornetQServer server;
 
-   private CoreRemotingConnection connection;
    private ServerLocator locator;
 
+   private ClientSessionFactory csf;
+
+   private CoreRemotingConnection connection;
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
@@ -73,12 +73,13 @@
    @Override
    protected void setUp() throws Exception
    {
+      super.setUp();
       server = createServer(false, false);
       server.getConfiguration().setConnectionTTLOverride(500);
       server.start();
 
       locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
-      ClientSessionFactory csf = locator.createSessionFactory();
+      csf = locator.createSessionFactory();
 
       connection = csf.getConnection();
    }
@@ -86,11 +87,12 @@
    @Override
    protected void tearDown() throws Exception
    {
-      connection.destroy();
+      csf.close();
 
       locator.close();
 
       server.stop();
+      super.tearDown();
    }
 
    public void testCompatibleClientVersion() throws Exception
@@ -105,18 +107,18 @@
 
    public void testCompatibleClientVersionWithRealConnection() throws Exception
    {
-      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",1));
-      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",5));
-      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",10));
+      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 1));
+      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 5));
+      assertTrue(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 10));
    }
 
    public void testIncompatibleClientVersionWithRealConnection() throws Exception
    {
-      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",0));
-      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",4));
-      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10",100));
+      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 0));
+      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 4));
+      assertFalse(doTestClientVersionCompatibilityWithRealConnection("1-3,5,7-10", 100));
    }
-   
+
    private void doTestClientVersionCompatibility(boolean compatible) throws Exception
    {
       Channel channel1 = connection.getChannel(1, -1);
@@ -175,61 +177,69 @@
    {
       String propFileName = "compatibility-test-hornetq-version.properties";
       String serverStartedString = "IncompatibleVersionTest---server---started";
-      
+
       Properties prop = new Properties();
       InputStream in = VersionImpl.class.getClassLoader().getResourceAsStream("hornetq-version.properties");
       prop.load(in);
       prop.setProperty("hornetq.version.compatibleVersionList", verList);
       prop.setProperty("hornetq.version.incrementingVersion", Integer.toString(ver));
       prop.store(new FileOutputStream("tests/tmpfiles/" + propFileName), null);
-      
+
       Process server = null;
       boolean result = false;
       try
       {
          server = SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
-                                           new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
+                                           new String[] { "-D" + VersionLoader.VERSION_PROP_FILE_KEY +
+                                                          "=" +
+                                                          propFileName },
                                            "server",
                                            serverStartedString);
          Thread.sleep(2000);
-      
+
          Process client = SpawnedVMSupport.spawnVM("org.hornetq.tests.integration.client.IncompatibleVersionTest",
-                                                   new String[]{"-D" + VersionLoader.VERSION_PROP_FILE_KEY + "=" + propFileName},
+                                                   new String[] { "-D" + VersionLoader.VERSION_PROP_FILE_KEY +
+                                                                  "=" +
+                                                                  propFileName },
                                                    "client");
-      
-         if(client.waitFor() == 0)
+
+         if (client.waitFor() == 0)
          {
             result = true;
          }
       }
       finally
       {
-         if(server != null)
+         if (server != null)
          {
             try
             {
                server.destroy();
             }
-            catch(Throwable t) {/* ignore */}
+            catch (Throwable t)
+            {/* ignore */
+            }
          }
       }
-      
+
       return result;
    }
-   
+
    private static class ServerStarter
    {
       public void perform(String startedString) throws Exception
       {
          Configuration conf = new ConfigurationImpl();
          conf.setSecurityEnabled(false);
-         conf.getAcceptorConfigurations().add(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory"));
+         conf.getAcceptorConfigurations()
+             .add(new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory"));
          HornetQServer server = HornetQServers.newHornetQServer(conf, false);
          server.start();
-         
+
          log.info("### server: " + startedString);
       }
    }
+
    private static class ClientStarter
    {
       public void perform() throws Exception
@@ -243,15 +253,15 @@
          locator.close();
       }
    }
-   
+
    public static void main(String[] args) throws Exception
    {
-      if(args[0].equals("server"))
+      if (args[0].equals("server"))
       {
          ServerStarter ss = new ServerStarter();
          ss.perform(args[1]);
       }
-      else if(args[0].equals("client"))
+      else if (args[0].equals("client"))
       {
          ClientStarter cs = new ClientStarter();
          cs.perform();
@@ -261,7 +271,7 @@
          throw new Exception("args[0] must be \"server\" or \"client\"");
       }
    }
-   
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------



More information about the hornetq-commits mailing list