axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wood...@apache.org
Subject svn commit: r633234 [3/24] - in /webservices/axis2/trunk/java: ./ modules/jaxws-integration/ modules/jaxws-integration/test/ modules/jaxws-integration/test/client/ modules/jaxws-integration/test/org/ modules/jaxws-integration/test/org/apache/ modules/j...
Date Mon, 03 Mar 2008 18:48:24 GMT
Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/attachments/MTOMSerializationTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,189 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.attachments;
+
+import java.awt.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+
+import javax.activation.DataHandler;
+import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.imageio.stream.FileImageInputStream;
+import javax.imageio.stream.ImageInputStream;
+import javax.xml.bind.JAXBContext;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
+import org.apache.axis2.jaxws.message.Block;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.message.Protocol;
+import org.apache.axis2.jaxws.message.databinding.JAXBBlockContext;
+import org.apache.axis2.jaxws.message.factory.BlockFactory;
+import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
+import org.apache.axis2.jaxws.message.factory.MessageFactory;
+import org.apache.axis2.jaxws.provider.DataSourceImpl;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+import org.apache.axis2.jaxws.TestLogger;
+import org.test.mtom.ImageDepot;
+import org.test.mtom.ObjectFactory;
+import org.test.mtom.SendImage;
+
+public class MTOMSerializationTests extends TestCase {
+
+    private DataSource imageDS;
+    
+    public void setUp() throws Exception {
+        String imageResourceDir = System.getProperty("basedir",".")+"/"+"test-resources"+File.separator+"image";
+        
+        //Create a DataSource from an image 
+        File file = new File(imageResourceDir+File.separator+"test.jpg");
+        ImageInputStream fiis = new FileImageInputStream(file);
+        Image image = ImageIO.read(fiis);
+        imageDS = new DataSourceImpl("image/jpeg","test.jpg",image);
+    }
+    
+    public MTOMSerializationTests(String name) {
+        super(name);
+    }
+    
+    /*
+     * Simulate building up an OM that is sourced from JAXB and contains
+     * binary data that should be optimized when serialized.  
+     */
+    public void testPlainOMSerialization() throws Exception {
+        TestLogger.logger.debug("---------------------------------------");
+        TestLogger.logger.debug("test: " + getName());
+        
+        OMElement payload = createPayload();
+        
+        OMOutputFormat format = new OMOutputFormat();
+        format.setDoOptimize(true);
+        format.setSOAP11(true);
+               
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        payload.serializeAndConsume(baos, format);
+
+        TestLogger.logger.debug("==================================");
+        TestLogger.logger.debug(baos.toString());
+        TestLogger.logger.debug("==================================");
+    }
+    
+    /*
+     * Simulate building up an OM SOAPEnvelope that has the contents of
+     * the body sourced from JAXB and contains binary data that should be 
+     * optimized when serialized.  
+     */
+    public void testSoapOMSerialization() throws Exception {
+        TestLogger.logger.debug("---------------------------------------");
+        TestLogger.logger.debug("test: " + getName());
+        
+        OMElement payload = createPayload();
+        
+        SOAPFactory factory = new SOAP11Factory();
+        SOAPEnvelope env = factory.createSOAPEnvelope();
+        SOAPBody body = factory.createSOAPBody(env);
+        
+        body.addChild(payload);
+        
+        OMOutputFormat format = new OMOutputFormat();
+        format.setDoOptimize(true);
+        format.setSOAP11(true);
+               
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        env.serializeAndConsume(baos, format);
+
+        TestLogger.logger.debug("==================================");
+        TestLogger.logger.debug(baos.toString());
+        TestLogger.logger.debug("==================================");
+    }
+    
+    public void testMTOMAttachmentWriter() throws Exception {
+        TestLogger.logger.debug("---------------------------------------");
+        TestLogger.logger.debug("test: " + getName());
+        
+        //Create a DataHandler with the String DataSource object
+        DataHandler dataHandler = new DataHandler(imageDS);
+                        
+        //Store the data handler in ImageDepot bean
+        ImageDepot imageDepot = new ObjectFactory().createImageDepot();
+        imageDepot.setImageData(dataHandler);
+        
+        //JAXBContext jbc = JAXBContext.newInstance("org.test.mtom");
+        JAXBBlockContext context = new JAXBBlockContext(SendImage.class.getPackage().getName());
+        
+        //Create a request bean with imagedepot bean as value
+        ObjectFactory factory = new ObjectFactory();
+        SendImage request = factory.createSendImage();
+        request.setInput(imageDepot);
+        
+        BlockFactory blkFactory = (JAXBBlockFactory) FactoryRegistry.getFactory(JAXBBlockFactory.class);
+        Block block = blkFactory.createFrom(request, context, null);
+        
+        MessageFactory msgFactory = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
+        Message msg = msgFactory.create(Protocol.soap11);
+        
+        msg.setBodyBlock(block);
+        
+        msg.setMTOMEnabled(true);
+        
+        SOAPEnvelope soapOM = (SOAPEnvelope) msg.getAsOMElement();
+        
+        OMOutputFormat format = new OMOutputFormat();
+        format.setDoOptimize(true);
+        format.setSOAP11(true);
+               
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        soapOM.serializeAndConsume(baos, format);
+
+        TestLogger.logger.debug("==================================");
+        TestLogger.logger.debug(baos.toString());
+        TestLogger.logger.debug("==================================");
+    }
+    
+    private OMElement createPayload() {
+        //Create a DataHandler with the String DataSource object
+        DataHandler dataHandler = new DataHandler(imageDS);
+                        
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("urn://mtom.test.org", "mtom");
+        
+        OMElement sendImage = fac.createOMElement("sendImage", omNs);
+        
+        OMElement input = fac.createOMElement("input", omNs);
+        sendImage.addChild(input);
+        
+        OMElement imageData = fac.createOMElement("imageData", omNs);
+        input.addChild(imageData);
+        
+        OMText binaryData = fac.createOMText(dataHandler, true);
+        imageData.addChild(binaryData);
+        
+        return sendImage;
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,147 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.catalog;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.PortType;
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
+import org.apache.axis2.jaxws.util.WSDL4JWrapper;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the use of the Apache Commons Resolver API to resolve URIs.
+ */
+public class MultiRedirectionCatalogTest extends TestCase {
+	private static final String ROOT_WSDL = "/test-resources/catalog/root.wsdl";
+	private static final String TEST_RESOURCES = "/test-resources/catalog/";
+	
+	public void testOneCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "basic-catalog.xml");
+	}
+
+	public void testNextCatalogSuccess() {
+		verifySuccess(ROOT_WSDL, TEST_RESOURCES + "root-catalog.xml");
+	}
+	
+	public void testNextCatalogFailure() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/root-catalog.xml");		
+	}
+	
+	public void testNoCatEntryForFirstImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/firstImportFail.xml");
+	}
+	
+	public void testNoCatEntryForSecondImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/secondImportFail.xml");
+	}
+	
+	public void testNoCatEntryForThirdImport() {
+		verifyFailure(ROOT_WSDL, TEST_RESOURCES + "fail/thirdImportFail.xml");
+	}
+	
+	/**
+	 * Ensure that the catalog is used to locate imported resources.
+	 */
+	private void verifySuccess(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+			catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+            WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
+	    	Definition wsdlDef = w4j.getDefinition();
+	    	assertNotNull(wsdlDef);   
+	    	QName portTypeName = new QName("http://www.example.com/test/calculator",
+	    			                       "CalculatorService",
+	    			                       "");
+	    	PortType portType = wsdlDef.getPortType(portTypeName);
+	    	assertNotNull(portType);
+	    	Operation clearOp = portType.getOperation("clear", null, null);
+	    	assertNotNull(clearOp);
+	    	Input clearOpInput = clearOp.getInput();
+	    	assertNotNull(clearOpInput);
+	    	Message msg = clearOpInput.getMessage();
+	    	assertNotNull(msg);
+	    	Part expectedPart = msg.getPart("part1");
+            assertNotNull(expectedPart);
+	    }catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}	
+	
+	/**
+	 * Ensure that the test case is valid by failing in the absence of a needed
+	 * catalog entry.
+	 */
+	private void verifyFailure(String wsdlLocation, String catalogFile) {
+	    URL url = getURLFromLocation(wsdlLocation);
+	    
+	    try{
+			OASISCatalogManager catalogManager = new OASISCatalogManager();
+            catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
+	    	WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager);
+	    	w4j.getDefinition();
+	    	fail("Should have received a WSDLException due to the invalid WSDL location " 
+	        		+ "not redirected by the catalog.");
+	    } catch(WSDLException e) {
+	    	// do nothing - successful test case
+	    } catch(Exception e){
+	    	e.printStackTrace();
+	    	fail();
+	    }
+	}
+	
+	/**
+	 * Given a String representing a file location, return a URL.
+	 * @param wsdlLocation
+	 * @return
+	 */
+	private URL getURLFromLocation(String wsdlLocation) {
+		URL url = null;
+	    try {
+	    	try{
+	        	String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+	        	wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+        	}catch(Exception e){
+        		e.printStackTrace();
+        		fail();
+        	}
+	       	File file = new File(wsdlLocation);
+	       	url = file.toURL();
+	    } catch (MalformedURLException e) {
+	        e.printStackTrace();
+	        fail();
+	    }
+	    
+	    return url;
+	}
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/XMLCatalogTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/XMLCatalogTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/XMLCatalogTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/catalog/XMLCatalogTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.catalog;
+
+import java.io.File;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager;
+import org.apache.axis2.jaxws.util.CatalogURIResolver;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.w3c.dom.Document;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests the use of the Apache Commons Resolver API to resolve URIs.
+ */
+public class XMLCatalogTests extends TestCase {
+	private static final String TEST_RESOURCES = "test-resources/catalog/";
+	private static final String BASIC_CATALOG = TEST_RESOURCES + "basic-catalog.xml";
+	private static final String IMPORT_BASE = TEST_RESOURCES + "importBase.xsd";
+	private static final String IMPORT_BAD = TEST_RESOURCES + "importBad.xsd";	
+
+    /**
+     * Verify that all the expected conditions are met (the control case).
+     * @throws Exception
+     */
+    public void testSchemaImportNoCatalogNoNeed() throws Exception{
+        File file = new File(IMPORT_BASE);
+        //create a DOM document
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        Document doc = documentBuilderFactory.newDocumentBuilder().
+                parse(file.toURL().toString());
+
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
+        assertNotNull(schema);
+
+        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
+        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
+    }
+    
+    /**
+     * Verify that the element is not present when using IMPORT_BAD in the 
+     * absence of a CatalogManager.
+     * @throws Exception
+     */
+    public void testSchemaImportCatalogNeedNotPresent() throws Exception{
+        File file = new File(IMPORT_BAD);
+        //create a DOM document
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        Document doc = documentBuilderFactory.newDocumentBuilder().
+                parse(file.toURL().toString());
+
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
+        assertNotNull(schema);
+
+        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
+        assertNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
+    }
+    
+    /**
+     * Verify that the element is present using IMPORT_BAD if the XML Resolver 
+     * is used.  This test is for a simple, single-file catalog.
+     * @throws Exception
+     */
+    public void testSchemaImportBasicCatalog() throws Exception{
+		OASISCatalogManager catalogManager = new OASISCatalogManager();
+		catalogManager.setCatalogFiles(BASIC_CATALOG);
+		
+        File file = new File(IMPORT_BAD);
+        //create a DOM document
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        Document doc = documentBuilderFactory.newDocumentBuilder().
+                parse(file.toURL().toString());
+
+        XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        schemaCol.setSchemaResolver(new CatalogURIResolver(catalogManager));
+        XmlSchema schema = schemaCol.read(doc,file.toURL().toString(),null);
+        assertNotNull(schema);
+
+        assertNotNull(schema.getTypeByName(new QName("http://soapinterop.org/xsd2","SOAPStruct")));
+        assertNotNull(schema.getElementByName(new QName("http://soapinterop.org/xsd2","SOAPWrapper")));
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ClientConfigTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ClientConfigTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ClientConfigTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ClientConfigTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.WebServiceException;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.TestLogger;
+
+public class ClientConfigTests extends TestCase {
+
+    public ClientConfigTests(String name) {
+        super(name);
+    }
+    
+    public void testBadWsdlUrl() throws Exception {
+        
+        URL url = null;
+        String wsdlLocation = null;
+        try {
+            try{
+                String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+                wsdlLocation = new File(baseDir + "/test-resources/wsdl/BadEndpointAddress.wsdl").getAbsolutePath();
+            }catch(Exception e){
+                e.printStackTrace();
+            }
+            File file = new File(wsdlLocation);
+            url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        
+        Service svc = Service.create(url, new QName("http://jaxws.axis2.apache.org", "EchoService"));
+        Dispatch dispatch = svc.createDispatch(new QName("http://jaxws.axis2.apache.org", "EchoPort"), 
+                String.class, Mode.PAYLOAD);
+        
+        try {
+            dispatch.invoke("");
+            
+            // If an exception wasn't thrown, then it's an error.
+            fail();
+        } catch (WebServiceException e) {
+            // We should only get a WebServiceException here.  Anything else
+            // is a failure.
+            TestLogger.logger.debug("[pass] - the proper fault type was thrown");
+        }
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/DispatchSoapActionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/DispatchSoapActionTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/DispatchSoapActionTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/DispatchSoapActionTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,82 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service.Mode;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.BindingProvider;
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.jaxws.client.soapaction.BookStoreService;
+import org.apache.axis2.jaxws.client.soapaction.GetPriceResponseType;
+import org.apache.axis2.jaxws.client.soapaction.GetPriceType;
+import org.apache.axis2.jaxws.client.soapaction.ObjectFactory;
+
+/**
+ * A suite of SOAPAction related tests for the dispatch client 
+ */
+public class DispatchSoapActionTests extends TestCase {
+    
+    private static final String targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction";
+    private static final String portName = "BookStorePort";
+        
+    /**
+     * Invoke an operation this is defined in the WSDL as having a SOAPAction.
+     * Since this is a Dispatch client, we'll need to specify that SOAPAction
+     * ourselves for the invoke.
+     */
+    public void testSendRequestWithSoapAction() throws Exception {
+        TestLogger.logger.debug("----------------------------------");
+        TestLogger.logger.debug("test: " + getName());
+        
+        BookStoreService service = new BookStoreService();
+        
+        JAXBContext ctx = JAXBContext.newInstance("org.apache.axis2.jaxws.client.soapaction");
+        Dispatch dispatch = service.createDispatch(new QName(targetNamespace, portName), 
+                ctx, Mode.PAYLOAD);
+        
+        Map<String, Object> requestCtx = dispatch.getRequestContext();
+        requestCtx.put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
+        requestCtx.put(BindingProvider.SOAPACTION_URI_PROPERTY, "http://jaxws.axis2.apache.org/client/soapaction/getPrice");
+        
+        ObjectFactory of = new ObjectFactory();
+        GetPriceType gpt = of.createGetPriceType();
+        gpt.setItem("TEST");
+        
+        // The element that is sent should be <getPriceWithAction>
+        // so it will resolve to the getPriceWithAction operation
+        // defined in the WSDL.
+        JAXBElement<GetPriceType> getPrice = of.createGetPriceWithAction(gpt);
+        JAXBElement<GetPriceResponseType> getPriceResponse = (JAXBElement<GetPriceResponseType>) dispatch.invoke(getPrice);
+        
+        GetPriceResponseType value = getPriceResponse.getValue();
+        assertNotNull("The response was null", value);
+        
+        float price = value.getPrice();
+        TestLogger.logger.debug("return value [" + price + "]");
+        //assertTrue("The return value was invalid", price > 0);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/InterceptableClientTestCase.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import org.apache.axis2.jaxws.core.controller.InvocationControllerFactory;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+
+import junit.framework.TestCase;
+
+/**
+ * This TestCase can be extended to write JAX-WS client side unit tests without 
+ * having to have an end-to-end test.  The <source>TestClientInvocationController</source>
+ * will be used to capture the request.  
+ */
+public class InterceptableClientTestCase extends TestCase {
+
+    private InvocationControllerFactory oldFactory;
+    private TestClientInvocationControllerFactory newFactory;
+    private TestClientInvocationController testController;
+    
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        InvocationControllerFactory icf = (InvocationControllerFactory) FactoryRegistry.getFactory(InvocationControllerFactory.class);
+        oldFactory = icf;
+        
+        testController = new TestClientInvocationController();
+        
+        newFactory = new TestClientInvocationControllerFactory();
+        newFactory.setInvocationController(testController);
+        
+        FactoryRegistry.setFactory(InvocationControllerFactory.class, newFactory);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+
+        FactoryRegistry.setFactory(InvocationControllerFactory.class, oldFactory);
+    }
+    
+    protected TestClientInvocationController getInvocationController() {
+        return testController;
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/PropertyValueTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/PropertyValueTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/PropertyValueTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/PropertyValueTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.WebServiceException;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.TestLogger;
+
+/**
+ * A suite to test the validation of the client request/response context properties
+ */
+public class PropertyValueTests extends TestCase {
+    
+    public PropertyValueTests(String name) {
+        super(name);
+    }
+    
+    public void testSetInvalidClientProperties() throws Exception {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        QName portQName = new QName("http://test", "TestPort");
+        svc.addPort(portQName, null, null);
+        Dispatch dispatch = svc.createDispatch(portQName, String.class, Mode.PAYLOAD);
+        
+        Map<String, Object> map = dispatch.getRequestContext();
+        
+        try {
+            map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, new Integer(4));
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+
+        try {
+            map.put(BindingProvider.USERNAME_PROPERTY, new Integer(4));
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+        
+        try {
+            map.put(BindingProvider.PASSWORD_PROPERTY, new Integer(4));
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+
+        try {
+            map.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, "true");
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+        
+        try {
+            map.put(BindingProvider.SOAPACTION_USE_PROPERTY, "true");
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+
+        try {
+            map.put(BindingProvider.SOAPACTION_URI_PROPERTY, new Integer(4));
+            fail();
+        }
+        catch (WebServiceException wse) {
+            TestLogger.logger.debug("[pass] - exception thrown as expected");
+        }
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ProxySoapActionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ProxySoapActionTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ProxySoapActionTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/ProxySoapActionTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.client.soapaction.BookStore;
+import org.apache.axis2.jaxws.client.soapaction.BookStoreService;
+import org.apache.axis2.jaxws.TestLogger;
+
+/**
+ * A suite of SOAPAction related tests for the dynamic proxy client 
+ */
+public class ProxySoapActionTests extends TestCase {
+    
+    public ProxySoapActionTests(String name) {
+        super(name);
+    }
+    
+    public void testSendRequestWithSoapAction() {
+        TestLogger.logger.debug("----------------------------------");
+        TestLogger.logger.debug("test: " + getName());
+
+        BookStoreService service = new BookStoreService();
+        BookStore bs = service.getBookStorePort();
+        
+        float price = bs.getPriceWithAction("test item");
+        TestLogger.logger.debug("return value [" + price + "]");
+        //assertTrue("The return value was invalid", price > 0);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationController.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationController.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationController.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.core.controller.InvocationController;
+
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Response;
+
+import java.util.concurrent.Future;
+
+public class TestClientInvocationController implements InvocationController {
+
+    private InvocationContext cachedCtx;
+    
+    public InvocationContext invoke(InvocationContext ic) {
+        cachedCtx = ic;
+        
+        MessageContext request = ic.getRequestMessageContext();        
+        MessageContext response = new MessageContext();
+        
+        response.setEndpointDescription(request.getEndpointDescription());
+        response.setMessage(request.getMessage());        
+        
+        ic.setResponseMessageContext(response);
+        return ic;
+    }
+
+    public Future<?> invokeAsync(InvocationContext ic, AsyncHandler asyncHandler) {
+        cachedCtx = ic;
+        return null;
+    }
+
+    public Response invokeAsync(InvocationContext ic) {
+        cachedCtx = ic;
+        return null;
+    }
+
+    public void invokeOneWay(InvocationContext ic) throws Exception {
+        cachedCtx = ic;
+
+    }
+    
+    public InvocationContext getInvocationContext() {
+        return cachedCtx;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationControllerFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationControllerFactory.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationControllerFactory.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/TestClientInvocationControllerFactory.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client;
+
+import org.apache.axis2.jaxws.core.controller.InvocationController;
+import org.apache.axis2.jaxws.core.controller.InvocationControllerFactory;
+
+public class TestClientInvocationControllerFactory implements InvocationControllerFactory {
+    
+    private InvocationController ic;
+    
+    public InvocationController getInvocationController() {
+        if (ic != null)
+            return ic;
+        else 
+            return new TestClientInvocationController();
+    }
+    
+    public void setInvocationController(InvocationController inst) {
+        ic = inst;
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/DispatchMTOMFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/DispatchMTOMFeatureTest.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/DispatchMTOMFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/DispatchMTOMFeatureTest.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,185 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client.dispatch;
+
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
+/**
+ * This suite of tests is for the MTOMFeature configuration that can
+ * be used on Dispatch clients.
+ */
+public class DispatchMTOMFeatureTest extends InterceptableClientTestCase {
+
+    /*
+     * Make sure MTOM is not enabled by default.
+     */
+    public void testNoMTOMFeature() {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), Source.class, Service.Mode.PAYLOAD);
+        
+        SOAPBinding sb = (SOAPBinding) d.getBinding();
+        assertTrue("SOAPBinding should not be null.", sb != null);
+        assertTrue("MTOM should not be enabled on the binding by default.", !sb.isMTOMEnabled());
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("Request should not be null.", request != null);
+        assertFalse("MTOM should not be enabled by default.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the default configuration of the MTOMFeature.
+     */
+    public void testDefaultMTOMFeature() {
+        // Use the default feature config
+        MTOMFeature feature = new MTOMFeature();
+        
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
+            Source.class, Service.Mode.PAYLOAD, feature);
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("MTOM should be enabled via the MTOMFeature.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test disabling the MTOM feature.
+     */
+    public void testDisabledMTOMFeature() {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        
+        // Set the feature to be disabled.
+        MTOMFeature feature = new MTOMFeature(false);
+                
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
+            Source.class, Service.Mode.PAYLOAD, feature);
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertFalse("MTOM should be disabled via the MTOMFeature.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the configuration of the threshold for MTOM when no attachment is 
+     * specified.  In this case, although enabled per the MTOMFeature, MTOM should
+     * not be enabled on the Message, since the attachment size is too small.
+     */
+    public void testMTOMFeatureThresholdWithNoAttachment() {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        
+        // Set the feature to be disabled.
+        int threshold = 20000;
+        MTOMFeature feature = new MTOMFeature(threshold);
+                
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
+            Source.class, Service.Mode.PAYLOAD, feature);
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertFalse("MTOM should not be enabled.  The threshold was not exceeded.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the configuration of the threshold for MTOM when an attachment is specified.
+     * In this case, MTOM should be enabled on the Message if the attachment specified is
+     * larger than the threshold.
+     */
+    public void testMTOMFeatureThresholdWithAttachment() {
+        
+    }
+    
+    /*
+     * Test the co-existence of an MTOMFeature and a MTOM binding type for a client.
+     */
+    public void testMTOMFeatureAndBinding() {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_MTOM_BINDING, "http://localhost");
+        
+        // Use the default feature config
+        MTOMFeature feature = new MTOMFeature();
+        
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
+            Source.class, Service.Mode.PAYLOAD, feature);
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("MTOM should be enabled via the MTOMFeature.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the override of an MTOM binding by disabling MTOM via the MTOMFeature.
+     */
+    public void testMTOMFeatureAndBindingOverride() {
+        Service svc = Service.create(new QName("http://test", "TestService"));
+        svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_MTOM_BINDING, "http://localhost");
+        
+        // Use the default feature config
+        MTOMFeature feature = new MTOMFeature(false);
+        
+        Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
+            Source.class, Service.Mode.PAYLOAD, feature);
+        
+        d.invoke(null);
+        
+        TestClientInvocationController testController = getInvocationController();
+        
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertFalse("MTOM should be disabled via the MTOMFeature.", request.getMessage().isMTOMEnabled());        
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/InvocationControllerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/InvocationControllerTest.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/InvocationControllerTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/dispatch/InvocationControllerTest.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,78 @@
+package org.apache.axis2.jaxws.client.dispatch;
+
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.controller.InvocationController;
+import org.apache.axis2.jaxws.core.controller.InvocationControllerFactory;
+import org.apache.axis2.jaxws.core.controller.impl.AxisInvocationController;
+import org.apache.axis2.jaxws.core.controller.impl.InvocationControllerFactoryImpl;
+import org.apache.axis2.jaxws.registry.FactoryRegistry;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Response;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPBinding;
+
+import java.util.concurrent.Future;
+
+import junit.framework.TestCase;
+
+public class InvocationControllerTest extends TestCase {
+
+    private QName svcQname = new QName("http://test", "TestService");
+    private QName portQname = new QName("http://test", "TestPort");
+    
+    public void testDefaultInvocationController() {
+        Service svc = Service.create(svcQname);
+        svc.addPort(portQname, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        Dispatch d = svc.createDispatch(portQname, Source.class, Service.Mode.PAYLOAD);
+        
+        BaseDispatch bd = (BaseDispatch) d;
+        
+        assertTrue("An InvocationController instance was not created", bd.ic != null);
+        assertTrue("The default InvocationController type was incorrect.", 
+            AxisInvocationController.class.isAssignableFrom(bd.ic.getClass()));
+    }
+    
+    public void testPluggableInvocationController() {
+        FactoryRegistry.setFactory(InvocationControllerFactory.class, new TestInvocationControllerFactory());
+        
+        Service svc = Service.create(svcQname);
+        svc.addPort(portQname, SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
+        Dispatch d = svc.createDispatch(portQname, Source.class, Service.Mode.PAYLOAD);
+        
+        BaseDispatch bd = (BaseDispatch) d;
+        
+        // Set it back to the default so we don't break other tests.
+        FactoryRegistry.setFactory(InvocationControllerFactory.class, new InvocationControllerFactoryImpl());
+        
+        assertTrue("An InvocationController instance was not created", bd.ic != null);
+        assertTrue("The default InvocationController type was incorrect.", 
+            TestInvocationController.class.isAssignableFrom(bd.ic.getClass()));
+    }
+}
+
+class TestInvocationControllerFactory implements InvocationControllerFactory {
+    public InvocationController getInvocationController() {
+        return new TestInvocationController(); 
+    }
+}
+
+class TestInvocationController implements InvocationController {
+
+    public InvocationContext invoke(InvocationContext ic) {
+        return null;
+    }
+
+    public Future<?> invokeAsync(InvocationContext ic, AsyncHandler asyncHandler) {
+        return null;
+    }
+
+    public Response invokeAsync(InvocationContext ic) {
+        return null;
+    }
+
+    public void invokeOneWay(InvocationContext ic) throws Exception {}    
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/proxy/ProxyMTOMFeatureTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/proxy/ProxyMTOMFeatureTest.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/proxy/ProxyMTOMFeatureTest.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/proxy/ProxyMTOMFeatureTest.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,136 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client.proxy;
+
+import org.apache.axis2.jaxws.client.InterceptableClientTestCase;
+import org.apache.axis2.jaxws.client.TestClientInvocationController;
+import org.apache.axis2.jaxws.core.InvocationContext;
+import org.apache.axis2.jaxws.core.MessageContext;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.soap.MTOMFeature;
+
+/**
+ * This suite of tests is for the MTOMFeature configuration that can
+ * be used on Proxy clients.
+ */
+public class ProxyMTOMFeatureTest extends InterceptableClientTestCase {
+
+    /*
+     * Make sure MTOM is not enabled by default.
+     */
+    public void testNoMTOMFeature() {
+        Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
+        ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class);
+        assertTrue("Proxy instance was null", proxy != null);
+        
+        proxy.sendAttachment("12345");
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("Request should not be null.", request != null);
+        assertTrue("MTOM should not be abled on the Message by default.", !request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the default configuration of the MTOMFeature.
+     */
+    public void testDefaultMTOMFeature() {
+        // Use the default feature config
+        MTOMFeature feature = new MTOMFeature();
+        
+        Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
+        ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
+        assertTrue("Proxy instance was null", proxy != null);
+        
+        proxy.sendAttachment("12345");
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("Request should not be null.", request != null);
+        assertTrue("MTOM should be abled on the Message by default.", request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test disabling the MTOM feature.
+     */
+    public void testDisabledMTOMFeature() {
+        // Use the default feature config
+        MTOMFeature feature = new MTOMFeature(false);
+        
+        Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
+        ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
+        assertTrue("Proxy instance was null", proxy != null);
+        
+        proxy.sendAttachment("12345");
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("Request should not be null.", request != null);
+        assertTrue("MTOM should NOT be abled on the Message by default.", !request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the configuration of the threshold for MTOM when no attachment is 
+     * specified.  In this case, although enabled per the MTOMFeature, MTOM should
+     * not be enabled on the Message, since the attachment size is too small.
+     */
+    public void testMTOMFeatureThreshold() {
+        // Set a threshold that we will not meet.
+        int threshold = 20000;
+        MTOMFeature feature = new MTOMFeature(threshold);
+        
+        Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
+        ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
+        assertTrue("Proxy instance was null", proxy != null);
+        
+        proxy.sendAttachment("12345");
+        
+        TestClientInvocationController testController = getInvocationController();
+        InvocationContext ic = testController.getInvocationContext();
+        MessageContext request = ic.getRequestMessageContext();
+        
+        assertTrue("Request should not be null.", request != null);
+        assertTrue("MTOM should NOT be abled on the Message, the threshold was not met.", !request.getMessage().isMTOMEnabled());
+    }
+    
+    /*
+     * Test the configuration of the threshold for MTOM when an attachment is specified.
+     * In this case, MTOM should be enabled on the Message if the attachment specified is
+     * larger than the threshold.
+     */
+    public void testMTOMFeatureThresholdWithAttachment() {
+        
+    }
+    
+    @WebService()
+    public interface ProxyMTOMService {
+    
+        public String sendAttachment(String id);
+        
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStore.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStore.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStore.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStore.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client.soapaction;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+@WebService(name = "BookStore", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction")
+public interface BookStore {
+
+    /**
+     * 
+     * @param item
+     * @return
+     *     returns float
+     */
+    @WebMethod
+    @WebResult(name = "price", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction")
+    @RequestWrapper(localName = "getPrice", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", className = "org.apache.axis2.jaxws.client.soapaction.GetPriceType")
+    @ResponseWrapper(localName = "getPriceResponse", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", className = "org.apache.axis2.jaxws.client.soapaction.GetPriceResponseType")
+    public float getPrice(
+        @WebParam(name = "item", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction")
+        String item);
+
+    /**
+     * 
+     * @param item
+     * @return
+     *     returns float
+     */
+    @WebMethod(action = "http://jaxws.axis2.apache.org/client/soapaction/getPrice")
+    @WebResult(name = "price", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction")
+    @RequestWrapper(localName = "getPriceWithAction", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", className = "org.apache.axis2.jaxws.client.soapaction.GetPriceType")
+    @ResponseWrapper(localName = "getPriceWithActionResponse", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", className = "org.apache.axis2.jaxws.client.soapaction.GetPriceResponseType")
+    public float getPriceWithAction(
+        @WebParam(name = "item", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction")
+        String item);
+
+    /**
+     * 
+     * @param item
+     * @return
+     *     returns int
+     */
+    @WebMethod
+    @WebResult(name = "inventory", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", partName = "inventory")
+    @SOAPBinding(parameterStyle = ParameterStyle.BARE)
+    public int getInventory(
+        @WebParam(name = "item", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", partName = "item")
+        String item);
+
+    /**
+     * 
+     * @param item
+     * @return
+     *     returns int
+     */
+    @WebMethod(action = "http://jaxws.axis2.apache.org/client/soapaction/getInventory")
+    @WebResult(name = "inventoryWithAction", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", partName = "inventory")
+    @SOAPBinding(parameterStyle = ParameterStyle.BARE)
+    public int getInventoryWithAction(
+        @WebParam(name = "itemWithAction", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", partName = "item")
+        String item);
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStoreService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStoreService.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStoreService.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/BookStoreService.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client.soapaction;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+@WebServiceClient(name = "BookStoreService", targetNamespace = "http://jaxws.axis2.apache.org/client/soapaction", wsdlLocation = "SOAPActionTest.wsdl")
+public class BookStoreService
+    extends Service
+{
+
+    private static URL BOOKSTORESERVICE_WSDL_LOCATION;
+    private static String wsdlLocation="/target/test-classes/services/BookStoreService/META-INF/SOAPActionTest.wsdl";
+    static {
+        URL url = null;
+        try {
+            try{
+                String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
+                wsdlLocation = new File(baseDir + wsdlLocation).getAbsolutePath();
+            }catch(Exception e){
+                e.printStackTrace();
+            }
+            File file = new File(wsdlLocation);
+            url = file.toURL();
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        }
+        BOOKSTORESERVICE_WSDL_LOCATION = url;
+    }
+    
+    public BookStoreService(URL wsdlLocation, QName serviceName) {
+        super(wsdlLocation, serviceName);
+    }
+
+    public BookStoreService() {
+        super(BOOKSTORESERVICE_WSDL_LOCATION, new QName("http://jaxws.axis2.apache.org/client/soapaction", "BookStoreService"));
+    }
+
+    /**
+     * 
+     * @return
+     *     returns BookStore
+     */
+    @WebEndpoint(name = "BookStorePort")
+    public BookStore getBookStorePort() {
+        return (BookStore)super.getPort(new QName("http://jaxws.axis2.apache.org/client/soapaction", "BookStorePort"), BookStore.class);
+    }
+
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/server/SOAPActionTestsMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/server/SOAPActionTestsMessageReceiver.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/server/SOAPActionTestsMessageReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/client/soapaction/server/SOAPActionTestsMessageReceiver.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,159 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.client.soapaction.server;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.jaxws.TestLogger;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.util.MessageContextBuilder;
+
+/**
+ * This MessageReceiver is used for a series of tests relating to the
+ * SOAP action.  This is mostly for testing that the correct operation
+ * was resolved based on the SOAP action that was sent by the client.  
+ */
+public class SOAPActionTestsMessageReceiver implements MessageReceiver {
+    
+    public void receive(MessageContext request) throws AxisFault {
+        TestLogger.logger.debug("[server] SOAPActionTestsMessageReceiver: new request received");
+        
+        SOAPEnvelope env = request.getEnvelope();
+        TestLogger.logger.debug("[server] request message [" + env + "]");
+        
+        // Get the first child element
+        Iterator itr = env.getBody().getChildElements();
+        OMElement child = (OMElement) itr.next();
+
+        // Create the envelope for the response
+        SOAPFactory sf = OMAbstractFactory.getSOAP11Factory();
+        SOAPEnvelope responseEnv = sf.createSOAPEnvelope();
+        sf.createSOAPBody(responseEnv);
+        OMElement responseBodyContent = null;
+        
+        // Check to see which operation was invoked and then validate the contents 
+        // of the request (resolved AxisOperation and the soap action) to see if they are correct.
+        String name = child.getLocalName();
+        if (name.equals("getPrice")) {
+            float status = 0;
+            if (checkOperation("getPrice", request) &&
+                checkSOAPAction("", request)) {
+                TestLogger.logger.debug("[server] all checks passed");
+                status = 1;
+            }
+            else {
+                TestLogger.logger.debug("[server] some checks failed");
+            }
+            
+            responseBodyContent = sf.createOMElement(new QName("http://jaxws.axis2.apache.org/client/soapaction", "getPriceWithActionResponse"), responseEnv.getBody());
+            OMElement elem = sf.createOMElement(new QName("", "price"), responseBodyContent);
+            OMText text = sf.createOMText(Float.toString(status));
+            elem.addChild(text);
+        }
+        else if (name.equals("getPriceWithAction")) {
+            float status = 0;
+            if (checkOperation("getPriceWithAction", request) &&
+                checkSOAPAction("http://jaxws.axis2.apache.org/client/soapaction/getPrice", request)) {
+                TestLogger.logger.debug("[server] all checks passed");
+                status = 1;
+            }
+            else {
+                TestLogger.logger.debug("[server] some checks failed");
+            }
+            
+            responseBodyContent = sf.createOMElement(new QName("http://jaxws.axis2.apache.org/client/soapaction", "getPriceWithActionResponse"), responseEnv.getBody());
+            OMElement elem = sf.createOMElement(new QName("", "price"), responseBodyContent);
+            OMText text = sf.createOMText(Float.toString(status));
+            elem.addChild(text);
+        }
+        
+        /*
+        else if (name.equals("item")) {
+            if (checkOperation("getInventory", request) &&
+                checkSOAPAction("", request)) {
+                status = STATUS_PASS;
+            }
+        }
+        else if (name.equals("itemWithAction")) {
+            if (checkOperation("getInventoryWithAction", request) &&
+                checkSOAPAction("http://jaxws.axis2.apache.org/client/soapaction/getInventory", request)) {
+                status = STATUS_PASS;
+            }
+        }
+        */
+        
+        // Fill in the contents of the response and send it back
+        MessageContext response = MessageContextBuilder.createOutMessageContext(request);
+        responseEnv.getBody().addChild(responseBodyContent);
+        response.setEnvelope(responseEnv);
+
+        TestLogger.logger.debug("[server] response message [" + responseEnv.toString() + "]");
+        
+        response.getOperationContext().addMessageContext(response);
+        AxisEngine engine = new AxisEngine(response.getConfigurationContext());
+        engine.send(response);    
+    }
+    
+    /*
+     * Verify that the AxisOperation on the MessageContext is the 
+     * one that we were expecting based on the request.
+     */
+    private boolean checkOperation(String expectedOperationName, MessageContext mc) {
+        AxisOperation op = mc.getAxisOperation();
+        TestLogger.logger.debug("[server] checking expected operation [" + expectedOperationName +
+                "] against resolved operation [" + op.getName() + "]");
+        if (op.getName().getLocalPart().equals(expectedOperationName)) {
+            TestLogger.logger.debug("[server] operation name is correct");
+            return true;
+        }
+        else {
+            TestLogger.logger.debug("[server] operation name is incorrect");
+            return false;
+        }
+    }
+    
+    /*
+     * Verify that the SOAPAction present on the MessageContext is
+     * the one that we were expecting based on the request.
+     */
+    private boolean checkSOAPAction(String expectedAction, MessageContext mc) {
+       String action = mc.getSoapAction();
+        TestLogger.logger.debug("[server] checking expected action [" + expectedAction +
+                "] against received action [" + action + "]");
+       if (action != null && action.equals(expectedAction)) {
+           TestLogger.logger.debug("[server] soap action is correct");
+           return true;
+       }           
+       else {
+           TestLogger.logger.debug("[server] soap action is incorrect");
+           return false;
+       }   
+    }
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/core/MessageContextTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/core/MessageContextTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/core/MessageContextTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/core/MessageContextTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,60 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.core;
+
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+/*
+ * Testing jaxws message context's interation with axis2 message context.
+ * JAXWS delegates all property setting/getting up to axis2, but we need to 
+ * be careful how we use axis2's MC.  We should not have access to the options
+ * bag in the axis2 MC, for example.
+ */
+
+public class MessageContextTests extends TestCase {
+
+    static final String key1 = "ONaxisMC";
+    static final String key2 = "ONaxisMCOptions";
+    static final String key3 = "ONjaxwsMC";
+    
+    /* TODO:
+     * should also test to make sure service or operation context properties
+     * on the axis2 MC are not accessible.  That's probably best left for another test.
+     */
+    public void testMessageContextPropertiesAccessibility() throws Exception {
+        org.apache.axis2.context.MessageContext axisMC = new org.apache.axis2.context.MessageContext();
+        MessageContext jaxwsMC = new MessageContext(axisMC);
+        axisMC.setProperty(key1, "value");
+        axisMC.getOptions().setProperty(key2, "value");
+        jaxwsMC.setProperty(key3, "value");
+        
+        assertNotNull(jaxwsMC.getProperty(key1));
+        assertNull(jaxwsMC.getProperty(key2));
+        assertNotNull(jaxwsMC.getProperty(key3));
+        
+        Map props = jaxwsMC.getProperties();
+        
+        assertNotNull(props.get(key1));
+        assertNull(props.get(key2));
+        assertNotNull(props.get(key3));
+    }
+    
+}

Added: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java?rev=633234&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java (added)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/databinding/BindingToProtocolTests.java Mon Mar  3 10:47:38 2008
@@ -0,0 +1,144 @@
+/*
+ * 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.
+ */
+package org.apache.axis2.jaxws.databinding;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+/**
+ * A suite of tests for reading the binding from a WSDL file and
+ * making sure we are configuring the Protocol correctly for 
+ * messages based on that binding ID.
+ */
+public class BindingToProtocolTests extends TestCase {
+    
+    private static final String SOAP11_TEST_NS = "http://jaxws.axis2.apache.org/bindingtest/soap11";
+    private static final String SOAP12_TEST_NS = "http://jaxws.axis2.apache.org/bindingtest/soap12";
+    private static final QName SOAP11_SVC_QNAME = new QName(SOAP11_TEST_NS, "SOAP11EchoService");
+    private static final QName SOAP12_SVC_QNAME = new QName(SOAP12_TEST_NS, "SOAP12EchoService");
+    
+    public BindingToProtocolTests(String name) {
+        super(name);
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.1 binding transport URL
+     * in a WSDL, as specified by JAX-WS section 10.4.1.
+     */
+    public void testReadJAXWSSOAP11Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP11Binding-JAXWS.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP11_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP11_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap11));
+        */
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.1 binding transport URL
+     * in a WSDL, as specified by WS-I Basic Profile 1.1.
+     */
+    public void testReadWSISOAP11Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP11Binding-WSI.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP11_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP11_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap11));
+        */
+    }
+    
+    /**
+     * Test to see if we can read the SOAP 1.2 binding transport URL
+     * in a WSDL, as specified by JAX-WS.
+     */
+    public void testReadJAXWSSOAP12Binding() throws Exception {
+        /*
+        // Get the WSDL with the JAX-WS binding url
+        URL wsdlUrl = new URL("file:./test-resources/wsdl/SOAP12Binding-JAXWS.wsdl");
+        
+        // TODO: There should be an easier way to do this without
+        // requring the creating of a Service object.  Should the
+        // ServiceDescription be constructed from just a WSDL file?
+        Service svc = Service.create(wsdlUrl, SOAP12_SVC_QNAME);
+        ServiceDelegate delegate = DescriptionTestUtils.getServiceDelegate(svc);
+        ServiceDescription sd = delegate.getServiceDescription();
+        
+        EndpointDescription[] eds = sd.getEndpointDescriptions();
+        for (int i = 0; i < eds.length; i++) {
+            System.out.println("port [" + eds[i].getTargetNamespace() + ":" + eds[i].getName() + "]");
+        }
+        
+        EndpointDescription ed = sd.getEndpointDescription(new QName(SOAP12_TEST_NS, "EchoPort"));
+        assertNotNull("The EndpointDescription was not created.", ed);
+        
+        String bindingID = ed.getClientBindingID();
+        assertNotNull("The binding ID was null.", bindingID);
+        
+        Protocol p = Protocol.getProtocolForBinding(bindingID);
+        assertTrue("Protocol configured incorrectly", p.equals(Protocol.soap12));
+        */
+    }
+    
+    /**
+     * Test to see if we are defaulting the soap binding to SOAP 1.1
+     * correctly in the absence of a WSDL document.
+     */
+    public void testDefaultBindingNoWSDL() {
+        
+    }
+}



---------------------------------------------------------------------
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