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 he...@apache.org on 2004/06/14 10:20:31 UTC
cvs commit: ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee AntExecuterTest.java GenerateClientTest.java EJBDDTest.java WebDDTest.java GenerateTest.java GenerateWithoutWSDLTest.java JaxRpcMappingTest.java WebServiceDDTest.java WSDLTest.java
hemapani 2004/06/14 01:20:31
Modified: contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/seviceRef
ServiceRefTest.java
contrib/ews/test/org/apache/geronimo/ews/ws4j2ee
EJBDDTest.java WebDDTest.java GenerateTest.java
GenerateWithoutWSDLTest.java JaxRpcMappingTest.java
WebServiceDDTest.java WSDLTest.java
Added: contrib/ews/test/org/apache/geronimo/ews/ws4j2ee
AntExecuterTest.java GenerateClientTest.java
Log:
fixed the testcases
Revision Changes Path
1.2 +37 -22 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java
Index: ServiceRefTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceRefTest.java 23 May 2004 15:38:23 -0000 1.1
+++ ServiceRefTest.java 14 Jun 2004 08:20:31 -0000 1.2
@@ -1,37 +1,52 @@
package org.apache.geronimo.ews.ws4j2ee.seviceRef;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import junit.framework.Assert;
-import junit.framework.TestCase;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferance;
import org.apache.geronimo.ews.ws4j2ee.parsers.ServiceReferanceParser;
-import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
/**
* @author hemapani
*/
-public class ServiceRefTest extends TestCase{
- public void testRefFile1() throws FileNotFoundException, GenerationFault{
- ServiceReferanceParser parser
- = new ServiceReferanceParser(new FileInputStream("src/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/service-ref1.xml"));
- ServiceReferance ref = parser.getRef();
- Assert.assertEquals("service/Joe",ref.getServicerefName());
- Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
- Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
- System.out.println(ref.getJaxrpcmappingFile());
- Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
+public class ServiceRefTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public ServiceRefTest(String testName) {
+ super(testName);
}
- public void testRefFile2() throws FileNotFoundException, GenerationFault{
- ServiceReferanceParser parser
- = new ServiceReferanceParser(new FileInputStream("src/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/service-ref2.xml"));
- ServiceReferance ref = parser.getRef();
- Assert.assertEquals("service/Joe",ref.getServicerefName());
- Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
- Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
- System.out.println(ref.getJaxrpcmappingFile());
- Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
+
+ public void testRefFile1() throws Exception{
+ try {
+ ServiceReferanceParser parser
+ = new ServiceReferanceParser(new FileInputStream(testDir+"org/apache/geronimo/ews/ws4j2ee/seviceRef/service-ref1.xml"));
+ ServiceReferance ref = parser.getRef();
+ Assert.assertEquals("service/Joe",ref.getServicerefName());
+ Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
+ Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
+ //System.out.println(ref.getJaxrpcmappingFile());
+ Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+ public void testRefFile2() throws Exception{
+ try {
+ ServiceReferanceParser parser
+ = new ServiceReferanceParser(new FileInputStream(testDir+"org/apache/geronimo/ews/ws4j2ee/seviceRef/service-ref2.xml"));
+ ServiceReferance ref = parser.getRef();
+ Assert.assertEquals("service/Joe",ref.getServicerefName());
+ Assert.assertEquals("javax.xml.rpc.Service",ref.getServiceInterface());
+ //System.out.println(ref.getJaxrpcmappingFile());
+ Assert.assertEquals("WEB-INF/joe.xml",ref.getJaxrpcmappingFile());
+ Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile());
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
}
}
1.4 +30 -21 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/EJBDDTest.java
Index: EJBDDTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/EJBDDTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EJBDDTest.java 30 Mar 2004 10:40:20 -0000 1.3
+++ EJBDDTest.java 14 Jun 2004 08:20:31 -0000 1.4
@@ -55,10 +55,8 @@
package org.apache.geronimo.ews.ws4j2ee;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-import junit.framework.TestCase;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
import org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext;
import org.apache.geronimo.ews.ws4j2ee.context.MiscInfo;
@@ -66,27 +64,38 @@
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFContext;
import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
import org.apache.geronimo.ews.ws4j2ee.parsers.EJBDDParser;
-import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
/**
* @author hemapani
*/
-public class EJBDDTest extends TestCase{
- public void testGoogleSample() throws FileNotFoundException, GenerationFault{
- J2EEWebServiceContext con = new J2EEWebServiceContext() {
- public WSDLContext getWSDLContext() {return null;}
- public void setWSDLContext(WSDLContext wsdlcontext) {}
- public WSCFContext getWSCFContext() {return null;}
- public void setWSCFContext(WSCFContext wscfcontext) {}
- public JaxRpcMapperContext getJAXRPCMappingContext() {return null;}
- public void setJAXRPCMappingContext(JaxRpcMapperContext context) {}
- public MiscInfo getMiscInfo() {return new MiscInfoImpl();}
- public void setMiscInfo(MiscInfo info) {}
- public void validate() {
- }
- };
- EJBDDParser pars = new EJBDDParser(con);
- pars.parse(new FileInputStream("src/test/testData/Math/ejb-jar.xml"));
- //Assert.assertEquals(con.getMiscInfo().getEjbName(),"MathFace");
+public class EJBDDTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public EJBDDTest(String testName) {
+ super(testName);
+ }
+
+ public void testGoogleSample() throws Exception{
+ try{
+ J2EEWebServiceContext con = new J2EEWebServiceContext() {
+ public WSDLContext getWSDLContext() {return null;}
+ public void setWSDLContext(WSDLContext wsdlcontext) {}
+ public WSCFContext getWSCFContext() {return null;}
+ public void setWSCFContext(WSCFContext wscfcontext) {}
+ public JaxRpcMapperContext getJAXRPCMappingContext() {return null;}
+ public void setJAXRPCMappingContext(JaxRpcMapperContext context) {}
+ public MiscInfo getMiscInfo() {return new MiscInfoImpl();}
+ public void setMiscInfo(MiscInfo info) {}
+ public void validate() {
+ }
+ };
+ EJBDDParser pars = new EJBDDParser(con);
+ pars.parse(new FileInputStream(testDir+"testData/Math/ejb-jar.xml"));
+ //Assert.assertEquals(con.getMiscInfo().getEjbName(),"MathFace");
+ }catch(Exception e){
+ e.printStackTrace();
+ throw e;
+ }
}
}
1.2 +11 -6 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java
Index: WebDDTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WebDDTest.java 30 Mar 2004 10:40:20 -0000 1.1
+++ WebDDTest.java 14 Jun 2004 08:20:31 -0000 1.2
@@ -55,11 +55,10 @@
package org.apache.geronimo.ews.ws4j2ee;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import junit.framework.Assert;
-import junit.framework.TestCase;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
import org.apache.geronimo.ews.ws4j2ee.context.JaxRpcMapperContext;
import org.apache.geronimo.ews.ws4j2ee.context.MiscInfo;
@@ -67,13 +66,19 @@
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFContext;
import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
import org.apache.geronimo.ews.ws4j2ee.parsers.WebDDParser;
-import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
/**
* @author hemapani
*/
-public class WebDDTest extends TestCase{
- public void testWebDD() throws FileNotFoundException, GenerationFault{
+public class WebDDTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public WebDDTest(String testName) {
+ super(testName);
+ }
+
+ public void testWebDD() throws Exception{
J2EEWebServiceContext con = new J2EEWebServiceContext() {
public WSDLContext getWSDLContext() {return null;}
public void setWSDLContext(WSDLContext wsdlcontext) {}
@@ -87,7 +92,7 @@
}
};
WebDDParser pars = new WebDDParser(con);
- pars.parse(new FileInputStream("src/test/testData/servletBase/web.xml"));
+ pars.parse(new FileInputStream(sampleDir + "servlet/math/web.xml"));
Assert.assertEquals("org.apache.axis.transport.http.AxisServlet",pars.getServletClass());
}
}
1.11 +24 -34 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/GenerateTest.java
Index: GenerateTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/GenerateTest.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- GenerateTest.java 23 May 2004 15:37:45 -0000 1.10
+++ GenerateTest.java 14 Jun 2004 08:20:31 -0000 1.11
@@ -58,18 +58,18 @@
import junit.framework.TestSuite;
import org.apache.geronimo.ews.AbstractTestCase;
-import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEClientwithWSDL;
import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEwithWSDL;
/**
* Unit test for simple App.
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
+ * @author <a href="mailto:hemapani@opensource.lk">Srinath Perera</a>
*/
public class GenerateTest
extends AbstractTestCase
{
- private String outDir = "target/generated/samples/";
+
/**
* Create the test case
*
@@ -91,57 +91,47 @@
public void testBookSample() throws Exception
{
- //client side
- String args[] = new String[]{getTestFile("src/samples/jaxrpc/book/webserviceClient.xml"),
- "-o" + getTestFile(outDir+"withWSDL/client/book/"),"-Iuse-remote"};
- Ws4J2EEClientwithWSDL.main(args);
-
//server side
- String args1[] = new String[]{getTestFile("src/samples/jaxrpc/book/webservice.xml"),
+ String args1[] = new String[]{getTestFile(sampleDir+"jaxrpc/book/webservice.xml"),
"-o" + getTestFile(outDir+"withWSDL/server/book/remote"),"--server-side","-Iuse-remote"};
Ws4J2EEwithWSDL.main(args1);
- args1 = new String[]{getTestFile("src/samples/jaxrpc/book/webservice.xml"),
+ args1 = new String[]{getTestFile(sampleDir + "jaxrpc/book/webservice.xml"),
"-o" + getTestFile(outDir+"withWSDL/server/book/local"),"--server-side","-Iuse-local"};
Ws4J2EEwithWSDL.main(args1);
- args1 = new String[]{getTestFile("src/samples/jaxrpc/book/webservice.xml"),
+ args1 = new String[]{getTestFile(sampleDir + "jaxrpc/book/webservice.xml"),
"-o" + getTestFile(outDir+"withWSDL/server/book/internal"),"--server-side","-Iuse-internals","-Cgeronimo"};
- Ws4J2EEwithWSDL.main(args1);
+ Ws4J2EEwithWSDL.main(args1);
}
+
public void testTimeSample() throws Exception{
- String args[] = new String[]{getTestFile("src/samples/jaxrpc/time/webserviceClient.xml"),
- "-o" + getTestFile(outDir+"withWSDL/client/time")};
- Ws4J2EEClientwithWSDL.main(args);
-
- args = new String[]{getTestFile("src/samples/jaxrpc/time/webservices.xml"),
+ String[] args;
+ args = new String[]{getTestFile(sampleDir + "jaxrpc/time/webservices.xml"),
"-o" + getTestFile(outDir+"withWSDL/server/time"),"--server-side"};
Ws4J2EEwithWSDL.main(args);
}
+
public void testZipSample() throws Exception{
- String args[] = new String[]{getTestFile("src/samples/mapper/frenchzip/webserviceClient.xml"),
- "-o" + getTestFile(outDir+"withWSDL/client/zip")};
- Ws4J2EEClientwithWSDL.main(args);
-
- args = new String[]{getTestFile("src/samples/mapper/frenchzip/webservices.xml"),
+ String[] args = new String[]{getTestFile(sampleDir +"mapper/frenchzip/webservices.xml"),
"-o" + getTestFile(outDir+"withWSDL/server/zip"),"--server-side"};
Ws4J2EEwithWSDL.main(args);
}
public void testGoogleSample() throws Exception{
- String args[] = new String[]{getTestFile("src/samples/mapper/google/webserviceClient.xml"),
- "-o" + getTestFile(outDir+"withWSDL/client/google")};
- Ws4J2EEClientwithWSDL.main(args);
-
- args = new String[]{getTestFile("src/samples/mapper/google/webservices.xml"),
- "-o" + getTestFile(outDir+"withWSDL/server/google"),"--server-side"};
- Ws4J2EEwithWSDL.main(args);
+ String[] args;
+ args = new String[]{getTestFile(sampleDir +"mapper/google/webservices.xml"),
+ "-o" + getTestFile(outDir+"withWSDL/server/google"),"--server-side"};
+ Ws4J2EEwithWSDL.main(args);
}
- public void testServletBasedSample()throws Exception{
-// String[] args = new String[]{getTestFile("src/test/testData/math/webservice.xml"),
-// "-o" + getTestFile(outDir+"withWSDL/server/servletBasedSample"),"--server-side"};
-// Ws4J2EEwithWSDL.main(args);
+ public void testServletBasedMathSample()throws Exception{
+ String[] args = new String[]{getTestFile(sampleDir +"servlet/math/webservice.xml"),
+ "-o" + getTestFile(outDir+"withWSDL/server/servletBasedMathSample"),"--server-side"};
+ Ws4J2EEwithWSDL.main(args);
+ }
+ public void testEJBBasedMathSample()throws Exception{
+ String[] args = new String[]{getTestFile(sampleDir +"ejb/math/webservice.xml"),
+ "-o" + getTestFile(outDir+"withWSDL/server/ejbBasedMathSample"),"--server-side"};
+ Ws4J2EEwithWSDL.main(args);
}
-
-
}
1.5 +40 -7 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/GenerateWithoutWSDLTest.java
Index: GenerateWithoutWSDLTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/GenerateWithoutWSDLTest.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- GenerateWithoutWSDLTest.java 23 May 2004 15:37:45 -0000 1.4
+++ GenerateWithoutWSDLTest.java 14 Jun 2004 08:20:31 -0000 1.5
@@ -55,8 +55,7 @@
package org.apache.geronimo.ews.ws4j2ee;
-import junit.framework.TestCase;
-
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEwithoutWSDL;
/**
@@ -67,16 +66,50 @@
* GenerateWithoutWSDL <webservice.xml-file> -o<targetoutput> <additionl argument that are given toJava2WSDL>
* @author Srinath Perera(hemapani@opensource.lk)
*/
-public class GenerateWithoutWSDLTest extends TestCase {
+public class GenerateWithoutWSDLTest extends AbstractTestCase {
private String outDir = "target/generated/samples/";
-
+ /**
+ * @param testName
+ */
+ public GenerateWithoutWSDLTest(String testName) {
+ super(testName);
+ }
+
public void testMathSample() throws Exception{
- String[] args2 = new String[]{"src/test/testData/math/webservice.xml","-o"+outDir+"withoutWSDL/math/server" ,"-l" ,"http://127.0.0.1/aixs/math"};
- Ws4J2EEwithoutWSDL.main(args2);
+ try{
+ String[] args2 = new String[]{testDir+"testData/math/webservice.xml","-o"+outDir+"withoutWSDL/math/server" ,"-l" ,"http://127.0.0.1/aixs/math"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
}
public void testServletBasedMathSample() throws Exception{
- String[] args2 = new String[]{"src/test/testData/math/webservice-servletBase.xml","-o"+outDir+"withoutWSDL/math/server-servlet" ,"-l" ,"http://127.0.0.1/aixs/math"};
+ String[] args2 = new String[]{testDir + "testData/math/webservice-ServletBased.xml","-o"+outDir+"withoutWSDL/math/server-servlet" ,"-l" ,"http://127.0.0.1/aixs/math"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }
+ public void testMathSampleWithHandlers() throws Exception{
+ try{
+ String[] args2 = new String[]{testDir + "testData/math/webservice-withHandler.xml","-o"+outDir+"withoutWSDL/math-withHandlers/server" ,"-l" ,"http://127.0.0.1/aixs/math"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ public void testBookSampleJar() throws Exception{
+ String[] args2 = new String[]{"target/generated/samples/bookquote.jar","-o"+outDir+"withoutWSDL/bookquote-jar/"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }
+ public void testGoogleSampleJar() throws Exception{
+ String[] args2 = new String[]{"target/generated/samples/google.jar","-o"+outDir+"withoutWSDL/google-jar/"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }
+ public void testTimeSampleJar() throws Exception{
+ String[] args2 = new String[]{"target/generated/samples/time.jar","-o"+outDir+"withoutWSDL/time-jar/"};
+ Ws4J2EEwithoutWSDL.main(args2);
+ }
+ public void testZipampleJar() throws Exception{
+ String[] args2 = new String[]{"target/generated/samples/zip.jar","-o"+outDir+"withoutWSDL/zip-jar/"};
Ws4J2EEwithoutWSDL.main(args2);
}
}
1.3 +71 -54 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/JaxRpcMappingTest.java
Index: JaxRpcMappingTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/JaxRpcMappingTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JaxRpcMappingTest.java 22 Mar 2004 11:51:09 -0000 1.2
+++ JaxRpcMappingTest.java 14 Jun 2004 08:20:31 -0000 1.3
@@ -61,12 +61,12 @@
import javax.xml.namespace.QName;
import junit.framework.Assert;
-import junit.framework.TestCase;
import org.apache.axis.wsdl.symbolTable.BindingEntry;
import org.apache.axis.wsdl.symbolTable.PortEntry;
import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.jaxrpcmapping.J2eeEmitter;
import org.apache.geronimo.ews.jaxrpcmapping.JaxRpcMapper;
import org.apache.geronimo.ews.ws4j2ee.context.ContextFactory;
@@ -76,62 +76,79 @@
/**
* @author hemapani
*/
-public class JaxRpcMappingTest extends TestCase{
+public class JaxRpcMappingTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public JaxRpcMappingTest(String testName) {
+ super(testName);
+ }
+
public void testGoogleTypeMapping() throws Exception{
- String mappingfile = "src/samples/mapper/google/GoogleSearch.xml";
- String wsdlfile = "src/samples/mapper/google/GoogleSearch.wsdl";
- J2eeEmitter j2ee = new J2eeEmitter();
- j2ee.setMappingFilePath(mappingfile);
- j2ee.setOutputDir("temp");
- j2ee.setServerSide(true);
- j2ee.setVerbose(true);
- j2ee.setHelperWanted(true);
- System.out.println();
- j2ee.runServerSide(wsdlfile);
- WSDLContext wscontext = ContextFactory.createWSDLContext(j2ee.getSymbolTable());
- PortEntry port = wscontext.getPort(new QName("GoogleSearchPort"));
- BindingEntry be = wscontext.getBinding(new QName("urn:GoogleSearch","GoogleSearchBinding"));
- PortTypeEntry pe = wscontext.getPortType(new QName("urn:GoogleSearch","GoogleSearchPort"));
- JaxRpcMapper mapper = j2ee.getJaxRpcMapper();
- JaxRpcMapperContext mc =ContextFactory.createJaxRpcMapperContext(new Object[]{mapper,j2ee});
- Assert.assertNotNull(port);
- Assert.assertNotNull(be);
- Assert.assertNotNull(pe);
- Assert.assertEquals(mc.getJavaType(new QName("urn:GoogleSearch","GoogleSearchResult")),"org.objectweb.wssample.gen.google.MyGoogleSearchResult");
- Assert.assertEquals(mc.getJavaType(new QName("urn:GoogleSearch","ResultElementArray")),"org.objectweb.wssample.gen.google.ResultElement[]");
+ try {
+ String mappingfile = sampleDir +"mapper/google/GoogleSearch.xml";
+ String wsdlfile = sampleDir +"mapper/google/GoogleSearch.wsdl";
+ J2eeEmitter j2ee = new J2eeEmitter();
+ j2ee.setMappingFilePath(mappingfile);
+ j2ee.setOutputDir(outDir);
+ j2ee.setServerSide(true);
+ j2ee.setVerbose(false);
+ j2ee.setHelperWanted(true);
+ System.out.println();
+ j2ee.runServerSide(wsdlfile);
+ WSDLContext wscontext = ContextFactory.createWSDLContext(j2ee.getSymbolTable());
+ PortEntry port = wscontext.getPort(new QName("GoogleSearchPort"));
+ BindingEntry be = wscontext.getBinding(new QName("urn:GoogleSearch","GoogleSearchBinding"));
+ PortTypeEntry pe = wscontext.getPortType(new QName("urn:GoogleSearch","GoogleSearchPort"));
+ JaxRpcMapper mapper = j2ee.getJaxRpcMapper();
+ JaxRpcMapperContext mc =ContextFactory.createJaxRpcMapperContext(new Object[]{mapper,j2ee});
+ Assert.assertNotNull(port);
+ Assert.assertNotNull(be);
+ Assert.assertNotNull(pe);
+ Assert.assertEquals(mc.getJavaType(new QName("urn:GoogleSearch","GoogleSearchResult")),"org.objectweb.wssample.gen.google.MyGoogleSearchResult");
+ Assert.assertEquals(mc.getJavaType(new QName("urn:GoogleSearch","ResultElementArray")),"org.objectweb.wssample.gen.google.ResultElement[]");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
}
public void testBookTypeMapping() throws Exception{
- String mappingfile = "src/samples/jaxrpc/book/BookQuote.xml";
- String wsdlfile = "src/samples/jaxrpc/book/BookQuote.wsdl";
- J2eeEmitter j2ee = new J2eeEmitter();
- j2ee.setMappingFilePath(mappingfile);
- j2ee.setOutputDir("temp");
- j2ee.setServerSide(true);
- j2ee.setVerbose(true);
- j2ee.setHelperWanted(true);
- System.out.println();
- j2ee.runServerSide(wsdlfile);
- WSDLContext wscontext = ContextFactory.createWSDLContext(j2ee.getSymbolTable());
- PortEntry port = wscontext.getPort(new QName("BookQuotePort"));
- BindingEntry be = wscontext.getBinding(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuoteBinding"));
- PortTypeEntry pe = wscontext.getPortType(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuote"));
- ServiceEntry se = wscontext.getService(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuoteService"));
- JaxRpcMapper mapper = j2ee.getJaxRpcMapper();
- JaxRpcMapperContext mc =ContextFactory.createJaxRpcMapperContext(new Object[]{mapper,j2ee});
- Assert.assertNotNull(port);
- Assert.assertNotNull(be);
- Assert.assertNotNull(pe);
- Assert.assertEquals(mc.getExceptionType(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","InvalidIsbnFault")),"com.jwsbook.jaxrpc.InvalidIsbnException");
-
- String sei = mc.getServiceEndpointInterfaceName(pe,be);
- Assert.assertEquals(sei,"com.jwsbook.jaxrpc.BookQuote");
- String si = mc.getServiceInterfaceName(se);
- Assert.assertEquals(si,"com.jwsbook.jaxrpc.BookQuoteService");
- List l = pe.getPortType().getOperations();
- Operation op = (Operation)l.get(0);
- Assert.assertEquals(mc.getJavaMethodName(be,op),"getBookPrice");
- Assert.assertEquals(mc.getJavaMethodParamType(be,op,0,null),"java.lang.String");
- Assert.assertEquals(mc.getJavaMethodReturnType(be,op),"float");
+ try {
+ String mappingfile = sampleDir +"jaxrpc/book/BookQuote.xml";
+ String wsdlfile = sampleDir +"jaxrpc/book/BookQuote.wsdl";
+ J2eeEmitter j2ee = new J2eeEmitter();
+ j2ee.setMappingFilePath(mappingfile);
+ j2ee.setOutputDir(outDir);
+ j2ee.setServerSide(true);
+ j2ee.setVerbose(false);
+ j2ee.setHelperWanted(true);
+ System.out.println();
+ j2ee.runServerSide(wsdlfile);
+ WSDLContext wscontext = ContextFactory.createWSDLContext(j2ee.getSymbolTable());
+ PortEntry port = wscontext.getPort(new QName("BookQuotePort"));
+ BindingEntry be = wscontext.getBinding(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuoteBinding"));
+ PortTypeEntry pe = wscontext.getPortType(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuote"));
+ ServiceEntry se = wscontext.getService(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","BookQuoteService"));
+ JaxRpcMapper mapper = j2ee.getJaxRpcMapper();
+ JaxRpcMapperContext mc =ContextFactory.createJaxRpcMapperContext(new Object[]{mapper,j2ee});
+ Assert.assertNotNull(port);
+ Assert.assertNotNull(be);
+ Assert.assertNotNull(pe);
+ Assert.assertEquals(mc.getExceptionType(new QName("http://www.Monson-Haefel.com/jwsbook/BookQuote","InvalidIsbnFault")),"com.jwsbook.jaxrpc.InvalidIsbnException");
+
+ String sei = mc.getServiceEndpointInterfaceName(pe,be);
+ Assert.assertEquals(sei,"com.jwsbook.jaxrpc.BookQuote");
+ String si = mc.getServiceInterfaceName(se);
+ Assert.assertEquals(si,"com.jwsbook.jaxrpc.BookQuoteService");
+ List l = pe.getPortType().getOperations();
+ Operation op = (Operation)l.get(0);
+ Assert.assertEquals(mc.getJavaMethodName(be,op),"getBookPrice");
+ Assert.assertEquals(mc.getJavaMethodParamType(be,op,0,null),"java.lang.String");
+ Assert.assertEquals(mc.getJavaMethodReturnType(be,op),"float");
+ } catch (Exception e) {
+ e.printStackTrace();
+ throw e;
+ }
}
}
1.3 +40 -6 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WebServiceDDTest.java
Index: WebServiceDDTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WebServiceDDTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WebServiceDDTest.java 22 Mar 2004 11:51:09 -0000 1.2
+++ WebServiceDDTest.java 14 Jun 2004 08:20:31 -0000 1.3
@@ -55,24 +55,32 @@
package org.apache.geronimo.ews.ws4j2ee;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import junit.framework.Assert;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.context.ContextFactory;
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFContext;
+import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFHandler;
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFPortComponent;
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFWebserviceDescription;
-import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
/**
* @author hemapani
*/
-public class WebServiceDDTest {
- public void testGoogleDD() throws FileNotFoundException, GenerationFault{
+public class WebServiceDDTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public WebServiceDDTest(String testName) {
+ super(testName);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void testGoogleDD() throws Exception{
WSCFContext wscfcontext
= ContextFactory.createWSCFContext(
- new FileInputStream("src/samples/mapper/google/webservice.xml"));
+ new FileInputStream(sampleDir + "mapper/google/webservices.xml"));
Assert.assertNull(wscfcontext.getDescription());
Assert.assertNull(wscfcontext.getLargeIcon());
Assert.assertNull(wscfcontext.getSmallIcon());
@@ -101,7 +109,33 @@
Assert.assertEquals(tpc.getServiceEndpointInterface(),"org.objectweb.wssample.gen.google.GoogleSearchPort");
Assert.assertEquals(tpc.getServiceImplBean().getEjblink(),"GoogleBean");
Assert.assertEquals(tpc.getWsdlPort().getNamespaceURI(),"urn:GoogleSearch");
- Assert.assertEquals(tpc.getWsdlPort().getNamespaceURI(),"GoogleSearchPort");
+ Assert.assertEquals(tpc.getWsdlPort().getLocalpart(),"GoogleSearchPort");
}
+
+ public void testHandlerDD() throws Exception{
+ WSCFContext wscfcontext
+ = ContextFactory.createWSCFContext(
+ new FileInputStream(testDir + "testData/math/webservice-withHandler.xml"));
+ WSCFWebserviceDescription[] wsarray = wscfcontext.getWebServicesDescription();
+ Assert.assertNotNull(wsarray);
+ Assert.assertTrue(wsarray.length > 0);
+ WSCFWebserviceDescription wsdes = wsarray[0];
+ WSCFPortComponent[] pc = wsdes.getPortComponent();
+ Assert.assertNotNull(pc);
+ Assert.assertTrue(pc.length > 0);
+ WSCFPortComponent tpc = pc[0];
+ WSCFHandler[] handlers = tpc.getHandlers();
+ Assert.assertNotNull(handlers);
+ Assert.assertTrue(handlers.length == 2);
+ WSCFHandler h1 = handlers[0];
+ Assert.assertEquals("sample.ValidationHandler",h1.getHandlerName());
+ Assert.assertEquals("sample.ValidationHandler",h1.getHandlerClass());
+
+ WSCFHandler h2 = handlers[1];
+ Assert.assertEquals("sample.LoggingHandler",h2.getHandlerName());
+ Assert.assertEquals("sample.LoggingHandler",h2.getHandlerClass());
+
+ }
+
}
1.3 +13 -5 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WSDLTest.java
Index: WSDLTest.java
===================================================================
RCS file: /home/cvs/ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/WSDLTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- WSDLTest.java 22 Mar 2004 11:51:09 -0000 1.2
+++ WSDLTest.java 14 Jun 2004 08:20:31 -0000 1.3
@@ -60,6 +60,7 @@
import org.apache.axis.wsdl.symbolTable.BindingEntry;
import org.apache.axis.wsdl.symbolTable.PortEntry;
+import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.jaxrpcmapping.J2eeEmitter;
import org.apache.geronimo.ews.ws4j2ee.context.ContextFactory;
import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
@@ -67,15 +68,22 @@
/**
* @author hemapani
*/
-public class WSDLTest {
+public class WSDLTest extends AbstractTestCase{
+ /**
+ * @param testName
+ */
+ public WSDLTest(String testName) {
+ super(testName);
+ }
+
public void testGoogleWSDL() throws Exception{
- String mappingfile = "src/samples/mapper/google/GoogleSearch.xml";
- String wsdlfile = "src/samples/mapper/google/GoogleSearch.wsdl";
+ String mappingfile = sampleDir +"mapper/google/GoogleSearch.xml";
+ String wsdlfile = sampleDir + "mapper/google/GoogleSearch.wsdl";
J2eeEmitter j2ee = new J2eeEmitter();
j2ee.setMappingFilePath(mappingfile);
- j2ee.setOutputDir("temp");
+ j2ee.setOutputDir(outDir);
j2ee.setServerSide(true);
- j2ee.setVerbose(true);
+ j2ee.setVerbose(false);
j2ee.setHelperWanted(true);
System.out.println();
j2ee.runServerSide(wsdlfile);
1.1 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/AntExecuterTest.java
Index: AntExecuterTest.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.geronimo.ews.ws4j2ee;
import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.utils.AntExecuter;
/**
* @author hemapani
*/
public class AntExecuterTest extends AbstractTestCase{
/**
* @param testName
*/
public AntExecuterTest(String testName) {
super(testName);
}
public void testBuildFile() throws Exception{
try{
AntExecuter exec = new AntExecuter();
exec.execute(testDir + "testData/testBuildfile.xml");
}catch(Exception e){
e.printStackTrace();
throw e;
}
}
}
1.1 ws-axis/contrib/ews/test/org/apache/geronimo/ews/ws4j2ee/GenerateClientTest.java
Index: GenerateClientTest.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.geronimo.ews.ws4j2ee;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.geronimo.ews.AbstractTestCase;
import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2EEClientwithWSDL;
/**
* Unit test for simple App.
*
* @author <a href="mailto:jason@zenplex.com">Jason van Zyl</a>
*/
public class GenerateClientTest
extends AbstractTestCase
{
private String outDir = "target/generated/samples/";
/**
* Create the test case
*
* @param testName name of the test case
*/
public GenerateClientTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( GenerateClientTest.class );
}
public void testDummy() {}
public void testBookSample() throws Exception
{
//client side
String args[] = new String[]{getTestFile(sampleDir + "jaxrpc/book/webserviceClient.xml"),
"-o" + getTestFile(outDir+"withWSDL/client/book/"),"-Iuse-remote"};
Ws4J2EEClientwithWSDL.main(args);
}
public void testTimeSample() throws Exception{
String[] args;
args = new String[]{getTestFile(sampleDir + "jaxrpc/time/webserviceClient.xml"),
"-o" + getTestFile(outDir+"withWSDL/client/time")};
Ws4J2EEClientwithWSDL.main(args);
}
public void testZipSample() throws Exception{
String args[] = new String[]{getTestFile(sampleDir + "mapper/frenchzip/webserviceClient.xml"),
"-o" + getTestFile(outDir+"withWSDL/client/zip")};
Ws4J2EEClientwithWSDL.main(args);
}
public void testGoogleSample() throws Exception{
String[] args;
args = new String[]{getTestFile(sampleDir + "mapper/google/webserviceClient.xml"),
"-o" + getTestFile(outDir+"withWSDL/client/google")};
Ws4J2EEClientwithWSDL.main(args);
}
}