JBossWS SVN: r9045 - framework/branches/jbossws-framework-2.0.1.GA_CP.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-01-15 08:38:34 -0500 (Thu, 15 Jan 2009)
New Revision: 9045
Modified:
framework/branches/jbossws-framework-2.0.1.GA_CP/version.properties
Log:
[JBPAPP-1440] Release and upgrade JBossWS Common to 1.0.0.GA_CP03.
Modified: framework/branches/jbossws-framework-2.0.1.GA_CP/version.properties
===================================================================
--- framework/branches/jbossws-framework-2.0.1.GA_CP/version.properties 2009-01-15 12:54:54 UTC (rev 9044)
+++ framework/branches/jbossws-framework-2.0.1.GA_CP/version.properties 2009-01-15 13:38:34 UTC (rev 9045)
@@ -14,7 +14,7 @@
implementation.vendor.id=http://www.jboss.org
# Thirdparty library versions
-jbossws-common=1.0.0.GA_CP02-brew
+jbossws-common=1.0.0.GA_CP03-brew
jbossws-spi=1.0.0.GA_CP01-brew
dom4j=1.6.1
15 years, 11 months
JBossWS SVN: r9044 - stack/native/branches/jbossws-native-2.0.1.SP2_CP.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-01-15 07:54:54 -0500 (Thu, 15 Jan 2009)
New Revision: 9044
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties
Log:
[JBPAPP-1440] Release and upgrade JBossWS Common to 1.0.0.GA_CP03.
Modified: stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties 2009-01-15 11:13:56 UTC (rev 9043)
+++ stack/native/branches/jbossws-native-2.0.1.SP2_CP/version.properties 2009-01-15 12:54:54 UTC (rev 9044)
@@ -25,7 +25,7 @@
# Dependend integration projects
jbossws-spi=1.0.0.GA_CP01-brew
-jbossws-common=1.0.0.GA_CP-SNAPSHOT
+jbossws-common=1.0.0.GA_CP03-brew
jbossws-framework=2.0.1.GA_CP02-brew
jbossws-jboss40=2.0.1.GA
jbossws-jboss42=2.0.1.GA_CP01
15 years, 11 months
JBossWS SVN: r9043 - container/jboss42/branches/jbossws-jboss42-2.0.1.GA_CP.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2009-01-15 06:13:56 -0500 (Thu, 15 Jan 2009)
New Revision: 9043
Modified:
container/jboss42/branches/jbossws-jboss42-2.0.1.GA_CP/version.properties
Log:
[JBPAPP-1440] Release and upgrade JBossWS Common to 1.0.0.GA_CP03.
Modified: container/jboss42/branches/jbossws-jboss42-2.0.1.GA_CP/version.properties
===================================================================
--- container/jboss42/branches/jbossws-jboss42-2.0.1.GA_CP/version.properties 2009-01-15 10:11:14 UTC (rev 9042)
+++ container/jboss42/branches/jbossws-jboss42-2.0.1.GA_CP/version.properties 2009-01-15 11:13:56 UTC (rev 9043)
@@ -14,7 +14,7 @@
implementation.vendor.id=http://www.jboss.org
# Thirdparty library versions
-jbossws-common=1.0.0.GA_CP02-brew
+jbossws-common=1.0.0.GA_CP03-brew
jbossws-spi=1.0.0.GA_CP01-brew
jbossws-framework=2.0.1.GA_CP02-brew
15 years, 11 months
JBossWS SVN: r9042 - framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-15 05:11:14 -0500 (Thu, 15 Jan 2009)
New Revision: 9042
Modified:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java
Log:
[JBWS-2448] Improving test
Modified: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java 2009-01-15 09:59:07 UTC (rev 9041)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java 2009-01-15 10:11:14 UTC (rev 9042)
@@ -44,85 +44,91 @@
/**
* [JBWS-2448] This test verify the MTOMFeature correctly enable MTOM on client side.
- *
+ *
* @author alessio.soldano(a)jboss.com
* @since 14-Jan-2009
*/
-public class MTOMFeatureTestCase extends JBossWSTest
-{
+public class MTOMFeatureTestCase extends JBossWSTest {
- public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-samples-xop-doclit/bare";
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-samples-xop-doclit/bare";
- protected MTOMEndpoint port;
+ protected MTOMEndpoint port;
- public static Test suite()
- {
- return new JBossWSTestSetup(MTOMFeatureTestCase.class, "jaxws-samples-xop-doclit.war");
- }
+ public static Test suite() {
+ return new JBossWSTestSetup(MTOMFeatureTestCase.class, "jaxws-samples-xop-doclit.war");
+ }
- @SuppressWarnings("unchecked")
- private MTOMEndpoint getPort(boolean mtomEnabled) throws Exception
- {
- QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "MTOMService");
- URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ private MTOMEndpoint getPort(boolean mtomEnabled) throws Exception {
+ QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "MTOMService");
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
- MTOMEndpoint port = service.getPort(MTOMEndpoint.class, new MTOMFeature(mtomEnabled));
- SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding();
+ Service service = Service.create(wsdlURL, serviceName);
+ return service.getPort(MTOMEndpoint.class, new MTOMFeature(mtomEnabled));
+ }
- if (mtomEnabled)
- {
- List<Handler> handlerChain = new ArrayList<Handler>();
- handlerChain.addAll(binding.getHandlerChain());
- handlerChain.add(new MTOMCheckClientHandler());
- binding.setHandlerChain(handlerChain);
- }
- return port;
- }
+ @SuppressWarnings("unchecked")
+ private static void addMTOMCheckHandler(MTOMEndpoint port) {
+ SOAPBinding binding = (SOAPBinding) ((BindingProvider) port).getBinding();
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.addAll(binding.getHandlerChain());
+ handlerChain.add(new MTOMCheckClientHandler());
+ binding.setHandlerChain(handlerChain);
+ }
- public void testWithMTOMRequest() throws Exception
- {
- DataHandler dh = new DataHandler("DataHandlerRoundtrip", "text/plain");
- DHResponse response = getPort(true).echoDataHandler(new DHRequest(dh));
- assertNotNull(response);
+ public void testWithMTOMRequest() throws Exception {
+ DataHandler dh = new DataHandler("DataHandlerRoundtrip", "text/plain");
+ MTOMEndpoint port = getPort(true);
+ addMTOMCheckHandler(port);
+ DHResponse response = port.echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
- Object content = getContent(response.getDataHandler());
- String contentType = response.getDataHandler().getContentType();
+ Object content = getContent(response.getDataHandler());
+ String contentType = response.getDataHandler().getContentType();
- assertEquals("Server data", content);
- assertEquals("text/plain", contentType);
- }
+ assertEquals("Server data", content);
+ assertEquals("text/plain", contentType);
+ }
- public void testWithoutMTOMRequest() throws Exception
- {
- DataHandler dh = new DataHandler("DataHandlerResponseOptimzed", "text/plain");
- DHResponse response = getPort(false).echoDataHandler(new DHRequest(dh));
- assertNotNull(response);
+ public void testWithoutMTOMRequest() throws Exception {
+ DataHandler dh = new DataHandler("DataHandlerResponseOptimzed", "text/plain");
+ DHResponse response = getPort(false).echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
- Object content = getContent(response.getDataHandler());
- String contentType = response.getDataHandler().getContentType();
+ Object content = getContent(response.getDataHandler());
+ String contentType = response.getDataHandler().getContentType();
- assertEquals("Server data", content);
- assertEquals("text/plain", contentType);
- }
+ assertEquals("Server data", content);
+ assertEquals("text/plain", contentType);
+ }
+
+ public void testErrorWithoutMTOMRequest() throws Exception {
+ DataHandler dh = new DataHandler("DataHandlerResponseOptimzed", "text/plain");
+ MTOMEndpoint port = getPort(false);
+ addMTOMCheckHandler(port);
+ try
+ {
+ port.echoDataHandler(new DHRequest(dh));
+ fail("Exception expected");
+ }
+ catch (Exception e)
+ {
+ //OK
+ }
+ }
- protected Object getContent(DataHandler dh) throws IOException
- {
- Object content = dh.getContent();
+ protected Object getContent(DataHandler dh) throws IOException {
+ Object content = dh.getContent();
- // Metro returns an ByteArrayInputStream
- if (content instanceof InputStream)
- {
- try
- {
- BufferedReader br = new BufferedReader(new InputStreamReader((InputStream)content));
- return br.readLine();
- }
- finally
- {
- ((InputStream)content).close();
- }
- }
- return content;
- }
+ // Metro returns an ByteArrayInputStream
+ if (content instanceof InputStream) {
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ (InputStream) content));
+ return br.readLine();
+ } finally {
+ ((InputStream) content).close();
+ }
+ }
+ return content;
+ }
}
15 years, 11 months
JBossWS SVN: r9041 - in framework/branches/jaxws21/testsuite/test: java/org/jboss/test/ws/jaxws and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-15 04:59:07 -0500 (Thu, 15 Jan 2009)
New Revision: 9041
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/BindingProviderTestCase.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/Endpoint.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.java
Modified:
framework/branches/jaxws21/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-2452] EPR tests
Modified: framework/branches/jaxws21/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/branches/jaxws21/testsuite/test/ant-import/build-jars-jaxws.xml 2009-01-15 09:58:06 UTC (rev 9040)
+++ framework/branches/jaxws21/testsuite/test/ant-import/build-jars-jaxws.xml 2009-01-15 09:59:07 UTC (rev 9041)
@@ -61,6 +61,14 @@
<exclude name="org/jboss/test/ws/jaxws/complex/*TestCase.class"/>
</classes>
</war>
+
+ <!-- jaxws-endpointReference -->
+ <jar destfile="${tests.output.dir}/test-libs/jaxws-endpointReference.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/endpointReference/Endpoint.class"/>
+ <include name="org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.class"/>
+ </fileset>
+ </jar>
<!-- jaxws-handlerscope -->
<war warfile="${tests.output.dir}/test-libs/jaxws-handlerscope.war" webxml="${tests.output.dir}/test-resources/jaxws/handlerscope/WEB-INF/web.xml">
Added: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/BindingProviderTestCase.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/BindingProviderTestCase.java (rev 0)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/BindingProviderTestCase.java 2009-01-15 09:59:07 UTC (rev 9041)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.endpointReference;
+
+import java.net.InetAddress;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import junit.framework.Test;
+
+import org.jboss.util.NotImplementedException;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Test EPR related methods
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 13-Jan-2009
+ */
+public class BindingProviderTestCase extends JBossWSTest
+{
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-endpointReference";
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(BindingProviderTestCase.class, "jaxws-endpointReference.jar");
+ }
+
+ public void testClient() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/endpointReference", "EndpointService");
+ Endpoint port = Service.create(wsdlURL, serviceName).getPort(Endpoint.class);
+
+ BindingProvider bp = (BindingProvider)port;
+ assertEndpointReference(bp.getEndpointReference());
+ assertEndpointReference(bp.getEndpointReference(W3CEndpointReference.class));
+ try
+ {
+ bp.getEndpointReference(MyEndpointReference.class);
+ fail("Exception expected");
+ }
+ catch (Exception e)
+ {
+ //NOP: the provided EndpointReference is not supported by the implementation
+ }
+
+ String retObj = port.echo("Hello");
+ assertEquals("Hello", retObj);
+ }
+
+ public void testDispatch() throws Exception
+ {
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+ QName serviceName = new QName("http://org.jboss.ws/endpointReference", "EndpointService");
+ Service service = Service.create(wsdlURL, serviceName);
+ Dispatch<Source> dispatch = service.createDispatch(new QName("http://org.jboss.ws/endpointReference", "EndpointPort"), Source.class, Mode.PAYLOAD);
+
+ BindingProvider bp = (BindingProvider)dispatch;
+ assertEndpointReference(bp.getEndpointReference());
+ assertEndpointReference(bp.getEndpointReference(W3CEndpointReference.class));
+ try
+ {
+ bp.getEndpointReference(MyEndpointReference.class);
+ fail("Exception expected");
+ }
+ catch (Exception e)
+ {
+ //NOP: the provided EndpointReference is not supported by the implementation
+ }
+ }
+
+ private void assertEndpointReference(EndpointReference epr) throws Exception
+ {
+ assertEquals(W3CEndpointReference.class.getName(), epr.getClass().getName());
+ Element endpointReference = DOMUtils.parse(epr.toString());
+ assertEquals("EndpointReference", endpointReference.getNodeName());
+ assertEquals("http://www.w3.org/2005/08/addressing", endpointReference.getAttribute("xmlns"));
+ NodeList addresses = endpointReference.getElementsByTagName("Address");
+ assertEquals(1, addresses.getLength());
+ String targetEndpointAddress = "localhost".equals(getServerHost()) ? "http://127.0.0.1:8080/jaxws-endpointReference" : TARGET_ENDPOINT_ADDRESS;
+ assertEquals(targetEndpointAddress, addresses.item(0).getFirstChild().getNodeValue());
+ }
+
+ private class MyEndpointReference extends EndpointReference
+ {
+ @Override
+ public void writeTo(Result result)
+ {
+ throw new NotImplementedException();
+ }
+
+ }
+}
Property changes on: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/BindingProviderTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/Endpoint.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/Endpoint.java (rev 0)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/Endpoint.java 2009-01-15 09:59:07 UTC (rev 9041)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.endpointReference;
+
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+@WebService(name = "Endpoint", targetNamespace = "http://org.jboss.ws/endpointReference")
+public interface Endpoint
+{
+ String echo(String input);
+}
Property changes on: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/Endpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.java (rev 0)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.java 2009-01-15 09:59:07 UTC (rev 9041)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.endpointReference;
+
+import javax.ejb.Stateless;
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import org.jboss.wsf.spi.annotation.WebContext;
+
+@Stateless
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
+@WebContext(contextRoot="jaxws-endpointReference", urlPattern="/*")
+@WebService
+(
+ name = "Endpoint",
+ serviceName = "EndpointService",
+ targetNamespace = "http://org.jboss.ws/endpointReference"
+)
+public class EndpointImpl implements Endpoint
+{
+ @WebMethod
+ public String echo(String input)
+ {
+ return input;
+ }
+}
Property changes on: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/endpointReference/EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 11 months
JBossWS SVN: r9040 - framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-15 04:58:06 -0500 (Thu, 15 Jan 2009)
New Revision: 9040
Added:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMCheckClientHandler.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java
Modified:
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java
framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java
Log:
[JBWS-2448] @MTOM & MTOMFeature tests
Added: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMCheckClientHandler.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMCheckClientHandler.java (rev 0)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMCheckClientHandler.java 2009-01-15 09:58:06 UTC (rev 9040)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2006, JBoss Inc., and
+ * individual contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of individual
+ * contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+
+package org.jboss.test.ws.jaxws.samples.xop.doclit;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * A SOAPHandler that checks for Include elements in the
+ * outbound SOAPMessage in order to see if MTOM is enabled.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 15-Jan-2009
+ */
+public class MTOMCheckClientHandler implements SOAPHandler<SOAPMessageContext>
+{
+
+ public boolean handleMessage(SOAPMessageContext smc)
+ {
+ try
+ {
+ return check(smc);
+ }
+ catch (Exception e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+
+ public boolean handleFault(SOAPMessageContext smc)
+ {
+ //NOOP
+ return true;
+ }
+
+ private static boolean check(SOAPMessageContext smc) throws SOAPException, IOException
+ {
+ Boolean outboundProperty = (Boolean)smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
+
+ if (outboundProperty.booleanValue())
+ {
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ SOAPMessage message = smc.getMessage();
+ message.writeTo(outputStream);
+ String messageString = outputStream.toString();
+ if (!messageString.contains("Include"))
+ throw new IllegalStateException("XOP request inlined");
+ }
+ return true;
+ }
+
+ public void close(MessageContext messageContext)
+ {
+ //NOOP
+ }
+
+ public Set<QName> getHeaders()
+ {
+ return new HashSet<QName>(); //empty set
+ }
+
+}
Property changes on: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMCheckClientHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java 2009-01-15 09:50:02 UTC (rev 9039)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpoint.java 2009-01-15 09:58:06 UTC (rev 9040)
@@ -23,11 +23,9 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
-import javax.xml.ws.BindingType;
@WebService(targetNamespace = "http://org.jboss.ws/xop/doclit")
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, parameterStyle = SOAPBinding.ParameterStyle.BARE)
-@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
public interface MTOMEndpoint
{
public DHResponse echoDataHandler(DHRequest request);
Modified: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java 2009-01-15 09:50:02 UTC (rev 9039)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMEndpointBean.java 2009-01-15 09:58:06 UTC (rev 9040)
@@ -28,13 +28,13 @@
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.ws.WebServiceException;
-import javax.xml.ws.BindingType;
+import javax.xml.ws.soap.MTOM;
import org.jboss.logging.Logger;
@WebService(name = "MTOMEndpoint", serviceName = "MTOMService", endpointInterface = "org.jboss.test.ws.jaxws.samples.xop.doclit.MTOMEndpoint")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
-@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http?mtom=true")
+@MTOM
public class MTOMEndpointBean implements MTOMEndpoint
{
private Logger log = Logger.getLogger(MTOMEndpointBean.class);
Added: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java
===================================================================
--- framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java (rev 0)
+++ framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java 2009-01-15 09:58:06 UTC (rev 9040)
@@ -0,0 +1,128 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.samples.xop.doclit;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.activation.DataHandler;
+import javax.xml.namespace.QName;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Service;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.soap.MTOMFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+/**
+ * [JBWS-2448] This test verify the MTOMFeature correctly enable MTOM on client side.
+ *
+ * @author alessio.soldano(a)jboss.com
+ * @since 14-Jan-2009
+ */
+public class MTOMFeatureTestCase extends JBossWSTest
+{
+
+ public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-samples-xop-doclit/bare";
+
+ protected MTOMEndpoint port;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(MTOMFeatureTestCase.class, "jaxws-samples-xop-doclit.war");
+ }
+
+ @SuppressWarnings("unchecked")
+ private MTOMEndpoint getPort(boolean mtomEnabled) throws Exception
+ {
+ QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "MTOMService");
+ URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ MTOMEndpoint port = service.getPort(MTOMEndpoint.class, new MTOMFeature(mtomEnabled));
+ SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding();
+
+ if (mtomEnabled)
+ {
+ List<Handler> handlerChain = new ArrayList<Handler>();
+ handlerChain.addAll(binding.getHandlerChain());
+ handlerChain.add(new MTOMCheckClientHandler());
+ binding.setHandlerChain(handlerChain);
+ }
+ return port;
+ }
+
+ public void testWithMTOMRequest() throws Exception
+ {
+ DataHandler dh = new DataHandler("DataHandlerRoundtrip", "text/plain");
+ DHResponse response = getPort(true).echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
+
+ Object content = getContent(response.getDataHandler());
+ String contentType = response.getDataHandler().getContentType();
+
+ assertEquals("Server data", content);
+ assertEquals("text/plain", contentType);
+ }
+
+ public void testWithoutMTOMRequest() throws Exception
+ {
+ DataHandler dh = new DataHandler("DataHandlerResponseOptimzed", "text/plain");
+ DHResponse response = getPort(false).echoDataHandler(new DHRequest(dh));
+ assertNotNull(response);
+
+ Object content = getContent(response.getDataHandler());
+ String contentType = response.getDataHandler().getContentType();
+
+ assertEquals("Server data", content);
+ assertEquals("text/plain", contentType);
+ }
+
+ protected Object getContent(DataHandler dh) throws IOException
+ {
+ Object content = dh.getContent();
+
+ // Metro returns an ByteArrayInputStream
+ if (content instanceof InputStream)
+ {
+ try
+ {
+ BufferedReader br = new BufferedReader(new InputStreamReader((InputStream)content));
+ return br.readLine();
+ }
+ finally
+ {
+ ((InputStream)content).close();
+ }
+ }
+ return content;
+ }
+}
Property changes on: framework/branches/jaxws21/testsuite/test/java/org/jboss/test/ws/jaxws/samples/xop/doclit/MTOMFeatureTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
15 years, 11 months
JBossWS SVN: r9039 - framework/branches.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2009-01-15 04:50:02 -0500 (Thu, 15 Jan 2009)
New Revision: 9039
Added:
framework/branches/jaxws21/
Log:
[JBWS-2441] branching for adding jaxws 2.1 tests that should pass with all stacks
Copied: framework/branches/jaxws21 (from rev 9038, framework/trunk)
15 years, 11 months