airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1201783 - in /incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg: broker/ matching/XPath/ util/
Date Mon, 14 Nov 2011 16:45:52 GMT
Author: lahiru
Date: Mon Nov 14 16:45:51 2011
New Revision: 1201783

URL: http://svn.apache.org/viewvc?rev=1201783&view=rev
Log:
chanign test cases to pick port dynamically.

Modified:
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
    incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
Mon Nov 14 16:45:51 2011
@@ -58,13 +58,13 @@ public class BrokerWSETest extends TestC
 
         try {
 
-            String brokerEPR = "http://localhost:" + port + "/axis2/services/EventingService";
+            String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
             long value = System.currentTimeMillis();
             String msg = String.format("<msg> current time is : %d </msg>", value);
 
             WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
             wseMsgBrokerClient.init(brokerEPR);
-            int consumerPort = 6767;
+            int consumerPort = TestUtilServer.getAvailablePort();
 
             String[] consumerEPRs = wseMsgBrokerClient.startConsumerService(consumerPort,
this);
 

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
Mon Nov 14 16:45:51 2011
@@ -36,7 +36,6 @@ import org.junit.Test;
 
 public class BrokerWSNTTest extends TestCase implements ConsumerNotificationHandler {
 
-    private static int port = TestUtilServer.TESTING_PORT;
     static Properties configs = new Properties();
 
     public void handleNotification(SOAPEnvelope msgEnvelope) {
@@ -64,7 +63,7 @@ public class BrokerWSNTTest extends Test
 
             int consumerPort = 6767;
 
-            String brokerEPR = "http://localhost:" + port + "/axis2/services/NotificationService";
+            String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/NotificationService";
             wsntMsgBrokerClient.init(brokerEPR);
             String[] consumerEPRs = wsntMsgBrokerClient.startConsumerService(consumerPort,
this);
 

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
Mon Nov 14 16:45:51 2011
@@ -92,7 +92,7 @@ public class TestAddtionalWseXpathAndTop
             String matchingMsg = String.format(msgFormat, value);
             String unmatchingMsg = String.format(msgFormat, value + 1);
 
-            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+            int consumerPort = TestUtilServer.getAvailablePort();
 
             String brokerEpr = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
 

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
Mon Nov 14 16:45:51 2011
@@ -82,7 +82,7 @@ public class TestWseXpathAndTopicSubscri
             String validMsg = String.format(validMsgFormat, value);
             String invalidMsg = String.format(invalidMsgFormat, value);
 
-            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+            int consumerPort = TestUtilServer.getAvailablePort();
 
             String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
             WseMsgBrokerClient msgBrokerClient = new WseMsgBrokerClient();

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
Mon Nov 14 16:45:51 2011
@@ -82,7 +82,7 @@ public class TestWseXpathSubscription ex
             String validMsg = String.format(validMsgFormat, value);
             String invalidMsg = String.format(invalidMsgFormat, value);
 
-            int consumerPort = new Integer(configs.getProperty(ConfigKeys.CONSUMER_PORT));
+            int consumerPort = TestUtilServer.getAvailablePort();
 
             String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
 

Modified: incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java?rev=1201783&r1=1201782&r2=1201783&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
(original)
+++ incubator/airavata/trunk/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
Mon Nov 14 16:45:51 2011
@@ -33,12 +33,16 @@ import org.apache.axis2.engine.MessageRe
 import org.apache.axis2.engine.ServiceLifeCycle;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.nio.channels.ServerSocketChannel;
+
 public class TestUtilServer {
     private static int count = 0;
 
     private static SimpleHTTPServer receiver;
 
-    public static final int TESTING_PORT = 5555;
+    public static int TESTING_PORT = 5555;
 
     public static final String FAILURE_MESSAGE = "Intentional Failure";
 
@@ -59,7 +63,7 @@ public class TestUtilServer {
     public static synchronized void start(String repository, String axis2xml) throws Exception
{
         if (count == 0) {
             ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
-
+            TESTING_PORT = getAvailablePort();
             receiver = new SimpleHTTPServer(er, TESTING_PORT);
 
             try {
@@ -207,4 +211,15 @@ public class TestUtilServer {
     public static ConfigurationContext getConfigurationContext() {
         return receiver.getConfigurationContext();
     }
+
+    public static int getAvailablePort(){
+        ServerSocket serverSocket = null;
+        try {
+             serverSocket = new ServerSocket(0);
+             serverSocket.close();
+        } catch (IOException e) {
+            e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+        }
+        return serverSocket.getLocalPort();
+    }
 }



Mime
View raw message