[hornetq-commits] JBoss hornetq SVN: r9651 - in branches/Branch_2_1: tests/src/org/hornetq/tests/integration/client and 6 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Sep 7 15:15:39 EDT 2010


Author: clebert.suconic at jboss.com
Date: 2010-09-07 15:15:37 -0400 (Tue, 07 Sep 2010)
New Revision: 9651

Modified:
   branches/Branch_2_1/.classpath
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
   branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
Parameterizing UDP parameters for better hudson integration

Modified: branches/Branch_2_1/.classpath
===================================================================
--- branches/Branch_2_1/.classpath	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/.classpath	2010-09-07 19:15:37 UTC (rev 9651)
@@ -8,7 +8,7 @@
 	<classpathentry kind="src" path="tests/config"/>
 	<classpathentry excluding="**/.svn/**/*" kind="src" path="tests/src">
 		<attributes>
-			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="trunk/native/bin"/>
+			<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="trunk-2_1/native/bin"/>
 		</attributes>
 	</classpathentry>
 	<classpathentry kind="src" path="tests/jms-tests/src"/>

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -53,9 +53,9 @@
 {
    private static final Logger log = Logger.getLogger(SessionFactoryTest.class);
 
-   private final String groupAddress = "230.1.2.3";
+   private final String groupAddress = getUDPDiscoveryAddress();
 
-   private final int groupPort = 8765;
+   private final int groupPort = getUDPDiscoveryPort();
 
    private HornetQServer liveService;
 

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -80,8 +80,8 @@
       final String forwardAddress = "forwardAddress";
       final String queueName1 = "queue1";
 
-      final String groupAddress = "230.1.2.3";
-      final int port = 7746;
+      final String groupAddress = getUDPDiscoveryAddress();
+      final int port = getUDPDiscoveryPort();
 
       List<Pair<String, String>> connectorPairs = new ArrayList<Pair<String, String>>();
       connectorPairs.add(new Pair<String, String>(server1tc.getName(), null));

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -28,9 +28,9 @@
 {
    private static final Logger log = Logger.getLogger(SymmetricClusterWithDiscoveryTest.class);
 
-   protected static final String groupAddress = "230.1.2.3";
+   protected static final String groupAddress = getUDPDiscoveryAddress();
 
-   protected static final int groupPort = 6745;
+   protected static final int groupPort = getUDPDiscoveryPort();
 
    protected boolean isNetty()
    {

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -35,9 +35,9 @@
 {
    private static final Logger log = Logger.getLogger(DiscoveryClusterWithBackupFailoverTest.class);
 
-   protected static final String groupAddress = "230.1.2.3";
+   protected static final String groupAddress = getUDPDiscoveryAddress();
 
-   protected static final int groupPort = 6745;
+   protected static final int groupPort = getUDPDiscoveryPort();
 
    @Override
    protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -53,16 +53,16 @@
 {
    private static final Logger log = Logger.getLogger(DiscoveryTest.class);
 
-   private static final String address1 = "230.1.2.3";
+   private static final String address1 = getUDPDiscoveryAddress();
 
-   private static final String address2 = "230.1.2.4";
+   private static final String address2 = getUDPDiscoveryAddress(1);
 
-   private static final String address3 = "230.1.2.5";
+   private static final String address3 = getUDPDiscoveryAddress(2);
 
    public void testSimpleBroadcast() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       final String nodeID = RandomUtil.randomString();
@@ -122,7 +122,7 @@
    public void testSimpleBroadcastSpecificNIC() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       final String nodeID = RandomUtil.randomString();
@@ -222,7 +222,7 @@
    public void testSimpleBroadcastWithStopStartDiscoveryGroup() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       final String nodeID = RandomUtil.randomString();
@@ -304,7 +304,7 @@
    public void testIgnoreTrafficFromOwnNode() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       String nodeID = RandomUtil.randomString();
@@ -357,7 +357,7 @@
    // public void testSimpleBroadcastDifferentAddress() throws Exception
    // {
    // final InetAddress groupAddress = InetAddress.getByName(address1);
-   // final int groupPort = 6745;
+   // final int groupPort = getUDPDiscoveryPort();
    // final int timeout = 500;
    //
    // BroadcastGroup bg = new BroadcastGroupImpl(randomString(), randomString(), null, -1, groupAddress, groupPort);
@@ -394,8 +394,8 @@
 
    public void testSimpleBroadcastDifferentPort() throws Exception
    {
-      final InetAddress groupAddress = InetAddress.getByName("230.1.2.3");
-      final int groupPort = 6745;
+      final InetAddress groupAddress = InetAddress.getByName(getUDPDiscoveryAddress());
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
@@ -417,7 +417,7 @@
 
       bg.addConnectorPair(connectorPair);
 
-      final int port2 = 6746;
+      final int port2 = getUDPDiscoveryPort(1);
 
       DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),
@@ -442,7 +442,7 @@
    public void testSimpleBroadcastDifferentAddressAndPort() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
@@ -465,7 +465,7 @@
       bg.addConnectorPair(connectorPair);
 
       final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
-      final int port2 = 6746;
+      final int port2 = getUDPDiscoveryPort(1);
 
       DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),
@@ -490,13 +490,13 @@
    public void testMultipleGroups() throws Exception
    {
       final InetAddress groupAddress1 = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort1 = 6745;
+      final int groupPort1 = getUDPDiscoveryPort();
 
       final InetAddress groupAddress2 = InetAddress.getByName(DiscoveryTest.address2);
-      final int groupPort2 = 6746;
+      final int groupPort2 = getUDPDiscoveryPort(1);
 
       final InetAddress groupAddress3 = InetAddress.getByName(DiscoveryTest.address3);
-      final int groupPort3 = 6747;
+      final int groupPort3 = getUDPDiscoveryPort(2);
 
       final int timeout = 500;
 
@@ -624,7 +624,7 @@
    public void testBroadcastNullBackup() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       String nodeID = RandomUtil.randomString();
@@ -677,7 +677,7 @@
    public void testDiscoveryListenersCalled() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       String nodeID = RandomUtil.randomString();
@@ -745,7 +745,7 @@
    public void testConnectorsUpdatedMultipleBroadcasters() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       String node1 = RandomUtil.randomString();
@@ -1014,7 +1014,7 @@
    public void testMultipleDiscoveryGroups() throws Exception
    {
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       String nodeID = RandomUtil.randomString();
@@ -1105,7 +1105,7 @@
       notifService.addNotificationListener(notifListener);
 
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
       final int timeout = 500;
 
       DiscoveryGroup dg = new DiscoveryGroupImpl(RandomUtil.randomString(),
@@ -1144,7 +1144,7 @@
       notifService.addNotificationListener(notifListener);
 
       final InetAddress groupAddress = InetAddress.getByName(DiscoveryTest.address1);
-      final int groupPort = 6745;
+      final int groupPort = getUDPDiscoveryPort();
 
       BroadcastGroup bg = new BroadcastGroupImpl(RandomUtil.randomString(),
                                                  RandomUtil.randomString(),

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -51,9 +51,9 @@
 {
    private static final Logger log = Logger.getLogger(HornetQConnectionFactoryTest.class);
 
-   private final String groupAddress = "230.1.2.3";
+   private final String groupAddress = getUDPDiscoveryAddress();
 
-   private final int groupPort = 8765;
+   private final int groupPort = getUDPDiscoveryPort();
 
    private HornetQServer liveService;
 

Modified: branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java	2010-09-07 13:09:45 UTC (rev 9650)
+++ branches/Branch_2_1/tests/src/org/hornetq/tests/util/UnitTestCase.java	2010-09-07 19:15:37 UTC (rev 9651)
@@ -96,8 +96,36 @@
    private final String testDir = System.getProperty("java.io.tmpdir", "/tmp") + "/hornetq-unit-test";
 
    // Static --------------------------------------------------------
+   
+   
+   protected static String getUDPDiscoveryAddress()
+   {
+      return System.getProperty("TEST-UDP-ADDRESS", "230.10.20.1");
+   }
+   
+   protected static String getUDPDiscoveryAddress(int variant)
+   {
+      String value = getUDPDiscoveryAddress();
+      
+      int posPoint = value.lastIndexOf('.');
+      
+      int last = Integer.valueOf( value.substring(posPoint + 1) );
+      
+      return value.substring(0, posPoint + 1) + (last + variant);
+   }
+   
+   public static int getUDPDiscoveryPort()
+   {
+      return Integer.parseInt(System.getProperty("TEST-UDP-PORT", "6750"));
+   }
 
    
+   public static int getUDPDiscoveryPort(final int variant)
+   {
+      return getUDPDiscoveryPort() + 1;
+   }
+
+   
    protected static JournalType getDefaultJournalType()
    {
       if (AsynchronousFileImpl.isLoaded())



More information about the hornetq-commits mailing list