[jbossws-commits] JBossWS SVN: r3463 - in branches/jbossws-2.0/jbossws-core: src/test/java/org/jboss/test/ws/jaxws and 1 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Jun 6 06:09:04 EDT 2007


Author: heiko.braun at jboss.com
Date: 2007-06-06 06:09:04 -0400 (Wed, 06 Jun 2007)
New Revision: 3463

Added:
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/AttachmentHandler.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283Endpoint.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283EndpointImpl.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283TestCase.java
   branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/jaxws-handlers-server.xml
Modified:
   branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
Log:
Fix JBWS-1283

Modified: branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml	2007-06-06 10:06:08 UTC (rev 3462)
+++ branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml	2007-06-06 10:09:04 UTC (rev 3463)
@@ -236,7 +236,14 @@
       </metainf>
     </jar>
 
-    <!-- jaxws namespace -->
+	  <!-- jaxws-jbws1283 -->
+    <jar destfile="${tests.output.dir}/libs/jaxws-jbws1283.jar">
+      <fileset dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/jbws1283/*.*"/>        
+      </fileset>
+    </jar>
+
+	 <!-- jaxws namespace -->
     <war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
       <classes dir="${tests.output.dir}/classes">
         <include name="org/jboss/test/ws/jaxws/namespace/EndpointBean.class"/>

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/AttachmentHandler.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/AttachmentHandler.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/AttachmentHandler.java	2007-06-06 10:09:04 UTC (rev 3463)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbws1283;
+
+import org.jboss.wsf.spi.handler.GenericSOAPHandler;
+
+import javax.activation.DataHandler;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+/**
+ * Appends attachments to outbound message.
+ * 
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+public class AttachmentHandler extends GenericSOAPHandler
+{
+	protected boolean handleOutbound(MessageContext msgContext)
+   {
+		System.out.println("AttachmentHandler: Adding attachment ot message");
+		SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+		AttachmentPart attachment = soapMessage.createAttachmentPart(new DataHandler("Server data", "text/plain"));		
+		soapMessage.addAttachmentPart(attachment);
+		return true;
+   }	
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/AttachmentHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283Endpoint.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283Endpoint.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283Endpoint.java	2007-06-06 10:09:04 UTC (rev 3463)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbws1283;
+
+import javax.jws.WebService;
+import javax.ejb.Remote;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+
+ at WebService(targetNamespace = "http://org.jboss.test.ws/jbws1283")
+ at Remote
+public interface JBWS1283Endpoint
+{
+	void requestAttachmentData();
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283Endpoint.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283EndpointImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283EndpointImpl.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283EndpointImpl.java	2007-06-06 10:09:04 UTC (rev 3463)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbws1283;
+
+import org.jboss.wsf.spi.annotation.WebContext;
+
+import javax.jws.WebService;
+import javax.jws.HandlerChain;
+import javax.ejb.Stateless;
+
+/**
+ * @author Heiko.Braun at jboss.com
+ * @version $Revision$
+ */
+ at WebService(
+		endpointInterface = "org.jboss.test.ws.jaxws.jbws1283.JBWS1283Endpoint",
+		serviceName = "JBWS1283Service",
+		targetNamespace = "http://org.jboss.test.ws/jbws1283"
+	)
+ at HandlerChain(file = "jaxws-handlers-server.xml")
+ at WebContext(contextRoot = "jaxws-jbws1283")
+ at Stateless
+public class JBWS1283EndpointImpl implements JBWS1283Endpoint
+{
+
+	public void requestAttachmentData()
+	{
+		System.out.println("AttachmentData will be added within Handler.handleResponse()");
+	}
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283TestCase.java	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283TestCase.java	2007-06-06 10:09:04 UTC (rev 3463)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.jbws1283;
+
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
+import org.jboss.wsf.spi.handler.GenericSOAPHandler;
+import org.jboss.test.ws.jaxws.jbws1357.JBWS1357;
+import junit.framework.Test;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.handler.Handler;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.SOAPException;
+import javax.activation.DataHandler;
+import java.net.URL;
+import java.net.HttpURLConnection;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * Attachment dropped on outbound messages if they have been
+ * added thorugh a handler
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1283
+ * 
+ * @version $Revision:1370 $
+ */
+public class JBWS1283TestCase extends JBossWSTest
+{
+   private String targetNS = "http://org.jboss.test.ws/jbws1283";
+   private JBWS1283Endpoint port;
+
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(JBWS1283TestCase.class, "jaxws-jbws1283.jar");
+   }
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      QName serviceName = new QName(targetNS, "JBWS1283Service");
+      URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1283/JBWS1283EndpointImpl?wsdl");
+
+      Service service = Service.create(wsdlURL, serviceName);
+      port = (JBWS1283Endpoint)service.getPort(JBWS1283Endpoint.class);
+   }
+
+   public void testAttachmentResponse() throws Exception
+   {
+		// Add a client-side handler that verifes existence of the attachment
+		 BindingProvider bindingProvider = (BindingProvider)port;
+      List<Handler> handlerChain = new ArrayList<Handler>();
+      handlerChain.add(new VerifyAttachmentHandler());
+      bindingProvider.getBinding().setHandlerChain(handlerChain);
+
+		port.requestAttachmentData();
+   }
+
+	// handler that verifies the attachment that have been added on the server-side
+	class VerifyAttachmentHandler extends GenericSOAPHandler
+	{
+
+		protected boolean handleInbound(MessageContext msgContext)
+		{
+			SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
+			Iterator it = soapMessage.getAttachments();
+			while(it.hasNext())
+			{
+				try
+				{
+					AttachmentPart attachment = (AttachmentPart)it.next();
+					System.out.println("Recv " + attachment.getContentType() + " attachment:");
+					System.out.println("'"+attachment.getContent()+"'");
+					return true;
+				}
+				catch (SOAPException e)
+				{
+					throw new RuntimeException("Failed to access attachment data");
+				}
+			}
+
+			throw new IllegalStateException("Missing attachment on the client side");
+		}
+	}
+
+}


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/JBWS1283TestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/jaxws-handlers-server.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/jaxws-handlers-server.xml	                        (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/jaxws-handlers-server.xml	2007-06-06 10:09:04 UTC (rev 3463)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<handler-chains xmlns="http://java.sun.com/xml/ns/javaee"
+                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+   <handler-chain>
+      <protocol-bindings>##SOAP11_HTTP</protocol-bindings>
+      <handler>
+         <handler-name>AttachmentHandler</handler-name>
+         <handler-class>org.jboss.test.ws.jaxws.jbws1283.AttachmentHandler</handler-class>
+      </handler>
+   </handler-chain>
+</handler-chains>
\ No newline at end of file


Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1283/jaxws-handlers-server.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF




More information about the jbossws-commits mailing list