[jbossws-commits] JBossWS SVN: r13006 - in framework/trunk/testsuite/test: java/org/jboss/test/ws/jaxws and 4 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Sep 22 12:45:37 EDT 2010


Author: alessio.soldano at jboss.com
Date: 2010-09-22 12:45:37 -0400 (Wed, 22 Sep 2010)
New Revision: 13006

Added:
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/Endpoint.java
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/EndpointImpl.java
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/JBWS3034TestCase.java
   framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/ServerSOAPHandler.java
   framework/trunk/testsuite/test/resources/jaxws/jbws3034/
   framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/
   framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/jboss-web.xml
   framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/web.xml
   framework/trunk/testsuite/test/resources/jaxws/jbws3034/handlers.xml
Modified:
   framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-3034] Adding testcase


Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml	2010-09-22 14:10:35 UTC (rev 13005)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml	2010-09-22 16:45:37 UTC (rev 13006)
@@ -1008,6 +1008,21 @@
 			</webinf>
 		</war> 
 
+		<!-- jaxws-jbws3034 -->
+		<war warfile="${tests.output.dir}/test-libs/jaxws-jbws3034.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws3034/WEB-INF/web.xml">
+			<classes dir="${tests.output.dir}/test-classes">
+				<include name="org/jboss/test/ws/jaxws/jbws3034/Endpoint.class"/>
+				<include name="org/jboss/test/ws/jaxws/jbws3034/EndpointImpl.class"/>
+				<include name="org/jboss/test/ws/jaxws/jbws3034/ServerSOAPHandler.class"/>
+			</classes>
+			<classes dir="${tests.output.dir}/test-resources/jaxws/jbws3034">
+				<include name="handlers.xml" />
+			</classes>
+			<webinf dir="${tests.output.dir}/test-resources/jaxws/jbws3034/WEB-INF">
+				<include name="jboss-web.xml"/>
+			</webinf>
+		</war>  	
+
 		<!-- jaxws-jbws3041 -->
 		<war warfile="${tests.output.dir}/test-libs/jaxws-jbws3041.war" webxml="${tests.output.dir}/test-resources/jaxws/jbws3041/WEB-INF/web.xml">
 			<classes dir="${tests.output.dir}/test-classes">

Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/Endpoint.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/Endpoint.java	                        (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/Endpoint.java	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jbws3034;
+import javax.jws.WebService;
+ at WebService(name = "Endpoint", targetNamespace = "http://ws.jboss.org/jbws3034")
+public interface Endpoint
+{
+   
+   public String echo(final String message);
+
+}

Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/EndpointImpl.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/EndpointImpl.java	                        (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/EndpointImpl.java	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jbws3034;
+
+import javax.jws.HandlerChain;
+import javax.jws.WebService;
+
+ at WebService(name = "Endpoint", portName = "EndpointPort", serviceName="EndpointService", targetNamespace = "http://ws.jboss.org/jbws3034", endpointInterface = "org.jboss.test.ws.jaxws.jbws3034.Endpoint")
+ at HandlerChain(file = "../../../../../../handlers.xml")
+public class EndpointImpl implements Endpoint
+{
+  public String echo(final String message)
+   {
+      return message;
+   }
+
+}

Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/JBWS3034TestCase.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/JBWS3034TestCase.java	                        (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/JBWS3034TestCase.java	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jbws3034;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+public class JBWS3034TestCase extends JBossWSTest
+{
+
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-jbws3034";
+
+   private static Endpoint port;
+
+   public static Test suite() throws Exception
+   {
+      return new JBossWSTestSetup(JBWS3034TestCase.class, "jaxws-jbws3034.war");
+   }
+
+   public void setUp() throws Exception
+   {
+      super.setUp();
+      URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+      Service service = Service.create(wsdlURL, new QName("http://ws.jboss.org/jbws3034", "EndpointService"));
+      port = service.getPort(new QName("http://ws.jboss.org/jbws3034", "EndpointPort"), Endpoint.class);
+   }
+
+   public void testCall() throws Exception
+   {
+      String response = port.echo("testJBWS3034");
+      assertEquals("PutByServerSOAPHandler", response);
+   }
+}
\ No newline at end of file

Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/ServerSOAPHandler.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/ServerSOAPHandler.java	                        (rev 0)
+++ framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws3034/ServerSOAPHandler.java	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jbws3034;
+
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.jboss.wsf.common.handler.GenericSOAPHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+public class ServerSOAPHandler extends GenericSOAPHandler<LogicalMessageContext>
+{
+   @Override
+   protected boolean handleOutbound(final MessageContext msgContext)
+   {
+      try
+      {
+         SOAPMessageContext smc = (SOAPMessageContext) msgContext;
+         SOAPMessage message = smc.getMessage();
+
+         SOAPBody body = message.getSOAPBody();
+         Document document = body.extractContentAsDocument();
+         NodeList nodes = document.getChildNodes();
+         for (int i = 0; i < nodes.getLength(); i++)
+         {
+            Node current = nodes.item(i);
+
+            NodeList childNodes = current.getChildNodes();
+            for (int j = 0; j < childNodes.getLength(); j++)
+            {
+               Node currentChildNode = childNodes.item(j);
+               if ("return".equals(currentChildNode.getLocalName()))
+               {
+                  currentChildNode.setTextContent("PutByServerSOAPHandler");
+               }
+            }
+         }
+         body.addDocument(document);
+         message.saveChanges();
+      }
+      catch (SOAPException e)
+      {
+         throw new RuntimeException(e);
+      }
+      return true;
+   }
+}

Added: framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/jboss-web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/jboss-web.xml	                        (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/jboss-web.xml	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
+
+<jboss-web>
+   <context-root>/jaxws-jbws3034</context-root>   
+</jboss-web>
\ No newline at end of file

Added: framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/web.xml	                        (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws3034/WEB-INF/web.xml	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+   <servlet>
+      <servlet-name>Endpoint</servlet-name>
+      <servlet-class>org.jboss.test.ws.jaxws.jbws3034.EndpointImpl</servlet-class>
+   </servlet>
+   
+   <servlet-mapping>
+      <servlet-name>Endpoint</servlet-name>
+      <url-pattern>/*</url-pattern>
+   </servlet-mapping>
+
+</web-app>
\ No newline at end of file

Added: framework/trunk/testsuite/test/resources/jaxws/jbws3034/handlers.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws3034/handlers.xml	                        (rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws3034/handlers.xml	2010-09-22 16:45:37 UTC (rev 13006)
@@ -0,0 +1,15 @@
+<?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"
+  xmlns:ns1="http://org.jboss.ws/jaxws/samples/logicalhandler"
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee javaee_web_services_1_2.xsd">
+
+  <handler-chain>
+    <handler>
+      <handler-name>ServerSOAPHandler</handler-name>
+      <handler-class>org.jboss.test.ws.jaxws.jbws3034.ServerSOAPHandler</handler-class>
+    </handler>
+  </handler-chain>
+
+</handler-chains>
\ No newline at end of file



More information about the jbossws-commits mailing list