axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r553397 - in /webservices/axis2/trunk/java/modules/fastinfoset: ./ src/org/apache/axis2/fastinfoset/ test-resources/ test/org/apache/axis2/fastinfoset/ test/org/apache/axis2/fastinfoset/xsd/
Date Thu, 05 Jul 2007 07:06:43 GMT
Author: deepal
Date: Thu Jul  5 00:06:42 2007
New Revision: 553397

URL: http://svn.apache.org/viewvc?view=rev&rev=553397
Log:
applying the patches  in AXIS2-2689
 - Thx Sanjaya for sending the patches 
- I have still commented the test case but once Axiom fixed WSCOMMONS-213

Added:
    webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXBuilder.java
    webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
Removed:
    webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/xsd/
Modified:
    webservices/axis2/trunk/java/modules/fastinfoset/maven.xml
    webservices/axis2/trunk/java/modules/fastinfoset/project.xml
    webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml
    webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
    webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java

Modified: webservices/axis2/trunk/java/modules/fastinfoset/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/maven.xml?view=diff&rev=553397&r1=553396&r2=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/maven.xml Thu Jul  5 00:06:42 2007
@@ -1,41 +1,64 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-  ~ Licensed to the Apache Software Foundation (ASF) under one
-  ~ or more contributor license agreements. See the NOTICE file
-  ~ distributed with this work for additional information
-  ~ regarding copyright ownership. The ASF licenses this file
-  ~ to you 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 default="jar"
-        xmlns:j="jelly:core"
-        xmlns:u="jelly:util"
-        xmlns:maven="jelly:maven"
-        xmlns:deploy="deploy"
-        xmlns:ant="jelly:ant">
-    <preGoal name="build:start">
-    		<!-- Set the Fast Infoset jar to version 1.1.x if the JVM version is 1.4.x -->
-		<j:set var="javaVersion" value="${java.specification.version}"/>
-		<j:if test="${javaVersion != 1.5}">
-			<j:set var="fastinfoset.version" value="1.1.1"/>
-		</j:if>
-		<echo message="Current Java Version is: ${java.specification.version}"/>
-		<echo message="Hence, including fastinfoset.${fastinfoset.version}.jar"/>
-    </preGoal>
-    <preGoal name="test:compile">
-        <!-- copy the required mars so that they are available on the test path -->
-		<copy file="../addressing/target/addressing-${addressing_version}.mar"
-			tofile="target/test-classes/modules/addressing-${addressing_version}.mar"/>
-    </preGoal>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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 default="jar"
+        xmlns:j="jelly:core"
+        xmlns:u="jelly:util"
+        xmlns:maven="jelly:maven"
+        xmlns:deploy="deploy"
+        xmlns:ant="jelly:ant">
+    <preGoal name="build:start">
+    		<!-- Set the Fast Infoset jar to version 1.1.x if the JVM version is 1.4.x -->
+		<j:set var="javaVersion" value="${java.specification.version}"/>
+		<j:if test="${javaVersion != 1.5}">
+			<j:set var="fastinfoset.version" value="1.1.1"/>
+		</j:if>
+		<echo message="Current Java Version is: ${java.specification.version}"/>
+		<echo message="Hence, including fastinfoset.${fastinfoset.version}.jar"/>
+    </preGoal>
+    <preGoal name="test:compile">
+        <!-- copy the required mars so that they are available on the test path -->
+		<copy file="../addressing/target/addressing-${addressing_version}.mar"
+			tofile="target/test-classes/modules/addressing-${addressing_version}.mar"/>
+    	<!-- Generate the WSDL so that it is available to generate the client stub -->
+      <ant:javac destdir="target/test-classes" debug="on">
+            <jvmarg line="${maven.junit.jvmargs}"/>
+            <classpath refid="maven.dependency.classpath"/>
+            <classpath location="${compiled.classes.dir}"/>
+            <include name="**/*SimpleAddService.java"/>
+            <src path="test/"/>
+       </ant:javac>
+    	<ant:java classname="org.apache.ws.java2wsdl.Java2WSDL" fork="true">
+    		<ant:classpath>
+    			<ant:path refid="maven.dependency.classpath"/>
+    			<ant:pathelement location="target/test-classes"/>
+    		</ant:classpath>
+    		<ant:arg line="-o target/test-classes -of SimpleAddService.wsdl -efd unqualified
-cn org.apache.axis2.fastinfoset.SimpleAddService"/>
+    	</ant:java>
+    	<!-- Let's Generate the client stub -->
+    	<ant:java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
+    		<ant:classpath>
+    			<ant:path refid="maven.dependency.classpath"/>
+    			<ant:pathelement location="target/test-classes"/>
+    		</ant:classpath>
+   		    <ant:arg line="-uri target/test-classes/SimpleAddService.wsdl -o test -S . -or"/>
+    	</ant:java>
+    </preGoal>
+</project>

