You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2005/06/02 09:05:23 UTC
svn commit: r179535 - in
/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl:
WSDL2WS.java codegen/emitter/CSharpEmitter.java
codegen/emitter/JavaEmitter.java template/java/TestClassTemplate.xsl
Author: chathura
Date: Thu Jun 2 00:05:23 2005
New Revision: 179535
URL: http://svn.apache.org/viewcvs?rev=179535&view=rev
Log:
Changed the style sheet to setup a server and use the Deployment Engine to deploy the particular service. Actual service implementation is not as yet deployed.
Modified:
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java?rev=179535&r1=179534&r2=179535&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java Thu Jun 2 00:05:23 2005
@@ -37,6 +37,7 @@
System.out.println("-s : Generate sync style code only. Default if off. takes precedence over -a");
System.out.println("-p <package name> : set custom package name");
System.out.println("-l <language> : valid languages are java and csharp. Default is java");
+ System.out.println("-t : Generate TestCase to test the generated code");
System.out.println("-ss : Generate server side code (i.e. skeletons).Default is off");
System.out.println("-sd : Generate service descriptor (i.e. server.xml).Default is off.Valid with -ss ");
System.exit(0);
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java?rev=179535&r1=179534&r2=179535&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/CSharpEmitter.java Thu Jun 2 00:05:23 2005
@@ -1,18 +1,8 @@
package org.apache.axis.wsdl.codegen.emitter;
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
-import org.apache.axis.wsdl.databinding.CsharpTypeMapper;
-import org.apache.axis.wsdl.databinding.TypeMapper;
import org.apache.axis.wsdl.databinding.DefaultTypeMapper;
-import org.apache.crimson.tree.XmlDocument;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLInterface;
-import org.apache.wsdl.WSDLOperation;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-
-import java.util.Collection;
-import java.util.Iterator;
+import org.apache.axis.wsdl.databinding.TypeMapper;
/*
* Copyright 2004,2005 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java?rev=179535&r1=179534&r2=179535&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/JavaEmitter.java Thu Jun 2 00:05:23 2005
@@ -1,19 +1,8 @@
package org.apache.axis.wsdl.codegen.emitter;
-import java.util.Collection;
-import java.util.Iterator;
-
import org.apache.axis.wsdl.codegen.CodeGenConfiguration;
-import org.apache.axis.wsdl.codegen.CodeGenerationException;
import org.apache.axis.wsdl.databinding.JavaTypeMapper;
import org.apache.axis.wsdl.databinding.TypeMapper;
-import org.apache.axis.wsdl.databinding.DefaultTypeMapper;
-import org.apache.crimson.tree.XmlDocument;
-import org.apache.wsdl.WSDLBinding;
-import org.apache.wsdl.WSDLInterface;
-import org.apache.wsdl.WSDLOperation;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
/*
* Copyright 2004,2005 The Apache Software Foundation.
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl?rev=179535&r1=179534&r2=179535&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/TestClassTemplate.xsl Thu Jun 2 00:05:23 2005
@@ -8,12 +8,73 @@
<xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
<xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
package <xsl:value-of select="$package"/>;
+
+ import java.io.InputStream;
+ import java.net.ServerSocket;
+
+ import org.apache.axis.context.ConfigurationContext;
+ import org.apache.axis.deployment.DeploymentEngine;
+ import org.apache.axis.description.ServiceDescription;
+ import org.apache.axis.engine.AxisConfiguration;
+ import org.apache.axis.integration.Constants;
+ import org.apache.axis.transport.http.SimpleHTTPServer;
+
/*
* Auto generated Junit test case by the Axis code generator
*/
public class <xsl:value-of select="@name"/> extends junit.framework.TestCase{
+
+
+ private static int count = 0;
+ private static SimpleHTTPServer server;
+
+ public void setUp() throws Exception {
+ if (count == 0) {
+ DeploymentEngine deploymentEngine = new DeploymentEngine(System
+ .getProperty("user.dir"));
+ AxisConfiguration axisConfig = deploymentEngine.load();
+ ClassLoader classLoader = this.getClass().getClassLoader();
+ classLoader.getResource("com.datatransferhsbc.HSBCServices");
+ classLoader.getResource("com.datatransferhsbc.HSBCServicesStub");
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ InputStream in = cl
+ .getResourceAsStream("com/datatransferhsbc/service.xml");
+ //InputStream in = new FileInputStream(new
+ // File("/src/com/datatransferhsbc/service.xml"));
+ ServiceDescription service = new ServiceDescription();
+ deploymentEngine.buildService(service, in, classLoader);
+
+ ConfigurationContext configurationContext = new ConfigurationContext(
+ axisConfig);
+ ServerSocket serverSoc = null;
+ serverSoc = new ServerSocket(Constants.TESTING_PORT);
+ server = new SimpleHTTPServer(
+ configurationContext, serverSoc);
+ Thread thread = new Thread(server);
+ thread.setDaemon(true);
+
+ try {
+ thread.start();
+ System.out.print("Server started on port "
+ + Constants.TESTING_PORT + ".....");
+ } finally {
+
+ }
+ }
+ count++;
+ }
+
+ protected void tearDown() throws Exception {
+ if (count == 1) {
+ server.stop();
+ count = 0;
+ System.out.print("Server stopped .....");
+ } else {
+ count--;
+ }
+ }
<xsl:for-each select="method">