whitlock 2002/10/15 06:55:31 Modified: java/test/proposals/mime MimeTest.java WSIFPort_ApacheAxis.java WSIFOperation_ApacheAxis.java java/test/inout/wsifservice Inout.wsdl DeploymentDescriptor.xml java/test/inout/wsiftypes InoutImpl.java Added: java/test/proposals/mime Mime.wsdl MimeImpl.java Mime.java DeploymentDescriptor.xml Removed: java/test/proposals/mime WSIFJmsSender.java WSIFJmsTransport.java Log: Separate out the MimeTest from the InoutTest Revision Changes Path 1.2 +15 -37 xml-axis-wsif/java/test/proposals/mime/MimeTest.java Index: MimeTest.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/MimeTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- MimeTest.java 3 Oct 2002 09:20:46 -0000 1.1 +++ MimeTest.java 15 Oct 2002 13:55:31 -0000 1.2 @@ -57,10 +57,11 @@ package proposals.mime; -import inout.wsifservice.Inout; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; import java.util.Arrays; import javax.activation.DataHandler; @@ -76,29 +77,17 @@ import util.TestUtilities; /** - * Junit test to test out the Inout test + * Junit test to test out the Mime test * @author Mark Whitlock */ public class MimeTest extends TestCase { String wsdlLocation = - TestUtilities.getWsdlPath("java\\test\\inout\\wsifservice") + "Inout.wsdl"; + TestUtilities.getWsdlPath("java\\test\\proposals\\mime") + "Mime.wsdl"; private final static String FILE = "file"; private final static String filename = TestUtilities.getWsdlPath("java\\test\\proposals\\mime") + "test.txt"; - private final static String RPC = "rpc"; - private final static String DOC = "doc"; - - private final static String SOAP = "soap"; - private final static String AXIS = "axis"; - private final static String JAVA = "java"; - private final static String NJMS = "nativeJMS"; - - private interface InoutMime extends Inout { - public String fileToString(DataHandler dh); - } - public MimeTest(String name) { super(name); } @@ -116,14 +105,10 @@ } public void testAxis() { - doit("SOAPPort", AXIS, RPC, FILE); + doit("SOAPPort", FILE); } - private void doit( - String portName, - String protocol, - String style, - String cmd) { + private void doit(String portName, String cmd) { WSIFDynamicProvider_ApacheAxis provider = new WSIFDynamicProvider_ApacheAxis(); @@ -138,19 +123,14 @@ wsdlLocation, null, null, - "http://wsifservice.inout/", - "Inout"); - - service.mapType( - new QName("http://wsiftypes.inout/", "arrayofint"), - Class.forName("[I")); + "http://proposals.mime/", + "Mime"); service.mapType( - new QName("http://wsiftypes.inout/", "datahandler"), + new QName("http://proposals.mime/", "datahandler"), DataHandler.class); - InoutMime stub = - (InoutMime) service.getStub(portName, InoutMime.class); + Mime stub = (Mime) service.getStub(portName, Mime.class); if (cmd.equals(FILE)) file(stub); @@ -163,23 +143,21 @@ e.printStackTrace(); assertTrue(false); } finally { - if (protocol.equals(SOAP) || protocol.equals(AXIS)) { - WSIFPluggableProviders.overrideDefaultProvider( - "http://schemas.xmlsoap.org/wsdl/soap/", - null); - } + WSIFPluggableProviders.overrideDefaultProvider( + "http://schemas.xmlsoap.org/wsdl/soap/", + null); } } - private void file(InoutMime stub) throws Exception { + private void file(Mime stub) throws Exception { DataHandler dh = new DataHandler(new FileDataSource(filename)); String buff = stub.fileToString(dh); compareFiles(filename, buff); } protected boolean compareFiles(String one, String buff) - throws java.io.FileNotFoundException, java.io.IOException { + throws FileNotFoundException, IOException { BufferedInputStream oneStream = null; File f1 = new File(one); 1.2 +1 -0 xml-axis-wsif/java/test/proposals/mime/WSIFPort_ApacheAxis.java Index: WSIFPort_ApacheAxis.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/WSIFPort_ApacheAxis.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- WSIFPort_ApacheAxis.java 3 Oct 2002 09:20:46 -0000 1.1 +++ WSIFPort_ApacheAxis.java 15 Oct 2002 13:55:31 -0000 1.2 @@ -96,6 +96,7 @@ import org.apache.wsif.base.WSIFDefaultPort; import org.apache.wsif.logging.Trc; import org.apache.wsif.providers.WSIFDynamicTypeMap; +import org.apache.wsif.providers.soap.apacheaxis.WSIFJmsTransport; import org.apache.wsif.util.WSIFProperties; import org.apache.wsif.util.jms.WSIFJMSDestination; import org.apache.wsif.util.jms.WSIFJMSFinder; 1.2 +1 -0 xml-axis-wsif/java/test/proposals/mime/WSIFOperation_ApacheAxis.java Index: WSIFOperation_ApacheAxis.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/proposals/mime/WSIFOperation_ApacheAxis.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- WSIFOperation_ApacheAxis.java 3 Oct 2002 09:20:46 -0000 1.1 +++ WSIFOperation_ApacheAxis.java 15 Oct 2002 13:55:31 -0000 1.2 @@ -101,6 +101,7 @@ import org.apache.wsif.logging.Trc; import org.apache.wsif.providers.WSIFDynamicTypeMap; import org.apache.wsif.providers.WSIFDynamicTypeMapping; +import org.apache.wsif.providers.soap.apacheaxis.WSIFJmsTransport; import org.apache.wsif.util.jms.WSIFJMSDestination; import org.w3c.dom.Element; 1.1 xml-axis-wsif/java/test/proposals/mime/Mime.wsdl Index: Mime.wsdl =================================================================== <?xml version="1.0" ?> <definitions targetNamespace="http://proposals.mime/" xmlns:tns="http://proposals.mime/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="FileToStringRequestMessage"> <part name="file" type="tns:datahandler"/> </message> <message name="FileToStringResponseMessage"> <part name="buff" type="xsd:string"/> </message> <!-- port type declns --> <portType name="Mime"> <operation name="fileToString"> <input name="FileToStringRequest" message="tns:FileToStringRequestMessage"/> <output name="FileToStringResponse" message="tns:FileToStringResponseMessage"/> </operation> </portType> <!-- binding declns --> <binding name="SOAPHttpBinding" type="tns:Mime"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="fileToString"> <soap:operation soapAction=""/> <input name="FileToStringRequest"> <mime:multipartRelated> <mime:part> <mime:content part="file" type="text/html"/> <soap:body use="encoded" namespace="http://proposals.mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </mime:part> </mime:multipartRelated> </input> <output name="FileToStringResponse"> <soap:body use="encoded" namespace="http://proposals.mime/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <!-- service decln --> <service name="MimeService"> <port name="SOAPPort" binding="tns:SOAPHttpBinding"> <soap:address location="http://localhost:8080/soap/servlet/rpcrouter"/> </port> </service> </definitions> 1.1 xml-axis-wsif/java/test/proposals/mime/MimeImpl.java Index: MimeImpl.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002 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 "WSIF" 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, 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 and was * originally based on software copyright (c) 2001, 2002, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package proposals.mime; import java.io.IOException; import java.io.InputStream; import javax.activation.DataHandler; /** * Mime service used by MimeTest * @author Mark Whitlock */ public class MimeImpl implements Mime { public String fileToString(DataHandler dh) { try { InputStream is = dh.getInputStream(); byte[] bBuff = new byte[is.available()]; is.read(bBuff); String sBuff = new String(bBuff); return sBuff; } catch (IOException ioe) { return null; } } } 1.1 xml-axis-wsif/java/test/proposals/mime/Mime.java Index: Mime.java =================================================================== /* * The Apache Software License, Version 1.1 * * * Copyright (c) 2002 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 "WSIF" 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 [EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, 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 and was * originally based on software copyright (c) 2001, 2002, International * Business Machines, Inc., http://www.apache.org. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */ package proposals.mime; import javax.activation.DataHandler; public interface Mime { public String fileToString(DataHandler dh); } 1.1 xml-axis-wsif/java/test/proposals/mime/DeploymentDescriptor.xml Index: DeploymentDescriptor.xml =================================================================== <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="http://proposals.mime/"> <isd:provider type="java" scope="Application" methods="fileToString"> <isd:java class="proposals.mime.MimeImpl" static="false"/> </isd:provider> <isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListener> <isd:mappings> <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:x="http://proposals.mime/" qname="x:datahandler" javaType="javax.activation.DataHandler" java2XMLClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" xml2JavaClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" /> </isd:mappings> </isd:service> 1.6 +0 -46 xml-axis-wsif/java/test/inout/wsifservice/Inout.wsdl Index: Inout.wsdl =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/inout/wsifservice/Inout.wsdl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Inout.wsdl 3 Oct 2002 09:20:46 -0000 1.5 +++ Inout.wsdl 15 Oct 2002 13:55:31 -0000 1.6 @@ -9,7 +9,6 @@ xmlns:jms="http://schemas.xmlsoap.org/wsdl/jms/" xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/" xmlns:java="http://schemas.xmlsoap.org/wsdl/java/" - xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <!-- type defs --> @@ -122,14 +121,6 @@ <part name="type" type="xsd:string"/> </message> - <message name="FileToStringRequestMessage"> - <part name="file" type="typeions:datahandler"/> - </message> - - <message name="FileToStringResponseMessage"> - <part name="buff" type="xsd:string"/> - </message> - <!-- port type declns --> <portType name="Inout"> <operation name="addEntry"> @@ -194,12 +185,6 @@ <output name="WhoamiAddressResponse" message="tns:WhoamiAddressResponseMessage"/> </operation> - <operation name="fileToString"> - <input name="FileToStringRequest" - message="tns:FileToStringRequestMessage"/> - <output name="FileToStringResponse" - message="tns:FileToStringResponseMessage"/> - </operation> </portType> <portType name="InoutDoc"> @@ -374,24 +359,6 @@ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> - <operation name="fileToString"> - <soap:operation soapAction=""/> - <input name="FileToStringRequest"> - <mime:multipartRelated> - <mime:part> - <mime:content part="file" type="text/html"/> - <soap:body use="encoded" - namespace="http://wsifservice.inout/" - encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> - </mime:part> - </mime:multipartRelated> - </input> - <output name="FileToStringResponse"> - <soap:body use="encoded" - namespace="http://wsifservice.inout/" - encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> - </output> - </operation> </binding> <binding name="SOAPJmsBinding" type="tns:Inout"> @@ -525,19 +492,6 @@ encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output name="WhoamiAddressResponse"> - <soap:body use="encoded" - namespace="http://wsifservice.inout/" - encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> - </output> - </operation> - <operation name="fileToString"> - <soap:operation soapAction=""/> - <input name="FileToStringRequest"> - <soap:body use="encoded" - namespace="http://wsifservice.inout/" - encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> - </input> - <output name="FileToStringResponse"> <soap:body use="encoded" namespace="http://wsifservice.inout/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> 1.4 +1 -7 xml-axis-wsif/java/test/inout/wsifservice/DeploymentDescriptor.xml Index: DeploymentDescriptor.xml =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/inout/wsifservice/DeploymentDescriptor.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- DeploymentDescriptor.xml 3 Oct 2002 09:20:46 -0000 1.3 +++ DeploymentDescriptor.xml 15 Oct 2002 13:55:31 -0000 1.4 @@ -2,7 +2,7 @@ id="http://wsifservice.inout/"> <isd:provider type="java" scope="Application" - methods="addEntry getAddressFromName addNumbers getDate whoami fileToString"> + methods="addEntry getAddressFromName addNumbers getDate whoami"> <isd:java class="inout.wsiftypes.InoutImpl" static="false"/> </isd:provider> @@ -33,11 +33,5 @@ javaType="[I" java2XMLClassName="org.apache.soap.encoding.soapenc.ArraySerializer" xml2JavaClassName="org.apache.soap.encoding.soapenc.ArraySerializer" /> - <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" - xmlns:x="http://wsiftypes.inout/" - qname="x:datahandler" - javaType="javax.activation.DataHandler" - java2XMLClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" - xml2JavaClassName="org.apache.soap.encoding.soapenc.MimePartSerializer" /> </isd:mappings> </isd:service> 1.3 +0 -16 xml-axis-wsif/java/test/inout/wsiftypes/InoutImpl.java Index: InoutImpl.java =================================================================== RCS file: /home/cvs/xml-axis-wsif/java/test/inout/wsiftypes/InoutImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InoutImpl.java 3 Oct 2002 09:20:46 -0000 1.2 +++ InoutImpl.java 15 Oct 2002 13:55:31 -0000 1.3 @@ -58,14 +58,10 @@ package inout.wsiftypes; import inout.wsifservice.Inout; -import java.io.IOException; -import java.io.InputStream; import java.util.Date; import java.util.Hashtable; import java.util.Iterator; -import javax.activation.DataHandler; - import util.AddressUtility; import addressbook.wsiftypes.Address; @@ -175,17 +171,5 @@ } public String whoami(Address a) { return new String("Address"); - } - - public String fileToString(DataHandler dh) { - try { - InputStream is = dh.getInputStream(); - byte[] bBuff = new byte[is.available()]; - is.read(bBuff); - String sBuff = new String(bBuff); - return sBuff; - } catch (IOException ioe) { - return null; - } } }