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 09:43:08 UTC
svn commit: r123176 - in webservices/axis/trunk/java/dev/scratch/prototype2/src: java/org/apache/axis/engine java/org/apache/axis/impl/transport/http samples/msg/echo test/org/apache/axis/engine
Author: hemapani
Date: Thu Dec 23 00:43:07 2004
New Revision: 123176
URL: http://svn.apache.org/viewcvs?view=rev&rev=123176
Log:
add engine and deployment test
Modified:
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.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/samples/msg/echo/Echo.java
webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java?view=diff&rev=123176&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java&r1=123175&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java&r2=123176
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/engine/EngineRegistryFactory.java Thu Dec 23 00:43:07 2004
@@ -23,7 +23,7 @@
public class EngineRegistryFactory {
- public EngineRegistry createEngineRegistry(String file)throws AxisFault{
+ public static EngineRegistry createEngineRegistry(String file)throws AxisFault{
try {
DeploymentEngine deploymentEngine = new DeploymentEngine(file);
return deploymentEngine.start();
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java?view=diff&rev=123176&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java&r1=123175&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java&r2=123176
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/AxisServlet.java Thu Dec 23 00:43:07 2004
@@ -15,11 +15,13 @@
*/
package org.apache.axis.impl.transport.http;
+import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -35,6 +37,7 @@
import org.apache.axis.engine.AxisEngine;
import org.apache.axis.engine.AxisFault;
import org.apache.axis.engine.EngineRegistry;
+import org.apache.axis.engine.EngineRegistryFactory;
import org.apache.axis.engine.TransportSenderLocator;
import org.apache.axis.impl.llom.builder.StAXBuilder;
import org.apache.axis.impl.llom.builder.StAXSOAPModelBuilder;
@@ -47,8 +50,14 @@
public class AxisServlet extends HttpServlet{
private EngineRegistry engineRegistry;
- public void init(ServletConfig arg0) throws ServletException {
- //TODO create a ER here
+ public void init(ServletConfig config) throws ServletException {
+ try {
+ ServletContext context = config.getServletContext();
+ String repoDir = context.getRealPath("/WEB-INF");
+ engineRegistry = EngineRegistryFactory.createEngineRegistry(repoDir);
+ } catch (AxisFault e) {
+ throw new ServletException(e);
+ }
}
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&rev=123176&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java&r1=123175&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/impl/transport/http/SimpleHTTPReceiver.java&r2=123176
==============================================================================
--- 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 Thu Dec 23 00:43:07 2004
@@ -139,10 +139,6 @@
*/
public SimpleHTTPReceiver(AxisEngine myAxisServer) {
super(myAxisServer);
-
-
-
-
}
public SimpleHTTPReceiver(String dir) throws AxisFault {
@@ -504,6 +500,13 @@
} catch (IOException e) {
throw AxisFault.makeFault(e);
}
+ }
+
+ /**
+ * @return
+ */
+ public AxisEngine getEngine() {
+ return engine;
}
}
Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java
Url: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java?view=diff&rev=123176&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java&r1=123175&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java&r2=123176
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/msg/echo/Echo.java Thu Dec 23 00:43:07 2004
@@ -19,5 +19,11 @@
public class Echo {
public OMElement echo(OMElement in){
return in;
- }
+ }
+ public int echoInt(int in){
+ return in;
+ }
+ public int echoString(int in){
+ return in;
+ }
}
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=123176&p1=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java&r1=123175&p2=webservices/axis/trunk/java/dev/scratch/prototype2/src/test/org/apache/axis/engine/EngineAndDeploymentTest.java&r2=123176
==============================================================================
--- 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 00:43:07 2004
@@ -15,22 +15,49 @@
*/
package org.apache.axis.engine;
-import javax.xml.stream.XMLStreamException;
+import java.net.URL;
import org.apache.axis.AbstractTestCase;
-import org.apache.axis.deployment.DeploymentException;
-import org.apache.axis.phaseresolver.PhaseException;
+import org.apache.axis.addressing.AddressingConstants;
+import org.apache.axis.addressing.EndpointReferenceType;
+import org.apache.axis.clientapi.Call;
+import org.apache.axis.impl.transport.http.SimpleHTTPReceiver;
+import org.apache.axis.om.OMElement;
+import org.apache.axis.om.OMFactory;
+import org.apache.axis.om.OMNamespace;
+import org.apache.axis.om.SOAPEnvelope;
public class EngineAndDeploymentTest extends AbstractTestCase{
+ private EngineRegistry er;
+ private SimpleHTTPReceiver sas;
/**
* @param testName
*/
- public EngineAndDeploymentTest(String testName) {
+ public EngineAndDeploymentTest(String testName) throws Exception{
super(testName);
- // TODO Auto-generated constructor stub
+ er = EngineRegistryFactory.createEngineRegistry("target/test-resources/deployment");
+ sas = EngineUtils.startServer(er);
+
}
- public void testRunServiceWithDeployment() throws AxisFault, PhaseException, DeploymentException, XMLStreamException{
+ public void testRunServiceWithDeployment() throws Exception{
+ OMFactory fac = OMFactory.newInstance();
+
+ SOAPEnvelope envelope = fac.getDefaultEnvelope();
+
+ OMNamespace omNs = fac.createOMNamespace("http://localhost/my","my");
+ OMElement method = fac.createOMElement("echo",omNs) ;
+ OMElement value = fac.createOMElement("myValue",omNs) ;
+ value.setValue("Isaac Assimov, the foundation Sega");
+ method.addChild(value);
+
+ envelope.getBody().addChild(method);
+
+ Call call = new Call();
+ URL url = new URL("http","127.0.0.1",EngineUtils.TESTING_PORT,"/axis/services/EchoXMLService");
+ call.setTo(new EndpointReferenceType(AddressingConstants.WSA_TO,url.toString()));
+ OMElement omele = call.sendReceive(envelope);
+ assertNotNull(omele);
}
}