Modified: webservices/axis2/trunk/java/modules/fastinfoset/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/project.xml?view=diff&rev=553397&r1=553396&r2=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/project.xml (original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/project.xml Thu Jul  5 00:06:42 2007
@@ -64,7 +64,7 @@
             </properties>
             <url>http://dist.codehaus.org/stax/jars/</url>
         </dependency>
-	<dependency>
+	    <dependency>
             <groupId>org.apache.ws.commons.axiom</groupId>
             <artifactId>axiom-api</artifactId>
             <version>${axiom.version}</version>
@@ -176,6 +176,41 @@
                 <module>true</module>
             </properties>
         </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-java2wsdl</artifactId>
+            <version>${pom.currentVersion}</version>
+            <type>jar</type>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.neethi</groupId>
+            <artifactId>neethi</artifactId>
+            <version>${neethi.version}</version>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-codegen</artifactId>
+            <version>${pom.currentVersion}</version>
+            <type>jar</type>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-adb-codegen</artifactId>
+            <version>${pom.currentVersion}</version>
+            <type>jar</type>
+            <properties>
+                <module>true</module>
+            </properties>
+        </dependency>        
     </dependencies>
 
     <reports/>

Added: webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXBuilder.java?view=auto&rev=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXBuilder.java
(added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXBuilder.java
Thu Jul  5 00:06:42 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.fastinfoset;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.impl.llom.OMNodeImpl;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.builder.Builder;
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentParser;
+
+/**
+ * @author Sanjaya Karunasena
+ * @date May 19, 2007
+ */
+
+public class FastInfosetPOXBuilder implements Builder {
+
+	private Log logger = LogFactory.getLog(FastInfosetBuilder.class);
+	
+	/**
+	 * Returns a OMElement handler to the document element of the Fast Infoset message.
+	 * 
+	 * @param inputStream InputStream to the message
+	 * @param contentType Content type of the message
+	 * @param messageContext MessageContext to be used
+	 * 
+	 * @return OMElement handler to the document element
+	 * 
+	 * @see org.apache.axis2.builder.Builder#processDocument(InputStream, String, MessageContext)
+	 */
+	public OMElement processDocument(InputStream inputStream, String contentType, 
+			MessageContext messageContext) throws AxisFault {
+		if (logger.isDebugEnabled()) {
+			logger.debug("Processing a Document with the content type: " + contentType);
+		}
+		XMLStreamReader streamReader = new StAXDocumentParser(inputStream);
+		StAXBuilder builder = new StAXOMBuilder(streamReader);
+        //TODO Check whether we need to perform any validations here...
+        OMElement element = builder.getDocumentElement();
+//        element = (OMElement) element.detach();
+//        ((OMNodeImpl) element).setParent(null);
+        return element;
+	}
+}

Added: webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java?view=auto&rev=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
(added)
+++ webservices/axis2/trunk/java/modules/fastinfoset/src/org/apache/axis2/fastinfoset/FastInfosetPOXMessageFormatter.java
Thu Jul  5 00:06:42 2007
@@ -0,0 +1,170 @@
+package org.apache.axis2.fastinfoset;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.transport.MessageFormatter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.xml.fastinfoset.stax.StAXDocumentSerializer;
+
+public class FastInfosetPOXMessageFormatter implements MessageFormatter {
+
+	private Log logger = LogFactory.getLog(FastInfosetMessageFormatter.class);
+	
+	/**
+	 * Plain Fast Infoset message formatter doesn't need to handle SOAP. Hence do nothing.
+	 * 
+	 * @see org.apache.axis2.transport.MessageFormatter#formatSOAPAction(org.apache.axis2.context.MessageContext,
org.apache.axiom.om.OMOutputFormat, java.lang.String)
+	 */
+	public String formatSOAPAction(MessageContext messageContext,
+			OMOutputFormat format, String soapAction) {
+
+		return null;
+	}
+
+	/**
+	 * Retrieves the raw bytes from the SOAP envelop.
+	 * 
+	 * @see org.apache.axis2.transport.MessageFormatter#getBytes(org.apache.axis2.context.MessageContext,
org.apache.axiom.om.OMOutputFormat)
+	 */
+	public byte[] getBytes(MessageContext messageContext, OMOutputFormat format)
+			throws AxisFault {
+		OMElement element = messageContext.getEnvelope().getBody().getFirstElement();
+		ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+		
+		try {
+			//Creates StAX document serializer which actually implements the XMLStreamWriter
+			XMLStreamWriter streamWriter = new StAXDocumentSerializer(outStream);
+			//streamWriter.writeStartDocument();
+			element.serializeAndConsume(streamWriter);
+			//TODO Looks like the SOAP envelop doesn't have a end document tag. Find out why?
+			streamWriter.writeEndDocument();
+			
+			return outStream.toByteArray();
+			
+		} catch (XMLStreamException xmlse) {
+			logger.error(xmlse.getMessage());
+			throw new AxisFault(xmlse.getMessage(), xmlse);
+		}
+	}
+
+	/**
+	 * Returns the content type
+	 * 
+	 * @see org.apache.axis2.transport.MessageFormatter#getContentType(org.apache.axis2.context.MessageContext,
org.apache.axiom.om.OMOutputFormat, java.lang.String)
+	 */
+	public String getContentType(MessageContext messageContext,
+			OMOutputFormat format, String soapAction) {
+		String contentType = (String) messageContext.getProperty(Constants.Configuration.CONTENT_TYPE);
+		String encoding = format.getCharSetEncoding();
+		
+		//FIXME Is this a right thing to do? Need to clarify with a vetarant
+		if (contentType == null) {
+			contentType = (String) messageContext.getProperty(Constants.Configuration.MESSAGE_TYPE);
+		}
+
+		if (encoding != null) {
+			contentType += "; charset=" + encoding;
+		}
+	        
+		return contentType;
+	}
+
+	/**
+	 * Returns the target address to send the response
+	 * FIXME This is very HTTP specific. What about other transport?
+	 * 
+	 * @see org.apache.axis2.transport.MessageFormatter#getTargetAddress(org.apache.axis2.context.MessageContext,
org.apache.axiom.om.OMOutputFormat, java.net.URL)
+	 */
+	public URL getTargetAddress(MessageContext messageContext,
+			OMOutputFormat format, URL targetURL) throws AxisFault {
+        String httpMethod =
+            (String) messageContext.getProperty(Constants.Configuration.HTTP_METHOD);
+
+        URL targetAddress = targetURL; //Let's initialize to this
+	    //if the http method is GET, parameters are attached to the target URL
+	    if ((httpMethod != null)
+	            && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod))
{
+	        String param = getParam(messageContext);
+	
+	        if (param.length() > 0) {
+	            String returnURLFile = targetURL.getFile() + "?" + param;
+	            try {
+	                targetAddress = 
+	                	new URL(targetURL.getProtocol(), targetURL.getHost(), targetURL.getPort(),
returnURLFile);
+	            } catch (MalformedURLException murle) {
+	            	logger.error(murle.getMessage());
+	                throw new AxisFault(murle.getMessage(), murle);
+	            }
+	        }
+	    }
+	    
+	    return targetAddress;
+	}
+
+	/**
+	 * Write the SOAP envelop to the given OutputStream.
+	 * 
+	 * @see org.apache.axis2.transport.MessageFormatter#writeTo(org.apache.axis2.context.MessageContext,
org.apache.axiom.om.OMOutputFormat, java.io.OutputStream, boolean)
+	 */
+	public void writeTo(MessageContext messageContext, OMOutputFormat format,
+			OutputStream outputStream, boolean preserve) throws AxisFault {
+		
+		OMElement element = messageContext.getEnvelope().getBody().getFirstElement();
+//        OMElement element = messageContext.getEnvelope();
+		
+		try {
+			//Create the StAX document serializer
+			XMLStreamWriter streamWriter = new StAXDocumentSerializer(outputStream);
+			streamWriter.writeStartDocument();
+			if (preserve) {
+				element.serialize(streamWriter);
+			} else {
+				element.serializeAndConsume(streamWriter);
+			}
+//			TODO Looks like the SOAP envelop doesn't have a end document tag. Find out why?
+			streamWriter.writeEndDocument();
+		} catch (XMLStreamException xmlse) {
+			logger.error(xmlse.getMessage());
+			throw new AxisFault(xmlse.getMessage(), xmlse);
+		}
+	}
+	
+	/**
+	 * Construct URL parameters like, "param1=value1&param2=value2"
+	 * FIXME This is very HTTP specific. What about other transports
+	 * 
+	 * @param messageContext
+	 * @return Formatted URL parameters
+	 */
+    private String getParam(MessageContext messageContext) {
+        
+    	OMElement dataOut = messageContext.getEnvelope().getBody().getFirstElement();
+        Iterator it = dataOut.getChildElements();
+        StringBuffer paramBuffer = new StringBuffer();
+ 
+        while (it.hasNext()) {
+            OMElement element = (OMElement) it.next();
+            String parameter = element.getLocalName() + "=" + element.getText();
+            paramBuffer.append(parameter);
+            paramBuffer.append("&");
+        }
+        //We don't need a '&' at the end
+        paramBuffer.deleteCharAt(paramBuffer.length() - 1);
+        
+        return paramBuffer.toString();
+    }
+}

Modified: webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml?view=diff&rev=553397&r1=553396&r2=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test-resources/axis2.xml Thu Jul  5 00:06:42
2007
@@ -107,6 +107,8 @@
                          class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
         <messageFormatter contentType="application/xml"
                          class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
+	<messageFormatter contentType="application/fastinfoset"
+                         class="org.apache.axis2.fastinfoset.FastInfosetPOXMessageFormatter"/>
 	<messageFormatter contentType="application/soap+fastinfoset"
                          class="org.apache.axis2.fastinfoset.FastInfosetMessageFormatter"/>
     </messageFormatters>
@@ -123,6 +125,8 @@
                          class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
         <messageBuilder contentType="multipart/form-data"
                          class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
+	<messageBuilder contentType="application/fastinfoset"
+                         class="org.apache.axis2.fastinfoset.FastInfosetPOXBuilder"/>
 	<messageBuilder contentType="application/soap+fastinfoset"
                          class="org.apache.axis2.fastinfoset.FastInfosetBuilder"/>
     </messageBuilders>

Modified: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java?view=diff&rev=553397&r1=553396&r2=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
(original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/FastInfosetTest.java
Thu Jul  5 00:06:42 2007
@@ -31,7 +31,6 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.rpc.receivers.RPCMessageReceiver;
 import org.apache.axis2.transport.http.SimpleHTTPServer;
 
 /**
@@ -55,7 +54,7 @@
 		
 		if (serverCount == 0) {
 			int port = findAvailablePort();
-//			port = 8080; //Uncomment to test with tcpmon
+			port = 8080; //Uncomment to test with tcpmon
 			target = new EndpointReference("http://127.0.0.1:" + (port)
                     + "/axis2/services/SimpleAddService");
 			
@@ -73,7 +72,7 @@
 		
 		service = AxisService.createService("org.apache.axis2.fastinfoset.SimpleAddService", 
 				server.getConfigurationContext().getAxisConfiguration());
-
+		
 		server.getConfigurationContext().getAxisConfiguration().addService(
                 service);
         
@@ -84,6 +83,7 @@
 		super.tearDown();
     	if(serverCount == 1) {
     		server.stop();
+    		serverCount = 0;
     		System.out.println("Stopped the Simple HTTP Server");
     	}
 	}
@@ -103,6 +103,24 @@
 		float result2 = client.addFloats(17.64f, 32.36f);
 		System.out.println("Output: " + result2);
 		TestCase.assertEquals(50.0f, result2, 0.0005f);
+	}
+
+
+	public void testAdd2() throws RemoteException {
+//        SimpleAddServiceClient client = new SimpleAddServiceClient(target, true); //Comment
to test with tcpmon.
+////		SimpleAddServiceClient client = new SimpleAddServiceClient(); //Uncomment to test with
tcpmon.
+////
+//		String result = client.addStrings("Hello ", "World!");
+//		System.out.println("Output: " + result);
+//		TestCase.assertEquals("Hello World!", result);
+//
+//		int result1 = client.addInts(17, 33);
+//		System.out.println("Output: " + result1);
+//		TestCase.assertEquals(50, result1);
+//
+//		float result2 = client.addFloats(17.64f, 32.36f);
+//		System.out.println("Output: " + result2);
+//		TestCase.assertEquals(50.0f, result2, 0.0005f);
 	}
 
 	private int findAvailablePort() throws SocketException, IOException {

Modified: webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java?view=diff&rev=553397&r1=553396&r2=553397
==============================================================================
--- webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java
(original)
+++ webservices/axis2/trunk/java/modules/fastinfoset/test/org/apache/axis2/fastinfoset/SimpleAddServiceClient.java
Thu Jul  5 00:06:42 2007
@@ -28,13 +28,13 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddFloats;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddFloatsResponse;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddInts;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddIntsResponse;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddStrings;
-import org.apache.axis2.fastinfoset.xsd.SimpleAddServiceStub.AddStringsResponse;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddFloats;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddFloatsResponse;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddInts;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddIntsResponse;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddStrings;
+import org.apache.axis2.fastinfoset.SimpleAddServiceStub.AddStringsResponse;
 
 /**
  * @author Sanjaya Karunasena (sanjayak@yahoo.com)
@@ -86,6 +86,26 @@
 		options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/soap+fastinfoset");
 	}
 
+	/**
+	 * Constructor used by the default JUnit test case.
+	 * 
+	 * @param target
+	 * @throws AxisFault
+	 */
+	public SimpleAddServiceClient(EndpointReference target, boolean pox) throws AxisFault {
+		ConfigurationContext context = 
+			ConfigurationContextFactory.createConfigurationContextFromFileSystem("target/test-classes",
"test-resources/axis2.xml");
+		serviceStub = new SimpleAddServiceStub(context, target.getAddress());
+		//serviceStub = new SimpleAddServiceStub();
+		ServiceClient client=  serviceStub._getServiceClient();
+		Options options = client.getOptions();
+		if (pox) {
+			options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/fastinfoset");
+		} else {
+			options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/soap+fastinfoset");
+		}
+	}
+	
 	public String addStrings(String param0, String param1) throws RemoteException {
 		AddStrings addStrings = new SimpleAddServiceStub.AddStrings();
 		addStrings.setVal1(param0);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message