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 2005/02/09 04:34:14 UTC
svn commit: r152981 - in webservices/axis/trunk/java/dev/scratch/prototype2:
./ src/java/org/apache/axis/engine/
src/java/org/apache/axis/impl/description/
src/java/org/apache/axis/impl/llom/
src/java/org/apache/axis/impl/llom/exception/
src/java/org/apache/axis/impl/transport/http/ src/java/org/apache/axis/om/
src/test/org/apache/axis/clientapi/ src/test/org/apache/axis/deployment/
src/test/org/apache/axis/description/ src/test/org/apache/axis/engine/
src/test/org/apache/axis/integration/ src/test/org/apache/axis/om/
src/test/org/apache/axis/om/builder/dummy/
Author: hemapani
Date: Tue Feb 8 19:34:11 2005
New Revision: 152981
URL: http://svn.apache.org/viewcvs?view=rev&rev=152981
Log:
shaping the test cases
Removed:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/exception/XMLStreamException.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/clientapi/AsyncResultTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/description/EchoService.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EchoXML.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/description/AxisService.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/BuildERWithDeploymentTest.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/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/integration/EchoTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/UtilServer.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/SOAPFaultTest.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/project.xml?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/project.xml (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/project.xml Tue Feb 8 19:34:11 2005
@@ -140,7 +140,7 @@
<excludes>
<exclude>**/*Abstract*.java</exclude>
<exclude>**/*Util*.java</exclude>
- <exclude>**/*EchoTest*.java</exclude>
+ <!-- <exclude>**/*EchoTest*.java</exclude> -->
</excludes>
<includes>
<include>**/*Test.java</include>
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/AxisEngine.java Tue Feb 8 19:34:11 2005
@@ -135,7 +135,6 @@
//startet rolling
chain.invoke(context);
} catch (AxisFault error) {
- //error.printStackTrace();
handleFault(context, error);
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/description/AxisService.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/description/AxisService.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/description/AxisService.java Tue Feb 8 19:34:11 2005
@@ -15,18 +15,24 @@
*/
package org.apache.axis.impl.description;
-import org.apache.axis.description.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+
+import javax.swing.text.Style;
+import javax.xml.namespace.QName;
+
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.description.DescriptionConstants;
+import org.apache.axis.description.Flow;
+import org.apache.axis.description.FlowInclude;
+import org.apache.axis.description.Parameter;
+import org.apache.axis.description.ParameterInclude;
+import org.apache.axis.description.PhasesInclude;
import org.apache.axis.engine.AxisFault;
-import org.apache.axis.engine.ExecutionChain;
import org.apache.axis.engine.Provider;
import org.apache.wsdl.WSDLService;
import org.apache.wsdl.impl.WSDLServiceImpl;
-
-import javax.swing.text.Style;
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
public class AxisService extends WSDLServiceImpl implements WSDLService,ParameterInclude,FlowInclude,PhasesInclude , DescriptionConstants{
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/OMNodeImpl.java Tue Feb 8 19:34:11 2005
@@ -5,7 +5,6 @@
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNode;
/**
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPBodyImpl.java Tue Feb 8 19:34:11 2005
@@ -5,9 +5,7 @@
import javax.xml.namespace.QName;
import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
-import org.apache.axis.om.OMNamespace;
import org.apache.axis.om.OMXMLParserWrapper;
import org.apache.axis.om.SOAPBody;
import org.apache.axis.om.SOAPEnvelope;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPFaultImpl.java Tue Feb 8 19:34:11 2005
@@ -3,15 +3,21 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Iterator;
-import java.util.Locale;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
-import org.apache.axis.engine.AxisFault;
-import org.apache.axis.om.*;
+import org.apache.axis.om.OMConstants;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMException;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.OMNode;
+import org.apache.axis.om.OMText;
+import org.apache.axis.om.OMXMLParserWrapper;
+import org.apache.axis.om.SOAPFault;
/**
* Copyright 2001-2004 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/llom/SOAPHeaderImpl.java Tue Feb 8 19:34:11 2005
@@ -6,7 +6,6 @@
import org.apache.axis.impl.llom.traverse.OMChildrenWithSpecificAttributeIterator;
import org.apache.axis.om.OMConstants;
-import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMException;
import org.apache.axis.om.OMNamespace;
import org.apache.axis.om.OMXMLParserWrapper;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java Tue Feb 8 19:34:11 2005
@@ -142,7 +142,7 @@
DeploymentEngine deploymentEngine = new DeploymentEngine(dir);
EngineRegistry er = deploymentEngine.start();
try {
- Thread.sleep(9000);
+ Thread.sleep(2000);
} catch (InterruptedException e1) {
throw new AxisFault("Thread interuptted",e1);
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/om/SOAPFault.java Tue Feb 8 19:34:11 2005
@@ -15,8 +15,6 @@
package org.apache.axis.om;
-import java.util.Locale;
-
import javax.xml.namespace.QName;
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/deployment/BuildERWithDeploymentTest.java Tue Feb 8 19:34:11 2005
@@ -25,8 +25,7 @@
import org.apache.axis.impl.description.AxisService;
import org.apache.axis.impl.providers.RawXMLProvider;
-
-public class BuildERWithDeploymentTest extends AbstractTestCase{
+public class BuildERWithDeploymentTest extends AbstractTestCase {
/**
* @param testName
*/
@@ -34,37 +33,34 @@
super(testName);
}
- public void testDeployment(){
- try{
- String filename = "./target/test-resources/deployment" ;
- DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
- EngineRegistry er = deploymentEngine.start();
- assertNotNull(er);
- assertNotNull(er.getGlobal());
+ public void testDeployment() throws Exception {
+ String filename = "./target/test-resources/deployment";
+ DeploymentEngine deploymentEngine = new DeploymentEngine(filename);
+ EngineRegistry er = deploymentEngine.start();
+ assertNotNull(er);
+ assertNotNull(er.getGlobal());
+
+ AxisService service = er.getService(new QName("echo"));
+ assertNotNull(service);
+ Provider provider = service.getProvider();
+ assertNotNull(provider);
+ assertTrue(provider instanceof RawXMLProvider);
+ ClassLoader cl = service.getClassLoader();
+ assertNotNull(cl);
+ Class.forName("org.apache.axis.engine.Echo", true, cl);
+ assertNotNull(service.getName());
+ assertEquals(service.getContextPath(), "axis/service/echo");
- AxisService service = er.getService(new QName("echo"));
- assertNotNull(service);
- Provider provider = service.getProvider();
- assertNotNull(provider);
- assertTrue(provider instanceof RawXMLProvider);
- ClassLoader cl = service.getClassLoader();
- assertNotNull(cl);
- Class.forName("org.apache.axis.engine.Echo",true,cl);
- assertNotNull(service.getName());
- assertEquals(service.getContextPath(),"axis/service/echo");
+ Flow flow = service.getFaultFlow();
+ assertTrue(flow == null || flow.getHandlerCount() == 0);
+ flow = service.getInFlow();
+ assertTrue(flow == null || flow.getHandlerCount() == 0);
+ flow = service.getOutFlow();
+ assertTrue(flow == null || flow.getHandlerCount() == 0);
+ assertNull(service.getParameter("hello"));
- Flow flow = service.getFaultFlow();
- assertTrue(flow == null || flow.getHandlerCount() == 0);
- flow = service.getInFlow();
- assertTrue(flow == null || flow.getHandlerCount() == 0);
- flow = service.getOutFlow();
- assertTrue(flow == null || flow.getHandlerCount() == 0);
- assertNull(service.getParameter("hello"));
+ AxisOperation op = service.getOperation(new QName("echo"));
+ assertNotNull(op);
- AxisOperation op = service.getOperation(new QName("echo"));
- assertNotNull(op);
- }catch (Exception e){
- e.printStackTrace();
- }
}
}
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&r1=152980&r2=152981
==============================================================================
--- 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 Tue Feb 8 19:34:11 2005
@@ -23,11 +23,8 @@
import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.clientapi.Call;
import org.apache.axis.context.MessageContext;
-import org.apache.axis.description.AxisOperation;
-import org.apache.axis.impl.description.AxisService;
-import org.apache.axis.impl.description.SimpleAxisOperationImpl;
-import org.apache.axis.impl.providers.RawXMLProvider;
import org.apache.axis.impl.transport.http.SimpleHTTPReceiver;
+import org.apache.axis.integration.UtilServer;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
@@ -56,23 +53,11 @@
}
protected void setUp() throws Exception {
- engineRegistry = EngineUtils.createMockRegistry(serviceName,operationName,transportName);
- AxisService service = new AxisService(serviceName);
- service.setClassLoader(Thread.currentThread().getContextClassLoader());
- service.setServiceClass(Echo.class);
- service.setProvider(new RawXMLProvider());
- AxisOperation operation = new SimpleAxisOperationImpl(operationName);
-
- service.addOperation(operation);
- EngineUtils.createExecutionChains(service);
- engineRegistry.addService(service);
-
- sas = EngineUtils.startServer(engineRegistry);
+ UtilServer.start();
}
protected void tearDown() throws Exception {
- EngineUtils.stopServer();
- Thread.sleep(1000);
+ UtilServer.stop();
}
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&r1=152980&r2=152981
==============================================================================
--- 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 Tue Feb 8 19:34:11 2005
@@ -31,6 +31,7 @@
import org.apache.axis.impl.description.SimpleAxisOperationImpl;
import org.apache.axis.impl.providers.RawXMLProvider;
import org.apache.axis.impl.transport.http.SimpleHTTPReceiver;
+import org.apache.axis.integration.UtilServer;
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
@@ -61,8 +62,7 @@
}
protected void setUp() throws Exception {
- engineRegistry = EngineUtils.createMockRegistry(serviceName,operationName,transportName);
-
+ UtilServer.start();
AxisService service = new AxisService(serviceName);
service.setClassLoader(Thread.currentThread().getContextClassLoader());
service.setServiceClass(Echo.class);
@@ -70,25 +70,17 @@
AxisOperation operation = new SimpleAxisOperationImpl(operationName);
service.addOperation(operation);
-
- EngineUtils.createExecutionChains(service);
- engineRegistry.addService(service);
-
- sas = EngineUtils.startServer(engineRegistry);
- finish=false;
+ UtilServer.deployService(service);
}
protected void tearDown() throws Exception {
- while(!finish){
- Thread.sleep(500);
- }
- EngineUtils.stopServer();
- }
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
+ }
public void testEchoXMLSync() throws Exception{
- try{
OMFactory fac = OMFactory.newInstance();
SOAPEnvelope reqEnv=fac.getDefaultEnvelope();
@@ -106,19 +98,10 @@
SOAPEnvelope resEnv = call.sendReceive(reqEnv);
resEnv.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(System.out),true);
-
- finish=true;
-
OMNode omNode = resEnv.getBody().getFirstChild();
assertNotNull(omNode);
- }catch(Exception e){
- e.printStackTrace();
- tearDown();
- throw e;
- }
}
public void testEchoXMLASync() throws Exception{
- try{
OMFactory fac = OMFactory.newInstance();
SOAPEnvelope reqEnv=fac.getDefaultEnvelope();
@@ -148,17 +131,16 @@
}
public void reportError(Exception e){
e.printStackTrace();
+ finish=true;
}
};
call.sendReceiveAsync(reqEnv,callback);
+ while(!finish){
+ Thread.sleep(1000);
+ }
+
log.info("send the reqest");
-
- }catch(Exception e){
- e.printStackTrace();
- tearDown();
- throw e;
- }
}
}
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&r1=152980&r2=152981
==============================================================================
--- 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 Tue Feb 8 19:34:11 2005
@@ -27,7 +27,7 @@
import java.util.ArrayList;
public class EngineUtils {
- public static final int TESTING_PORT = 3333;
+ public static final int TESTING_PORT = 4444;
public static final String FAILURE_MESSAGE = "Intentional Faliure";
private static int index = 0;
private static SimpleHTTPReceiver sas;
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&r1=152980&r2=152981
==============================================================================
--- 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 Tue Feb 8 19:34:11 2005
@@ -17,9 +17,11 @@
//todo
+import javax.xml.namespace.QName;
+
import org.apache.axis.AbstractTestCase;
-import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReference;
import org.apache.axis.context.MessageContext;
import org.apache.axis.description.AxisOperation;
import org.apache.axis.description.Flow;
@@ -32,28 +34,26 @@
import org.apache.axis.impl.handlers.AbstractHandler;
import org.apache.axis.impl.providers.RawXMLProvider;
import org.apache.axis.impl.transport.http.SimpleHTTPReceiver;
-import org.apache.axis.om.*;
+import org.apache.axis.integration.UtilServer;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPBody;
+import org.apache.axis.om.SOAPEnvelope;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
public class HandlerFaliureTest extends AbstractTestCase {
private Log log = LogFactory.getLog(getClass());
private QName serviceName = new QName("", "EchoXMLService");
private QName operationName = new QName("http://localhost/my", "echoOMElement");
- private QName transportName = new QName("http://localhost/my", "NullTransport");
+
- private EngineRegistry engineRegistry;
private MessageContext mc;
private Thread thisThread = null;
private SimpleHTTPReceiver sas;
- private int testingPort = 7777;
- private int testCount = 0;
-
+
public HandlerFaliureTest() {
super(HandlerFaliureTest.class.getName());
}
@@ -63,7 +63,6 @@
}
protected void setUp() throws Exception {
- engineRegistry = EngineUtils.createMockRegistry(serviceName, operationName, transportName);
}
@@ -89,13 +88,13 @@
EngineUtils.createExecutionChains(service);
- engineRegistry.addService(service);
- sas = EngineUtils.startServer(engineRegistry);
+ UtilServer.start();
+ UtilServer.deployService(service);
try{
callTheService();
}finally{
- EngineUtils.stopServer();
- Thread.sleep(1000);
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
}
}
@@ -129,13 +128,13 @@
service.addOperation(operation);
EngineUtils.createExecutionChains(service);
- engineRegistry.addService(service);
- sas = EngineUtils.startServer(engineRegistry);
+ UtilServer.start();
+ UtilServer.deployService(service);
try{
callTheService();
}finally{
- EngineUtils.stopServer();
- Thread.sleep(1000);
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
}
}
@@ -163,23 +162,18 @@
call.setTo(targetEPR);
SOAPEnvelope resEnv = call.sendReceive(reqEnv);
- XMLStreamWriter writer = XMLOutputFactory.newInstance().
- createXMLStreamWriter(System.out);
- resEnv.serialize(writer, true);
- writer.flush();
SOAPBody sb = resEnv.getBody();
if (sb.hasFault()) {
String message = sb.getFault().getException().getMessage();
- System.out.println("message = " + message);
throw new AxisFault(message);
}
+ fail("the test must fail due to bad service Name");
} catch (AxisFault e) {
assertTrue((e.getMessage().indexOf(EngineUtils.FAILURE_MESSAGE)) > 0);
- tearDown();
return;
}
- fail("the test must fail due to bad service Name");
+
}
private Handler culprit = new AbstractHandler() {
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&r1=152980&r2=152981
==============================================================================
--- 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 Tue Feb 8 19:34:11 2005
@@ -16,16 +16,29 @@
package org.apache.axis.engine;
//todo
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.net.Socket;
+
+import javax.xml.namespace.QName;
+
import org.apache.axis.AbstractTestCase;
import org.apache.axis.context.MessageContext;
+import org.apache.axis.description.AxisModule;
+import org.apache.axis.description.AxisOperation;
+import org.apache.axis.description.MockFlow;
+import org.apache.axis.impl.description.AxisService;
+import org.apache.axis.impl.description.SimpleAxisOperationImpl;
+import org.apache.axis.impl.providers.SimpleJavaProvider;
import org.apache.axis.impl.transport.http.SimpleHTTPReceiver;
+import org.apache.axis.integration.UtilServer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import javax.xml.namespace.QName;
-import java.io.*;
-import java.net.Socket;
-
public class MessageWithServerTest extends AbstractTestCase{
private Log log = LogFactory.getLog(getClass());
private QName serviceName = new QName("","EchoService");
@@ -42,13 +55,30 @@
}
protected void setUp() throws Exception {
- engineRegistry = EngineUtils.createMockRegistry(serviceName,operationName,transportName);
- sas = EngineUtils.startServer(engineRegistry);
+ UtilServer.start();
+ AxisService service = new AxisService(serviceName);
+ service.setInFlow(new MockFlow("service inflow",4));
+ service.setOutFlow(new MockFlow("service outflow",5));
+ service.setFaultFlow(new MockFlow("service faultflow",1));
+ service.setClassLoader(Thread.currentThread().getContextClassLoader());
+ service.setServiceClass(Echo.class);
+
+ service.setProvider(new SimpleJavaProvider());
+
+ AxisModule m1 = new AxisModule(new QName("","A Mdoule 1"));
+ m1.setInFlow(new MockFlow("service module inflow",4));
+ m1.setFaultFlow(new MockFlow("service module faultflow",1));
+ service.addModule(m1.getName());
+
+ AxisOperation operation = new SimpleAxisOperationImpl(operationName);
+ service.addOperation(operation);
+
+ UtilServer.deployService(service);
}
protected void tearDown() throws Exception {
- EngineUtils.stopServer();
- Thread.sleep(1000);
+ UtilServer.unDeployService(serviceName);
+ UtilServer.stop();
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/EchoTest.java Tue Feb 8 19:34:11 2005
@@ -41,6 +41,7 @@
import org.apache.axis.om.OMElement;
import org.apache.axis.om.OMFactory;
import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPBody;
import org.apache.axis.om.SOAPEnvelope;
@@ -95,7 +96,12 @@
Call call = new Call();
call.setTo(targetEPR);
SOAPEnvelope responseEnv = call.sendReceive(envelope);
- XMLStreamReader xpp = responseEnv.getBody().getPullParser(true);
+
+ SOAPBody body = responseEnv.getBody();
+ if(body.hasFault()){
+ throw body.getFault().getException();
+ }
+ XMLStreamReader xpp = body.getPullParser(true);
int event = xpp.next();
while (event != XMLStreamConstants.START_ELEMENT) {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/UtilServer.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/UtilServer.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/integration/UtilServer.java Tue Feb 8 19:34:11 2005
@@ -19,6 +19,8 @@
import java.io.IOException;
import java.net.ServerSocket;
+import javax.xml.namespace.QName;
+
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineUtils;
import org.apache.axis.impl.description.AxisService;
@@ -32,6 +34,11 @@
throws AxisFault {
reciver.getEngineReg().addService(service);
}
+
+ public static synchronized void unDeployService(QName service)
+ throws AxisFault {
+ reciver.getEngineReg().removeService(service);
+ }
public static synchronized void start() throws IOException {
if (count == 0) {
@@ -45,17 +52,19 @@
try {
thread.start();
+ System.out.print("Server started .....");
} finally {
}
- } else {
- count++;
- }
+ }
+ count++;
}
public static synchronized void stop() {
if (count == 1) {
reciver.stop();
+ count = 0;
+ System.out.print("Server stopped .....");
} else {
count--;
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/SOAPFaultTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/SOAPFaultTest.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/SOAPFaultTest.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/SOAPFaultTest.java Tue Feb 8 19:34:11 2005
@@ -1,7 +1,6 @@
package org.apache.axis.om;
import org.apache.axis.AbstractTestCase;
-import org.apache.axis.om.*;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamWriter;
@@ -42,8 +41,7 @@
createXMLStreamWriter(System.out);
}
- public void testSOAPFault(){
- try {
+ public void testSOAPFault() throws Exception{
soapEnvelope = (SOAPEnvelope) OMTestUtils.getOMBuilder(getTestResourceFile("soap/minimalMessage.xml")).getDocumentElement();
SOAPBody soapBody = soapEnvelope.getBody();
@@ -59,9 +57,7 @@
- } catch (Exception e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
+
}
private void print() throws XMLStreamException {
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java?view=diff&r1=152980&r2=152981
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/om/builder/dummy/DummyOutObject.java Tue Feb 8 19:34:11 2005
@@ -3,11 +3,13 @@
import java.io.FileReader;
import java.io.IOException;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.stream.XMLStreamReader;
import org.apache.axis.encoding.Encoder;
import org.apache.axis.engine.AxisFault;
+import org.apache.axis.om.OMException;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
@@ -38,30 +40,24 @@
String fileName = "src/test-resources/soapmessage.xml";
- public DummyOutObject() {
+ public DummyOutObject() throws SAXException, ParserConfigurationException {
setup();
}
- private void setup() {
- try {
+ private void setup() throws SAXException, ParserConfigurationException {
SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setNamespaceAware(true);
parser = saxParserFactory.newSAXParser().getXMLReader();
- } catch (Exception e) {
- e.printStackTrace(); //TODO implement this
- }
}
- public void serialize(ContentHandler contentHandler) {
+ public void serialize(ContentHandler contentHandler) throws OMException{
try {
parser.parse(new InputSource(new FileReader(fileName)));
- } catch (IOException e) {
- e.printStackTrace(); //TODO implement this
- } catch (SAXException e) {
- e.printStackTrace(); //TODO implement this
+ } catch (Exception e) {
+ throw new OMException(e);
}
}