You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2004/12/23 10:59:33 UTC
svn commit: r123180 - in webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis: clientapi engine
Author: hemapani
Date: Thu Dec 23 01:59:32 2004
New Revision: 123180
URL: http://svn.apache.org/viewcvs?view=rev&rev=123180
Log:
fix the test failures due to socket bind to same port
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceive.java Thu Dec 23 01:59:32 2004
@@ -83,7 +83,7 @@
}
protected void tearDown() throws Exception {
- sas.stop();
+ EngineUtils.stopServer();
}
public void testSendReceive() throws Exception {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/TestSendReceiveAsync.java Thu Dec 23 01:59:32 2004
@@ -93,7 +93,7 @@
while(!finish){
Thread.sleep(500);
}
- sas.stop();
+ EngineUtils.stopServer();
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/CallUnregisterdServiceTest.java Thu Dec 23 01:59:32 2004
@@ -69,7 +69,7 @@
}
protected void tearDown() throws Exception {
- sas.stop();
+ EngineUtils.stopServer();
Thread.sleep(1000);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoRawXMLTest.java Thu Dec 23 01:59:32 2004
@@ -72,7 +72,7 @@
}
protected void tearDown() throws Exception {
- sas.stop();
+ EngineUtils.stopServer();
Thread.sleep(1000);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoTest.java Thu Dec 23 01:59:32 2004
@@ -71,7 +71,7 @@
}
protected void tearDown() throws Exception {
- sas.stop();
+ EngineUtils.stopServer();
Thread.sleep(1000);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java Thu Dec 23 01:59:32 2004
@@ -37,7 +37,6 @@
public EngineAndDeploymentTest(String testName) throws Exception{
super(testName);
er = EngineRegistryFactory.createEngineRegistry("target/test-resources/deployment");
- sas = EngineUtils.startServer(er);
}
@@ -60,4 +59,12 @@
OMElement omele = call.sendReceive(envelope);
assertNotNull(omele);
}
+ protected void setUp() throws Exception {
+ sas = EngineUtils.startServer(er);
+ }
+
+ protected void tearDown() throws Exception {
+ EngineUtils.stopServer();
+ }
+
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineUtils.java Thu Dec 23 01:59:32 2004
@@ -37,6 +37,7 @@
public static final int TESTING_PORT = 7777;
public static final String FAILURE_MESSAGE = "Intentional Faliure";
private static int index = 0;
+ private static SimpleHTTPReceiver sas;
public static void addHandlers(Flow flow,Phase phase) throws AxisFault{
if(flow != null){
@@ -47,16 +48,29 @@
}
}
- public static SimpleHTTPReceiver startServer(EngineRegistry engineRegistry) throws IOException{
+ public static synchronized SimpleHTTPReceiver startServer(EngineRegistry engineRegistry) throws IOException{
AxisEngine engine = new AxisEngine(engineRegistry);
ServerSocket serverSoc = new ServerSocket(TESTING_PORT);
- SimpleHTTPReceiver sas = new SimpleHTTPReceiver(engine);
+ if(sas == null){
+ sas = new SimpleHTTPReceiver(engine);
+ }else{
+ sas.stop();
+ sas = new SimpleHTTPReceiver(engine);
+ }
sas.setServerSocket(serverSoc);
Thread thisThread = new Thread(sas);
thisThread.setDaemon(true);
thisThread.start();
return sas;
}
+
+ public static synchronized void stopServer() throws IOException{
+ if(sas != null){
+ sas.stop();
+ sas = null;
+ }
+ }
+
public static void addHandler(Flow flow, Handler handler){
HandlerMetaData hmd = new HandlerMetaData();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/HandlerFaliureTest.java Thu Dec 23 01:59:32 2004
@@ -91,6 +91,8 @@
engineRegistry.addService(service);
sas = EngineUtils.startServer(engineRegistry);
callTheService();
+ EngineUtils.stopServer();
+ Thread.sleep(1000);
}
public void testFailureAtServerResponseFlow() throws Exception{
@@ -126,17 +128,17 @@
engineRegistry.addService(service);
sas = EngineUtils.startServer(engineRegistry);
callTheService();
+ EngineUtils.stopServer();
+ Thread.sleep(1000);
}
protected void tearDown() throws Exception {
- sas.stop();
- Thread.sleep(1000);
}
- public void callTheService() throws Exception{
+ private void callTheService() throws Exception{
try{
OMFactory fac = OMFactory.newInstance();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/MessageWithServerTest.java Thu Dec 23 01:59:32 2004
@@ -53,7 +53,7 @@
}
protected void tearDown() throws Exception {
- sas.stop();
+ EngineUtils.stopServer();
Thread.sleep(1000);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java?view=diff&rev=123180&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java&r1=123179&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java&r2=123180
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/SimpleAxisServerTest.java Thu Dec 23 01:59:32 2004
@@ -70,28 +70,13 @@
public void testEchoXMLSync() throws Exception{
- ServerSocket serverSoc = new ServerSocket(testingPort);
- sas = new SimpleHTTPReceiver(engine);
- sas.setServerSocket(serverSoc);
- thisThread = new Thread(sas);
- thisThread.setDaemon(true);
- thisThread.start();
- sas.stop();
+ EngineUtils.startServer(engineRegistry);
+ EngineUtils.stopServer();
Thread.sleep(1000);
- serverSoc = new ServerSocket(testingPort);
- sas = new SimpleHTTPReceiver(engine);
- sas.setServerSocket(serverSoc);
- thisThread = new Thread(sas);
- thisThread.setDaemon(true);
- thisThread.start();
- sas.stop();
+ EngineUtils.startServer(engineRegistry);
+ EngineUtils.stopServer();
Thread.sleep(1000);
- serverSoc = new ServerSocket(testingPort);
- sas = new SimpleHTTPReceiver(engine);
- sas.setServerSocket(serverSoc);
- thisThread = new Thread(sas);
- thisThread.setDaemon(true);
- thisThread.start();
- sas.stop();
+ EngineUtils.startServer(engineRegistry);
+ EngineUtils.stopServer();
}
}