Modified: webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebApplicationTest.java URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebApplicationTest.java?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebApplicationTest.java (original) +++ webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebApplicationTest.java Sun Feb 13 20:26:05 2005 @@ -17,11 +17,11 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.FileWriter; import java.io.InputStream; import java.io.OutputStream; -import java.io.Writer; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.net.MalformedURLException; import java.net.ServerSocket; import java.net.URL; import java.net.URLClassLoader; @@ -41,42 +41,33 @@ /** * @author Srinath Perera([EMAIL PROTECTED]) */ -public class WebApplicationTest extends AbstractTestCase{ - private boolean useTcpMon = true; - private tcpmon tcpmon; +public class WebApplicationTest extends AbstractTestCase { private int sendPort = 4444; private int serverport = 4444; private SimpleAxisServer sas; - + public WebApplicationTest(String testName) { super(testName); } protected void setUp() throws Exception { - if(useTcpMon){ - sendPort = 5555; - tcpmon = new tcpmon(sendPort,"127.0.0.1",serverport); - - } - - File wsddFile = new File(getTestFile("target/server-config.wsdd")); wsddFile.delete(); wsddFile.createNewFile(); OutputStream out = new FileOutputStream(wsddFile); - - InputStream in = Thread.currentThread().getContextClassLoader() - .getResourceAsStream("org/apache/axis/server/server-config.wsdd"); - + + InputStream in = + Thread.currentThread().getContextClassLoader().getResourceAsStream( + "org/apache/axis/server/server-config.wsdd"); + byte[] buf = new byte[1024]; int read = in.read(buf); - - while(read > 0){ - out.write(buf,0,read); + + while (read > 0) { + out.write(buf, 0, read); read = in.read(buf); } in.close(); out.close(); - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); @@ -86,53 +77,110 @@ sas.setServerSocket(new ServerSocket(serverport)); sas.setMyConfig(wsdddoc.getDeployment()); sas.start(); - + } - - - public void testEcho()throws Exception{ - String[] args2 = new String[]{ - getTestFile("target/generated/samples/echo.war"),"-o", - outDir+"withoutWSDL/echo-war/"}; - Ws4J2ee.main(args2); - - File jarFile = new File("target/generated/samples/withoutWSDL/echo-war/echo-ewsimpl.jar"); - - URLClassLoader cl = new URLClassLoader(new URL[]{jarFile.toURL()},Thread.currentThread().getContextClassLoader()); - InputStream deplydd = cl.getResourceAsStream("deploy.wsdd"); - assertNotNull(deplydd); - - ClassLoader parentClassLoder = ClassUtils.getDefaultClassLoader(); - ClassUtils.setDefaultClassLoader(cl); - AdminClient adminClient = new AdminClient(); - - URL requestUrl = new URL("http://localhost:"+sendPort+"/axis/services/AdminService"); - Call call = adminClient.getCall(); - call.setTargetEndpointAddress(requestUrl); - String result = adminClient.process(null, deplydd); - System.out.println(result); - - Class echoLoacaterClass = ClassUtils.forName("org.apache.ws.echosample.EchoServiceLocator"); - Class structClass = ClassUtils.forName("org.apache.ws.echosample.EchoStruct"); - - Object echoLoacater = echoLoacaterClass.newInstance(); - Method getportMethod = echoLoacaterClass.getMethod("getechoPort", new Class[]{URL.class}); - - URL serviceURL = new URL("http://localhost:"+sendPort+"/axis/services/echoPort"); - Object echoPort = getportMethod.invoke(echoLoacater, new Object[]{serviceURL}); - Class echoClass = echoPort.getClass(); - - Method echoStringMethod = echoClass.getMethod("echoString", new Class[]{String.class}); - String in = "Hello"; - assertEquals(in,echoStringMethod.invoke(echoPort, new Object[]{in})); - - - Method echostuctMethod = echoClass.getMethod("echoStruct", new Class[]{structClass}); - Object structval = structClass.newInstance(); - Object structret = echostuctMethod.invoke(echoPort, new Object[]{structval}); - - System.out.println("Sucssessful"); - + + public void testEcho() throws Exception { + try { + + String[] args2 = + new String[] { + getTestFile("target/generated/samples/echo.war"), + "-o", + outDir + "withoutWSDL/echo-war/" }; + Ws4J2ee.main(args2); + +// File jarFile = +// new File("target/generated/samples/withoutWSDL/echo-war/echo-ewsimpl.jar"); + URL jarFileURL = + new URL("file","","target/generated/samples/withoutWSDL/echo-war/echo-ewsimpl.jar"); + + URLClassLoader cl = + new URLClassLoader( + new URL[] { jarFileURL}, + Thread.currentThread().getContextClassLoader()); + InputStream deplydd = cl.getResourceAsStream("deploy.wsdd"); + assertNotNull(deplydd); + + ClassLoader parentClassLoder = ClassUtils.getDefaultClassLoader(); + ClassUtils.setDefaultClassLoader(cl); + AdminClient adminClient = new AdminClient(); + + URL requestUrl = + new URL( + "http://localhost:" + + sendPort + + "/axis/services/AdminService"); + Call call = adminClient.getCall(); + call.setTargetEndpointAddress(requestUrl); + String result = adminClient.process(null, deplydd); + System.out.println(result); + + ClassUtils.setClassLoader( + "org.apache.ws.echosample.EchoStruct", + cl); + Class echoLoacaterClass = + ClassUtils.forName( + "org.apache.ws.echosample.EchoServiceLocator"); + Class structClass = + ClassUtils.forName("org.apache.ws.echosample.EchoStruct"); + + Object echoLoacater = echoLoacaterClass.newInstance(); + Method getportMethod = + echoLoacaterClass.getMethod( + "getechoPort", + new Class[] { URL.class }); + + URL serviceURL = + new URL( + "http://localhost:" + sendPort + "/axis/services/echoPort"); + Object echoPort = + getportMethod.invoke(echoLoacater, new Object[] { serviceURL }); + Class echoClass = echoPort.getClass(); + + Method echoStringMethod = + echoClass.getMethod("echoString", new Class[] { String.class }); + String in = "Hello"; + assertEquals( + in, + echoStringMethod.invoke(echoPort, new Object[] { in })); + + Method echostuctMethod = + echoClass.getMethod("echoStruct", new Class[] { structClass }); + Object structval = structClass.newInstance(); + Object structret = + echostuctMethod.invoke(echoPort, new Object[] { structval }); + + System.out.println("Sucssessful"); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (SecurityException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (NoSuchMethodException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Throwable e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } protected void tearDown() throws Exception { sas.stop();
Modified: webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java (original) +++ webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/WebDDTest.java Sun Feb 13 20:26:05 2005 @@ -1,47 +1,47 @@ -/* - * Copyright 2001-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.geronimo.ews.ws4j2ee; - -import java.io.FileInputStream; - -import junit.framework.Assert; - -import org.apache.geronimo.ews.AbstractTestCase; -import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext; -import org.apache.geronimo.ews.ws4j2ee.parsers.WebDDParser; - -import testData.MockWs4J2eeContext; - -/** - * @author hemapani - */ -public class WebDDTest extends AbstractTestCase{ - /** - * @param testName - */ - public WebDDTest(String testName) { - super(testName); - } - - public void testWebDD() throws Exception{ - J2EEWebServiceContext con = new MockWs4J2eeContext(); - con.getMiscInfo().setJ2eeComponetLink("AxisServlet"); - WebDDParser pars = new WebDDParser(con); - pars.parse(new FileInputStream(getTestFile(sampleDir + "servlet/math/web.xml"))); - Assert.assertEquals("org.apache.axis.transport.http.AxisServlet",pars.getServletClass()); - } -} +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.ews.ws4j2ee; + +import java.io.FileInputStream; + +import junit.framework.Assert; + +import org.apache.geronimo.ews.AbstractTestCase; +import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext; +import org.apache.geronimo.ews.ws4j2ee.parsers.WebDDParser; + +import testData.MockWs4J2eeContext; + +/** + * @author hemapani + */ +public class WebDDTest extends AbstractTestCase{ + /** + * @param testName + */ + public WebDDTest(String testName) { + super(testName); + } + + public void testWebDD() throws Exception{ + J2EEWebServiceContext con = new MockWs4J2eeContext(); + con.getMiscInfo().setJ2eeComponetLink("AxisServlet"); + WebDDParser pars = new WebDDParser(con); + pars.parse(new FileInputStream(getTestFile(sampleDir + "servlet/math/web.xml"))); + Assert.assertEquals("org.apache.axis.transport.http.AxisServlet",pars.getServletClass()); + } +} Modified: webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/XMLBeansTest.java URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/XMLBeansTest.java?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/XMLBeansTest.java (original) +++ webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/XMLBeansTest.java Sun Feb 13 20:26:05 2005 @@ -22,11 +22,8 @@ import org.apache.geronimo.ews.AbstractTestCase; import org.apache.xmlbeans.XmlObject; -import com.sun.java.xml.ns.j2Ee.DisplayNameType; import com.sun.java.xml.ns.j2Ee.WebservicesDocument; import com.sun.java.xml.ns.j2Ee.WebservicesType; - -import junit.framework.TestCase; /** * @author Srinath Perera([EMAIL PROTECTED]) Modified: webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/providerUsage/POJOBasedEWSWithProviderTest.java URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/providerUsage/POJOBasedEWSWithProviderTest.java?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/providerUsage/POJOBasedEWSWithProviderTest.java (original) +++ webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/providerUsage/POJOBasedEWSWithProviderTest.java Sun Feb 13 20:26:05 2005 @@ -96,7 +96,8 @@ Ws4J2ee.main(args2); File jarFile = new File("target/generated/samples/withoutWSDL/echo-war/echo-ewsimpl.jar"); - + assertTrue("the jar file is not created, if you are runing IDE run the maven build first ", + jarFile.exists()); URLClassLoader cl = new URLClassLoader(new URL[]{jarFile.toURL()},Thread.currentThread().getContextClassLoader()); InputStream deplydd = cl.getResourceAsStream("deploy.wsdd"); assertNotNull(deplydd); Modified: webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java (original) +++ webservices/ews/trunk/test/org/apache/geronimo/ews/ws4j2ee/seviceRef/ServiceRefTest.java Sun Feb 13 20:26:05 2005 @@ -1,69 +1,71 @@ -/* - * Copyright 2001-2004 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.geronimo.ews.ws4j2ee.seviceRef; - -import java.io.FileInputStream; - -import junit.framework.Assert; - -import org.apache.geronimo.ews.AbstractTestCase; -import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferanceContext; -import org.apache.geronimo.ews.ws4j2ee.parsers.ServiceReferanceParser; - -/** - * @author hemapani - */ -public class ServiceRefTest extends AbstractTestCase{ - /** - * @param testName - */ - public ServiceRefTest(String testName) { - super(testName); - } - - public void testRefFile1() throws Exception{ - try { - ServiceReferanceParser parser - = new ServiceReferanceParser(new FileInputStream( - getTestFile(testDir+"org/apache/geronimo/ews/" + "ws4j2ee/seviceRef/service-ref1.xml"))); - ServiceReferanceContext 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()); - 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( - getTestFile(testDir+"org/apache/geronimo/ews/ws4j2ee/" + "seviceRef/service-ref2.xml"))); - ServiceReferanceContext 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()); - Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile()); - } catch (Exception e) { - e.printStackTrace(); - throw e; - } - } -} +/* + * Copyright 2001-2004 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.geronimo.ews.ws4j2ee.seviceRef; + +import java.io.FileInputStream; + +import junit.framework.Assert; + +import org.apache.geronimo.ews.AbstractTestCase; +import org.apache.geronimo.ews.ws4j2ee.context.webservices.client.interfaces.ServiceReferanceContext; +import org.apache.geronimo.ews.ws4j2ee.parsers.ServiceReferanceParser; + +/** + * @author hemapani + */ +public class ServiceRefTest extends AbstractTestCase{ + /** + * @param testName + */ + public ServiceRefTest(String testName) { + super(testName); + } + + public void testRefFile1() throws Exception{ + try { + ServiceReferanceParser parser + = new ServiceReferanceParser(new FileInputStream( + getTestFile(testDir+"org/apache/geronimo/ews/" + + "ws4j2ee/seviceRef/service-ref1.xml"))); + ServiceReferanceContext 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()); + 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( + getTestFile(testDir+"org/apache/geronimo/ews/ws4j2ee/" + + "seviceRef/service-ref2.xml"))); + ServiceReferanceContext 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()); + Assert.assertEquals("WEB-INF/joe.wsdl",ref.getWsdlFile()); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } +} Modified: webservices/ews/trunk/test/testData/math/webservices.xml URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/test/testData/math/webservices.xml?view=diff&r1=153709&r2=153710 ============================================================================== --- webservices/ews/trunk/test/testData/math/webservices.xml (original) +++ webservices/ews/trunk/test/testData/math/webservices.xml Sun Feb 13 20:26:05 2005 @@ -1,20 +1,20 @@ -<?xml version="1.0" encoding="UTF-8"?> -<webservices xmlns="http://java.sun.com/xml/ns/j2ee" -xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -xmlns:ns1="http://www.Monson-Haefel.com/jwsbook/BookQuote" -xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee -http://www.ibm.com/standards/xml/webservices/j2ee/j2ee_web_services_1_1.xsd" version="1.1"> -<webservice-description> - <webservice-description-name>MathFaceService</webservice-description-name> - <wsdl-file>math.wsdl</wsdl-file> - <jaxrpc-mapping-file>jaxrpc-mapping.xml</jaxrpc-mapping-file> - <port-component> - <port-component-name>MathFace</port-component-name> - <wsdl-port xmlns:ns1="http://math.testData">ns1:math</wsdl-port> - <service-endpoint-interface>testData.math.MathFace</service-endpoint-interface> - <service-impl-bean> - <ejb-link >MathFace</ejb-link> - </service-impl-bean> - </port-component> - </webservice-description> -</webservices> +<?xml version="1.0" encoding="UTF-8"?> +<webservices xmlns="http://java.sun.com/xml/ns/j2ee" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xmlns:ns1="http://www.Monson-Haefel.com/jwsbook/BookQuote" +xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee +http://www.ibm.com/standards/xml/webservices/j2ee/j2ee_web_services_1_1.xsd" version="1.1"> +<webservice-description> + <webservice-description-name>MathFaceService</webservice-description-name> + <wsdl-file>math.wsdl</wsdl-file> + <jaxrpc-mapping-file>jaxrpc-mapping.xml</jaxrpc-mapping-file> + <port-component> + <port-component-name>MathFace</port-component-name> + <wsdl-port xmlns:ns1="http://math.testData">ns1:math</wsdl-port> + <service-endpoint-interface>testData.math.MathFace</service-endpoint-interface> + <service-impl-bean> + <ejb-link >MathFace</ejb-link> + </service-impl-bean> + </port-component> + </webservice-description> +</webservices> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
