[wise-commits] wise SVN: r495 - in core/trunk/integration-testsuite: common and 4 other directories.

wise-commits at lists.jboss.org wise-commits at lists.jboss.org
Tue Feb 5 09:57:29 EST 2013


Author: alessio.soldano at jboss.com
Date: 2013-02-05 09:57:29 -0500 (Tue, 05 Feb 2013)
New Revision: 495

Added:
   core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/
   core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/HelloWorldServlet.java
   core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java
   core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/
   core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/jboss-deployment-structure.xml
   core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/web.xml
Modified:
   core/trunk/integration-testsuite/common/pom.xml
   core/trunk/integration-testsuite/pom.xml
Log:
[WISE-180] Adding in-container test


Modified: core/trunk/integration-testsuite/common/pom.xml
===================================================================
--- core/trunk/integration-testsuite/common/pom.xml	2013-02-05 12:42:46 UTC (rev 494)
+++ core/trunk/integration-testsuite/common/pom.xml	2013-02-05 14:57:29 UTC (rev 495)
@@ -27,8 +27,6 @@
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 
-	<dependencies/>
-
 	<build>
 		<plugins>
 			<plugin>
@@ -86,6 +84,40 @@
 						</configuration>
 					</execution>
 					<execution>
+						<id>war-it-incontainer</id>
+						<phase>pre-integration-test</phase>
+						<goals>
+							<goal>war</goal>
+						</goals>
+						<configuration>
+							<webXml>${basedir}/src/test/resources/WEB-INF/incontainer/web.xml</webXml>
+							<warName>incontainer</warName>
+							<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
+							<webappDirectory>${project.build.directory}/incontainer</webappDirectory>
+							<warSourceExcludes>**/lib/**</warSourceExcludes>
+							<packagingIncludes>WEB-INF/lib/wise*.jar, WEB-INF/lib/commons*.jar, WEB-INF/lib/milyn*.jar, WEB-INF/classes/**, WEB-INF/*.xml</packagingIncludes>
+							<webResources>
+								<webResource>
+									<targetPath>WEB-INF/classes</targetPath>
+									<directory>${basedir}/target/test-classes/</directory>
+									<includes>
+										<include>**/incontainer/*.class</include>
+									</includes>
+									<excludes>
+										<exclude>**/*Test.class</exclude>
+									</excludes>
+								</webResource>
+								<webResource>
+									<targetPath>WEB-INF</targetPath>
+									<directory>${basedir}/src/test/resources/WEB-INF/incontainer/</directory>
+									<includes>
+										<include>**/*.*</include>
+									</includes>
+								</webResource>
+							</webResources>
+						</configuration>
+					</execution>
+					<execution>
 						<id>war-wsdlResolver</id>
 						<phase>pre-integration-test</phase>
 						<goals>

Added: core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/HelloWorldServlet.java
===================================================================
--- core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/HelloWorldServlet.java	                        (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/HelloWorldServlet.java	2013-02-05 14:57:29 UTC (rev 495)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat, Inc., 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.wise.test.integration.incontainer;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.Map;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.wise.core.client.InvocationResult;
+import org.jboss.wise.core.client.WSDynamicClient;
+import org.jboss.wise.core.client.WSMethod;
+import org.jboss.wise.core.client.builder.WSDynamicClientBuilder;
+import org.jboss.wise.core.client.factories.WSDynamicClientFactory;
+import org.jboss.ws.api.tools.WSContractConsumer;
+
+public class HelloWorldServlet extends HttpServlet {
+    @Override
+    public void doGet( HttpServletRequest theRequest,
+                       HttpServletResponse theResponse ) throws IOException {
+        PrintWriter pw = theResponse.getWriter();
+        String jbwsVersion = WSContractConsumer.newInstance().getClass().getPackage().getImplementationVersion();
+        if (jbwsVersion.startsWith("4.0") || jbwsVersion.startsWith("4.1.0") || jbwsVersion.startsWith("4.1.1") ) {
+            pw.print("[FIXME][JBWS-3589] This test is meant to be run properly on JBossWS 4.1.2.Final or greater");
+        } else {
+            String name = theRequest.getParameter("name");
+            pw.print("WS return: " + invokeWS(name));
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public Object invokeWS(String name) {
+	WSDynamicClient client = null;
+	try {
+	    URL wsdlURL = new URL("http://127.0.0.1:8080/basic/HelloWorld?wsdl");
+
+	    WSDynamicClientBuilder clientBuilder = WSDynamicClientFactory.getJAXWSClientBuilder();
+	    client = clientBuilder.verbose(true).keepSource(true).wsdlURL(wsdlURL.toString()).build();
+	    WSMethod method = client.getWSMethod("HelloService", "HelloWorldBeanPort", "echo");
+	    Map<String, Object> args = new java.util.HashMap<String, Object>();
+	    args.put("arg0", name);
+	    InvocationResult result = method.invoke(args, null);
+	    Map<String, Object> res = result.getMapRequestAndResult(null, null);
+	    Map<String, Object> test = (Map<String, Object>) res.get("results");
+	    client.close();
+	    return test.get("result");
+	} catch (Exception e) {
+	    throw new RuntimeException(e);
+	} finally {
+	    if (client != null) {
+		client.close();
+	    }
+	}
+    }
+}

Added: core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java
===================================================================
--- core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java	                        (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/java/org/jboss/wise/test/integration/incontainer/WiseIntegrationInContainerTest.java	2013-02-05 14:57:29 UTC (rev 495)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2013, Red Hat, Inc., 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.wise.test.integration.incontainer;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.wise.core.test.WiseTest;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class WiseIntegrationInContainerTest extends WiseTest {
+    private static URL warUrl = null;
+    private static URL servletWarUrl = null;
+
+    @BeforeClass
+    public static void setUp() throws Exception {
+	warUrl = WiseIntegrationInContainerTest.class.getClassLoader().getResource("basic.war");
+	servletWarUrl = WiseIntegrationInContainerTest.class.getClassLoader().getResource("incontainer.war");
+	deployWS(warUrl);
+	deployWS(servletWarUrl);
+    }
+
+    @Test
+    public void test() throws Exception {
+	URL url = new URL(getServerHostAndPort() + "/incontainer/HelloWorldServlet?name=foo");
+	BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+	String result = br.readLine();
+	if (result.startsWith("[FIXME]")) {
+	    System.out.println(result);
+	} else {
+	    Assert.assertEquals("WS return: foo", br.readLine());
+	}
+    }
+
+    @AfterClass
+    public static void tearDown() throws Exception {
+	try {
+	    undeployWS(warUrl);
+	} finally {
+	    warUrl = null;
+	}
+	try {
+	    undeployWS(servletWarUrl);
+	} finally {
+	    servletWarUrl = null;
+	}
+    }
+}

Added: core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/jboss-deployment-structure.xml
===================================================================
--- core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/jboss-deployment-structure.xml	                        (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/jboss-deployment-structure.xml	2013-02-05 14:57:29 UTC (rev 495)
@@ -0,0 +1,12 @@
+<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
+    <deployment>
+        <dependencies>
+          <!-- [WISE-183] replace dependencies below with wise module -->
+ 	      <module name="org.jboss.ws.cxf.jbossws-cxf-client" services="import" export="true"/>
+	      <module name="org.jboss.ws.common"/>
+	      <module name="org.jboss.common-core"/>
+	      <module name="org.apache.cxf"/>
+	      <module name="org.apache.cxf.impl" optional="true" /> <!-- impl submodule is available since AS 7.2 -->
+	    </dependencies>
+    </deployment>
+</jboss-deployment-structure>

Added: core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/web.xml
===================================================================
--- core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/web.xml	                        (rev 0)
+++ core/trunk/integration-testsuite/common/src/test/resources/WEB-INF/incontainer/web.xml	2013-02-05 14:57:29 UTC (rev 495)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<web-app 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"
+         version="2.4">
+
+    <servlet>
+        <servlet-name>HelloWorldServlet</servlet-name>
+        <servlet-class>org.jboss.wise.test.integration.incontainer.HelloWorldServlet</servlet-class>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>HelloWorldServlet</servlet-name>
+        <url-pattern>/HelloWorldServlet</url-pattern>
+    </servlet-mapping>
+
+</web-app>
+

Modified: core/trunk/integration-testsuite/pom.xml
===================================================================
--- core/trunk/integration-testsuite/pom.xml	2013-02-05 12:42:46 UTC (rev 494)
+++ core/trunk/integration-testsuite/pom.xml	2013-02-05 14:57:29 UTC (rev 495)
@@ -47,7 +47,6 @@
 			<groupId>org.jboss.wise</groupId>
 			<artifactId>wise-core</artifactId>
 			<version>${project.version}</version>
-			<scope>test</scope>
 		</dependency>
 
 		<dependency>



More information about the wise-commits mailing list