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 de...@apache.org on 2005/08/04 12:18:14 UTC
svn commit: r227340 - in /webservices/axis/trunk/java/modules: integration/
integration/src/org/ integration/src/org/apache/
integration/src/org/apache/axis2/
integration/src/org/apache/axis2/soap12testing/
integration/src/org/apache/axis2/soap12testin...
Author: deepal
Date: Thu Aug 4 03:17:43 2005
New Revision: 227340
URL: http://svn.apache.org/viewcvs?rev=227340&view=rev
Log:
moved soap interopt to interopt and make include groovy text case
Added:
webservices/axis/trunk/java/modules/integration/src/org/
webservices/axis/trunk/java/modules/integration/src/org/apache/
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/MessageComparator.java
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAP12TestClient.java
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPComparator.java
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPCreater.java
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/
webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/SimpleServer.java
Modified:
webservices/axis/trunk/java/modules/integration/project.xml
webservices/axis/trunk/java/modules/samples/src/org/apache/axis2/soap12testing/client/SOAPCreater.java
Modified: webservices/axis/trunk/java/modules/integration/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/project.xml?rev=227340&r1=227339&r2=227340&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/integration/project.xml (original)
+++ webservices/axis/trunk/java/modules/integration/project.xml Thu Aug 4 03:17:43 2005
@@ -1,252 +1,252 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
-* 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.
-*/
- -->
-<project>
- <pomVersion>3</pomVersion>
- <extend>../../etc/project.xml</extend>
-
- <id>axis2-integration</id>
- <name>integration</name>
- <description>Integration tests</description>
-
-
- <dependencies>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-core</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-samples</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-xml</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-wsdl</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>addressing</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-tools</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis2-common</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
-
-
- <!-- external JARs -->
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.3</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax</artifactId>
- <version>1.1.1-dev</version>
- <properties>
- <module>true</module>
- </properties>
- <url>http://dist.codehaus.org/stax/jars/</url>
- </dependency>
-
- <dependency>
- <groupId>groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>1.0-jsr-01</version>
- <properties>
- <module>true</module>
- </properties>
- <url>http://dist.codehaus.org/groovy/jars/</url>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.0-rc2</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.8</version>
- <properties>
- <module>true</module>
- </properties>
- <url>http://dist.codehaus.org/stax/jars/</url>
- </dependency>
-
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0</version>
- <properties>
- <module>true</module>
- </properties>
- <url>http://dist.codehaus.org/stax/jars/</url>
- </dependency>
- <dependency>
- <groupId>axis</groupId>
- <artifactId>axis-wsdl4j</artifactId>
- <version>1.2</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-javamail</artifactId>
- <version>1.3.1-rc5</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-activation</artifactId>
- <version>1.0.2-rc4</version>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
- <dependency>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- <version>2.0.0-beta1</version>
- <type>jar</type>
- <properties>
- <module>true</module>
- </properties>
- </dependency>
-
- </dependencies>
-
- <!-- build information for the project -->
- <build>
- <nagEmailAddress>axis-dev@ws.apache.org</nagEmailAddress>
- <sourceDirectory>src</sourceDirectory>
- <unitTestSourceDirectory>test</unitTestSourceDirectory>
-
- <unitTest>
-
- <excludes>
- <exclude>**/*Abstract*.java</exclude>
- <exclude>**/*Util*.java</exclude>
- <exclude>**/*InteropStubTest.java</exclude>
- <exclude>**/*Groovy*.java</exclude>
- <!-- <exclude>**/*EchoRawXMLChunckedTest.java</exclude> -->
- <exclude>**org/apache/axis2/mail/*.java</exclude>
-
-
-
- <!--
- <exclude>**/*EchoRawMTOMTest.java</exclude>
- <exclude>**/*EchoRawMTOMLoadTest.java</exclude>
- <exclude>**/*EchoRawMTOMToBase64Test.java</exclude>
-
- <exclude>**/*MTOMCommonsChunkingTest.java</exclude>
- <exclude>**/OneWayRawXMLTest.java</exclude>
-
- -->
-
- <!--
- <exclude>**/*SOAP12Test.java</exclude>
- <exclude>**/*SOAP12TestWithFaults.java</exclude>
- <exclude>**/*FaultHandlingTest.java</exclude>
-
-
- <exclude>**/*MailEchoRawXMLTest.java</exclude>
- <exclude>**/*MailOneWayRawXMLTest.java</exclude>
- <exclude>**/*MailRequestResponseRawXMLTest.java</exclude>
- <exclude>**/*CommonsHTTPEchoRawXMLTest.java</exclude>
- <exclude>**/*EchoRawMTOMTest.java</exclude>
- <exclude>**/*EchoRawMTOMLoadTest.java</exclude>
- <exclude>**/*EchoRawMTOMToBase64Test.java</exclude> -->
- </excludes>
- <includes>
- <include>**/*Test.java</include>
- </includes>
-
- <resources>
- <resource>
- <directory>${basedir}/test-resources</directory>
- </resource>
- <resource>
- <directory>conf</directory>
- <includes>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src</directory>
- <includes>
- <include>**/*.properties</include>
- <include>**/*.xml</include>
- </includes>
- </resource>
- </resources>
- </unitTest>
-
- <resources>
- <resource>
- <directory>conf</directory>
- <includes>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src</directory>
- <includes>
- <include>**/*.properties</include>
- <include>**/*.xml</include>
- </includes>
- </resource>
- <resource>
- <directory>test</directory>
- <includes>
- <include>**/*.jpg</include>
- </includes>
- </resource>
- </resources>
- </build>
-
- <reports/>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+* 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.
+*/
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+
+ <id>axis2-integration</id>
+ <name>integration</name>
+ <description>Integration tests</description>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-core</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-samples</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-xml</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-wsdl</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>addressing</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-tools</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis2-common</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+
+
+ <!-- external JARs -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.3</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>1.1.1-dev</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.0-jsr-01</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/groovy/jars/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.0-rc2</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.8</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>1.0</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <url>http://dist.codehaus.org/stax/jars/</url>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-wsdl4j</artifactId>
+ <version>1.2</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-javamail</artifactId>
+ <version>1.3.1-rc5</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-activation</artifactId>
+ <version>1.0.2-rc4</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>xmlbeans</groupId>
+ <artifactId>xbean</artifactId>
+ <version>2.0.0-beta1</version>
+ <type>jar</type>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
+ </dependencies>
+
+ <!-- build information for the project -->
+ <build>
+ <nagEmailAddress>axis-dev@ws.apache.org</nagEmailAddress>
+ <sourceDirectory>src</sourceDirectory>
+ <unitTestSourceDirectory>test</unitTestSourceDirectory>
+
+ <unitTest>
+
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ <exclude>**/*Util*.java</exclude>
+ <exclude>**/*InteropStubTest.java</exclude>
+ <!-- <exclude>**/*Groovy*.java</exclude> -->
+ <!-- <exclude>**/*EchoRawXMLChunckedTest.java</exclude> -->
+ <exclude>**org/apache/axis2/mail/*.java</exclude>
+
+
+
+ <!--
+ <exclude>**/*EchoRawMTOMTest.java</exclude>
+ <exclude>**/*EchoRawMTOMLoadTest.java</exclude>
+ <exclude>**/*EchoRawMTOMToBase64Test.java</exclude>
+
+ <exclude>**/*MTOMCommonsChunkingTest.java</exclude>
+ <exclude>**/OneWayRawXMLTest.java</exclude>
+
+ -->
+
+ <!--
+ <exclude>**/*SOAP12Test.java</exclude>
+ <exclude>**/*SOAP12TestWithFaults.java</exclude>
+ <exclude>**/*FaultHandlingTest.java</exclude>
+
+
+ <exclude>**/*MailEchoRawXMLTest.java</exclude>
+ <exclude>**/*MailOneWayRawXMLTest.java</exclude>
+ <exclude>**/*MailRequestResponseRawXMLTest.java</exclude>
+ <exclude>**/*CommonsHTTPEchoRawXMLTest.java</exclude>
+ <exclude>**/*EchoRawMTOMTest.java</exclude>
+ <exclude>**/*EchoRawMTOMLoadTest.java</exclude>
+ <exclude>**/*EchoRawMTOMToBase64Test.java</exclude> -->
+ </excludes>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+
+ <resources>
+ <resource>
+ <directory>${basedir}/test-resources</directory>
+ </resource>
+ <resource>
+ <directory>conf</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </unitTest>
+
+ <resources>
+ <resource>
+ <directory>conf</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>test</directory>
+ <includes>
+ <include>**/*.jpg</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+ <reports/>
+
+</project>
Added: webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/MessageComparator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/MessageComparator.java?rev=227340&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/MessageComparator.java (added)
+++ webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/MessageComparator.java Thu Aug 4 03:17:43 2005
@@ -0,0 +1,73 @@
+/*
+* 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.axis2.soap12testing.client;
+
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.om.impl.llom.exception.XMLComparisonException;
+import org.apache.axis2.transport.http.HTTPTransportReceiver;
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import java.io.*;
+import java.util.Map;
+
+public class MessageComparator {
+ //public static final String TEST_MAIN_DIR = "./modules/samples/";
+ public static final String TEST_MAIN_DIR = "./";
+ private Log log = LogFactory.getLog(getClass());
+
+ public boolean compare(String testNumber, InputStream replyMessage) {
+ SOAPEnvelope replyMessageEnvelope;
+ SOAPEnvelope requiredMessageEnvelope;
+ try {
+ File file = new File(TEST_MAIN_DIR+"test-resources/SOAP12Testing/ReplyMessages/SOAP12ResT" + testNumber + ".xml");
+
+ HTTPTransportReceiver receiver = new HTTPTransportReceiver();
+ Map map = receiver.parseTheHeaders(replyMessage, false);
+
+
+
+
+ XMLStreamReader requiredMessageParser = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(file));
+ OMXMLParserWrapper requiredMessageBuilder = new StAXSOAPModelBuilder(requiredMessageParser,null);
+ requiredMessageEnvelope = (SOAPEnvelope) requiredMessageBuilder.getDocumentElement();
+
+ XMLStreamReader replyMessageParser = XMLInputFactory.newInstance().createXMLStreamReader(replyMessage);
+ OMXMLParserWrapper replyMessageBuilder = new StAXSOAPModelBuilder(replyMessageParser,null);
+ replyMessageEnvelope = (SOAPEnvelope) replyMessageBuilder.getDocumentElement();
+
+ SOAPComparator soapComparator = new SOAPComparator();
+ return soapComparator.compare(requiredMessageEnvelope,replyMessageEnvelope);
+
+ } catch (XMLStreamException e) {
+ log.info(e.getMessage());
+ } catch (FileNotFoundException e) {
+ log.info(e.getMessage());
+ } catch (XMLComparisonException e) {
+ log.info(e.getMessage());
+ } catch (AxisFault axisFault) {
+ log.info(axisFault.getMessage());
+ }
+ return false;
+ }
+}
Added: webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAP12TestClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAP12TestClient.java?rev=227340&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAP12TestClient.java (added)
+++ webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAP12TestClient.java Thu Aug 4 03:17:43 2005
@@ -0,0 +1,96 @@
+/*
+* 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.axis2.soap12testing.client;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.Socket;
+import java.net.URL;
+
+public class SOAP12TestClient {
+
+ private Log log = LogFactory.getLog(getClass());
+
+ public String getReply(int port, String webserviceName,String testNumber) {
+ String replyMessage = "";
+ try {
+ URL netUrl = new URL("http://localhost:"+port+"/axis2/services/"+webserviceName+"/echo");
+
+ Socket socket = new Socket("127.0.0.1",port);
+
+// HttpURLConnection connection = (HttpURLConnection) netUrl.openConnection();
+// connection.setDoOutput(true);
+
+ SOAPCreater soapCreater = new SOAPCreater();
+ String requestMessage = soapCreater.getStringFromSOAPMessage(testNumber,netUrl);
+ PrintWriter out = new PrintWriter(
+ socket.getOutputStream());
+// connection.getOutputStream());
+ out.println(requestMessage);
+ out.flush();
+ out.close();
+
+ BufferedReader reader = new BufferedReader( new InputStreamReader(socket.getInputStream()));
+ StringBuffer sb = new StringBuffer();
+ String response = reader.readLine();
+ while( null != response ) {
+ sb.append(response.trim());
+ response = reader.readLine();
+ }
+ replyMessage = sb.toString();
+ socket.close();
+// connection.disconnect();
+
+ } catch (MalformedURLException e) {
+ log.info(e.getMessage());
+ } catch (IOException e) {
+ log.info(e.getMessage());
+ }
+ return replyMessage;
+ }
+
+ public InputStream getRelpy(int port,String webserviceName,String testNumber) {
+ try {
+ URL netUrl = new URL("http://localhost:"+port+"/axis2/services/"+webserviceName+"/echo");
+ Socket socket = new Socket("127.0.0.1",port);
+ SOAPCreater soapCreater = new SOAPCreater();
+ String requestMessage = soapCreater.getStringFromSOAPMessage(testNumber,netUrl);
+ PrintWriter out = new PrintWriter(
+ socket.getOutputStream());
+// System.out.println("Message: " + requestMessage);
+ out.println(requestMessage);
+ out.flush();
+ socket.shutdownOutput();
+ return socket.getInputStream();
+ } catch (MalformedURLException e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ } catch (IOException e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ }
+ return null;
+ }
+
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPComparator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPComparator.java?rev=227340&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPComparator.java (added)
+++ webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPComparator.java Thu Aug 4 03:17:43 2005
@@ -0,0 +1,68 @@
+/*
+* 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.
+*/
+
+/*Speacial Notice : -
+ This SOAPComparator was implementd for only SOAP 1.2 Tests. Chekings are concerend on specific
+ tests in SOAP 1.2 Testing. Therefore this can not be used for comman soap comparisons.
+*/
+
+package org.apache.axis2.soap12testing.client;
+
+import org.apache.axis2.om.impl.llom.exception.XMLComparisonException;
+import org.apache.axis2.om.impl.llom.util.XMLComparator;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFault;
+
+public class SOAPComparator extends XMLComparator {
+
+ public boolean compare(SOAPEnvelope expectedEnvelope, SOAPEnvelope ReplyEnvelope) throws XMLComparisonException {
+
+ if (expectedEnvelope.getNamespace().getName().equals(ReplyEnvelope.getNamespace().getName())) {
+ //a!=null && b==null
+ if ((expectedEnvelope.getHeader() != null && ReplyEnvelope.getHeader() != null) ||
+ (expectedEnvelope.getHeader() == null && ReplyEnvelope.getHeader() == null)) {
+
+ if (expectedEnvelope.getHeader() != null)
+ super.compare(ReplyEnvelope.getHeader(), expectedEnvelope.getHeader());
+
+ if (expectedEnvelope.getBody().hasFault()) {
+ SOAPFault replyFault = ReplyEnvelope.getBody().getFault();
+ SOAPFault expectedFault = expectedEnvelope.getBody().getFault();
+
+ super.compare(replyFault.getCode(), expectedFault.getCode());
+ super.compare(replyFault.getReason(), expectedFault.getReason());
+
+ if (expectedFault.getRole() != null) {
+ super.compare(replyFault.getRole(), expectedFault.getRole());
+ }
+ if (expectedFault.getNode() != null) {
+ super.compare(replyFault.getNode(), expectedFault.getNode());
+ }
+ if (expectedFault.getDetail() != null) {
+ super.compare(replyFault.getDetail(), expectedFault.getDetail());
+ }
+ } else {
+ super.compare(ReplyEnvelope.getBody(), expectedEnvelope.getBody());
+ }
+ } else {
+ throw new XMLComparisonException("Envelope headers mismatched...!");
+ }
+ } else {
+ throw new XMLComparisonException("Envelope namespaces mismatched...!");
+ }
+ return true;
+ }
+}
Added: webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPCreater.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPCreater.java?rev=227340&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPCreater.java (added)
+++ webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/client/SOAPCreater.java Thu Aug 4 03:17:43 2005
@@ -0,0 +1,77 @@
+/*
+* 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.axis2.soap12testing.client;
+
+import java.io.*;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axis2.om.OMXMLParserWrapper;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
+import org.apache.axis2.soap.impl.llom.soap12.SOAP12Constants;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SOAPCreater {
+
+ private Log log = LogFactory.getLog(getClass());
+ public String getStringFromSOAPMessage(String testNumber, URL url) throws IOException {
+ File file =
+ new File(
+ MessageComparator.TEST_MAIN_DIR + "test-resources/SOAP12Testing/RequestMessages/SOAP12ReqT" + testNumber + ".xml");
+ FileInputStream stream = new FileInputStream(file);
+// BufferedInputStream bf = new BufferedInputStream(stream);
+// DataInputStream ds = new DataInputStream(bf);
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(HTTPConstants.HEADER_POST).append(" ");
+ sb.append(url.getFile()).append(" ").append(HTTPConstants.HEADER_PROTOCOL_10).append("\n");
+ sb.append(HTTPConstants.HEADER_CONTENT_TYPE).append(": ").append(
+ SOAP12Constants.SOAP_12_CONTENT_TYPE);
+ sb.append("; charset=utf-8\n");
+ sb.append("\n");
+
+ String record;
+ BufferedReader reder = new BufferedReader(new InputStreamReader(stream));
+ while ((record = reder.readLine()) != null) {
+ sb.append(record.trim());
+ }
+//
+// while ((record = ds.readLine()) != null) {
+// sb.append(record.trim());
+// }
+ return sb.toString();
+ }
+
+ public SOAPEnvelope getEnvelopeFromSOAPMessage(String pathAndFileName) {
+ File file = new File(pathAndFileName);
+ try {
+ XMLStreamReader parser =
+ XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(file));
+ OMXMLParserWrapper builder = new StAXSOAPModelBuilder(parser, null);
+ return (SOAPEnvelope) builder.getDocumentElement();
+ } catch (Exception e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ }
+ return null;
+ }
+}
Added: webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/SimpleServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/SimpleServer.java?rev=227340&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/SimpleServer.java (added)
+++ webservices/axis/trunk/java/modules/integration/src/org/apache/axis2/soap12testing/server/SimpleServer.java Thu Aug 4 03:17:43 2005
@@ -0,0 +1,56 @@
+/*
+* 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.axis2.soap12testing.server;
+
+import java.io.File;
+import java.net.ServerSocket;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.soap12testing.client.MessageComparator;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class SimpleServer {
+ private int port;
+ private Log log = LogFactory.getLog(getClass());
+ public SimpleServer() {
+ this.port = 8008;
+ }
+
+ public SimpleServer(int port) {
+ this.port = port;
+ }
+
+ public void start() {
+ try {
+ ServerSocket serverSoc = null;
+ serverSoc = new ServerSocket(port);
+ File file = new File(MessageComparator.TEST_MAIN_DIR+ "target/Repository");
+ if(!file.exists()){
+ throw new AxisFault(file.getAbsolutePath() + " File does not exisits");
+ }
+ SimpleHTTPServer reciver = new SimpleHTTPServer(file.getAbsolutePath(), serverSoc);
+ Thread thread = new Thread(reciver);
+ thread.setDaemon(true);
+ thread.start();
+ } catch (Exception e) {
+ log.info(e.getMessage());
+// e.printStackTrace();
+ }
+ }
+}
Modified: webservices/axis/trunk/java/modules/samples/src/org/apache/axis2/soap12testing/client/SOAPCreater.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/samples/src/org/apache/axis2/soap12testing/client/SOAPCreater.java?rev=227340&r1=227339&r2=227340&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/samples/src/org/apache/axis2/soap12testing/client/SOAPCreater.java (original)
+++ webservices/axis/trunk/java/modules/samples/src/org/apache/axis2/soap12testing/client/SOAPCreater.java Thu Aug 4 03:17:43 2005
@@ -16,12 +16,7 @@
package org.apache.axis2.soap12testing.client;
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
+import java.io.*;
import java.net.URL;
import javax.xml.stream.XMLInputFactory;
@@ -43,8 +38,8 @@
new File(
MessageComparator.TEST_MAIN_DIR + "test-resources/SOAP12Testing/RequestMessages/SOAP12ReqT" + testNumber + ".xml");
FileInputStream stream = new FileInputStream(file);
- BufferedInputStream bf = new BufferedInputStream(stream);
- DataInputStream ds = new DataInputStream(bf);
+// BufferedInputStream bf = new BufferedInputStream(stream);
+// DataInputStream ds = new DataInputStream(bf);
StringBuffer sb = new StringBuffer();
sb.append(HTTPConstants.HEADER_POST).append(" ");
@@ -55,9 +50,14 @@
sb.append("\n");
String record;
- while ((record = ds.readLine()) != null) {
+ BufferedReader reder = new BufferedReader(new InputStreamReader(stream));
+ while ((record = reder.readLine()) != null) {
sb.append(record.trim());
}
+//
+// while ((record = ds.readLine()) != null) {
+// sb.append(record.trim());
+// }
return sb.toString();
}