[jbossws-commits] JBossWS SVN: r14328 - in stack/cxf/trunk: modules/testsuite and 6 other directories.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Mon May 9 09:43:04 EDT 2011
Author: richard.opalka at jboss.com
Date: 2011-05-09 09:43:04 -0400 (Mon, 09 May 2011)
New Revision: 14328
Added:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/ClientHelper.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
Removed:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/main/
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
stack/cxf/trunk/modules/testsuite/pom.xml
stack/cxf/trunk/modules/testsuite/shared-tests/pom.xml
stack/cxf/trunk/pom.xml
Log:
shared-testsuite have to have test scope - refactoring CXF helper classes to test sources - fixing JVM property propagation
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-05-09 13:26:25 UTC (rev 14327)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/scripts/cxf-jars-jaxws.xml 2011-05-09 13:43:04 UTC (rev 14328)
@@ -95,8 +95,6 @@
<include name="org/jboss/test/ws/jaxws/cxf/gzip/Helper.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/gzip/GZIPEnforcingInInterceptor.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/gzip/HelloWorld.class"/>
- </classes>
- <classes dir="${tests.output.dir}/classes">
<include name="org/jboss/wsf/test/TestServlet.class"/>
<include name="org/jboss/wsf/test/ClientHelper.class"/>
</classes>
@@ -121,15 +119,13 @@
<include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/UserType.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/AnnotatedUserEndpoint.class"/>
<include name="org/jboss/test/ws/jaxws/cxf/jaxbintros/AnnotatedUserType.class"/>
+ <include name="org/jboss/wsf/test/TestServlet.class"/>
+ <include name="org/jboss/wsf/test/ClientHelper.class"/>
<include name="test-resources/jaxws/cxf/jaxbintros/META-INF/jaxb-intros.xml"/>
</classes>
<classes dir="${tests.output.dir}/test-resources/jaxws/cxf/jaxbintros/META-INF">
<include name="jaxb-intros.xml"/>
</classes>
- <classes dir="${tests.output.dir}/classes">
- <include name="org/jboss/wsf/test/TestServlet.class"/>
- <include name="org/jboss/wsf/test/ClientHelper.class"/>
- </classes>
<manifest>
<attribute name="Dependencies" value="org.jboss.ws.cxf.jbossws-cxf-client services"/>
</manifest>
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/ClientHelper.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/ClientHelper.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/ClientHelper.java 2011-05-09 13:43:04 UTC (rev 14328)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.wsf.test;
+
+public interface ClientHelper
+{
+ public void setTargetEndpoint(String address);
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/JBossWSCXFTestSetup.java 2011-05-09 13:43:04 UTC (rev 14328)
@@ -0,0 +1,78 @@
+/*
+ * 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.wsf.test;
+
+import junit.framework.Test;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.jboss.logging.Logger;
+import org.jboss.wsf.test.JBossWSTestSetup;
+
+public class JBossWSCXFTestSetup extends JBossWSTestSetup
+{
+ private Bus defaultBus;
+
+ public JBossWSCXFTestSetup(Class<?> testClass, String archiveList)
+ {
+ super(testClass, archiveList);
+ }
+
+ public JBossWSCXFTestSetup(Test test, String archiveList)
+ {
+ super(test, archiveList);
+ }
+
+ public JBossWSCXFTestSetup(Test test)
+ {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ defaultBus = BusFactory.getDefaultBus(false);
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ try
+ {
+ Bus afterTestsDefaultBus = BusFactory.getDefaultBus(false);
+
+ if (defaultBus == null && afterTestsDefaultBus != null)
+ {
+ Logger.getLogger(this.getClass()).info("Default CXF bus has been set during test execution");
+ }
+ else if (defaultBus != afterTestsDefaultBus)
+ {
+ throw new Exception("CXF Default bus changed during test: \nBEFORE: " + defaultBus + "\nAFTER: "
+ + afterTestsDefaultBus);
+ }
+ }
+ finally
+ {
+ defaultBus = null; //remove reference, to help GC
+ super.tearDown();
+ }
+ }
+}
Added: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java (rev 0)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/wsf/test/TestServlet.java 2011-05-09 13:43:04 UTC (rev 14328)
@@ -0,0 +1,135 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2011, 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.wsf.test;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 01-Apr-2011
+ *
+ */
+ at WebServlet(name = "TestServlet", urlPatterns = "/*")
+public class TestServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ String helperClassName = req.getParameter("helper");
+ if (helperClassName == null || helperClassName.length() == 0)
+ throw new ServletException("helper not specified!");
+ String path = req.getParameter("path");
+ if (path == null || path.length() == 0)
+ throw new ServletException("path not specified!");
+ try
+ {
+ ClientHelper helper = (ClientHelper) Class.forName(helperClassName).newInstance();
+ helper.setTargetEndpoint("http://" + System.getProperty("jboss.bind.address", "localhost") + ":8080" + path);
+ List<String> failedTests = new LinkedList<String>();
+ List<String> errorTests = new LinkedList<String>();
+ Method[] methods = helper.getClass().getMethods();
+ String methodName = req.getParameter("method");
+ int testsRun = 0;
+ if (methodName != null && methodName.length() > 0)
+ {
+ Method m = null;
+ m = helper.getClass().getMethod(methodName);
+ testsRun++;
+ invokeMethod(m, helper, failedTests, errorTests);
+ }
+ else
+ {
+ for (Method m : methods)
+ {
+ if (m.getName().startsWith("test") && m.getParameterTypes().length == 0
+ && m.getReturnType().equals(boolean.class))
+ {
+ testsRun++;
+ invokeMethod(m, helper, failedTests, errorTests);
+ }
+ }
+ }
+ if (failedTests.isEmpty() && errorTests.isEmpty())
+ {
+ res.getWriter().print(testsRun);
+ }
+ else
+ {
+ PrintWriter w = res.getWriter();
+ w.print("# Failed tests: ");
+ for (Iterator<String> it = failedTests.iterator(); it.hasNext();)
+ {
+ w.print(it.next());
+ if (it.hasNext())
+ w.print(", ");
+ }
+ res.getWriter().print(" # Error tests: ");
+ for (Iterator<String> it = errorTests.iterator(); it.hasNext();)
+ {
+ w.print(it.next());
+ if (it.hasNext())
+ w.print(", ");
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+
+ private void invokeMethod(Method m, ClientHelper helper, List<String> failedTests, List<String> errorTests) throws ServletException
+ {
+ try
+ {
+ if (!(Boolean)m.invoke(helper))
+ {
+ failedTests.add(m.getName());
+ }
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable thrownException = e.getTargetException();
+ errorTests.add(m.getName() + ": " + thrownException.getClass().getName() + " " + thrownException.getMessage());
+ thrownException.printStackTrace();
+ }
+ catch (Exception e)
+ {
+ throw new ServletException(e);
+ }
+ }
+}
Modified: stack/cxf/trunk/modules/testsuite/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/pom.xml 2011-05-09 13:26:25 UTC (rev 14327)
+++ stack/cxf/trunk/modules/testsuite/pom.xml 2011-05-09 13:43:04 UTC (rev 14328)
@@ -637,13 +637,13 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
- <compilerArgument>-Djava.endorsed.dirs=${jboss600.home}/lib/endorsed -Dorg.jboss.wsf.spi.deployer.Deployer=org.jboss.wsf.test.DeployerJBoss6</compilerArgument>
+ <compilerArgument>-Djava.endorsed.dirs=${jboss600.home}/lib/endorsed</compilerArgument>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>${surefire.jvm.args} ${surefire.jvm.management.args} -Djava.endorsed.dirs=${jboss600.home}/lib/endorsed</argLine>
+ <argLine>${surefire.jvm.args} ${surefire.jvm.management.args} -Djava.endorsed.dirs=${jboss600.home}/lib/endorsed -Dorg.jboss.wsf.spi.deployer.Deployer=org.jboss.wsf.test.DeployerJBoss6</argLine>
<!-- TODO: replace with maven dependencies -->
<additionalClasspathElements>
<!-- Lib below required just for jaxrpc tests; listed here to prevent CXF stack from depending on Native stack -->
Modified: stack/cxf/trunk/modules/testsuite/shared-tests/pom.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/shared-tests/pom.xml 2011-05-09 13:26:25 UTC (rev 14327)
+++ stack/cxf/trunk/modules/testsuite/shared-tests/pom.xml 2011-05-09 13:43:04 UTC (rev 14328)
@@ -87,24 +87,6 @@
</artifactItems>
</configuration>
</execution>
- <execution> <!-- This is used by WSRunClientTestCase -->
- <id>copy-junit</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <type>jar</type>
- <outputDirectory>${basedir}/target/junit-libs</outputDirectory>
- <destFileName>junit.jar</destFileName>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
</executions>
</plugin>
<plugin>
Modified: stack/cxf/trunk/pom.xml
===================================================================
--- stack/cxf/trunk/pom.xml 2011-05-09 13:26:25 UTC (rev 14327)
+++ stack/cxf/trunk/pom.xml 2011-05-09 13:43:04 UTC (rev 14328)
@@ -117,12 +117,14 @@
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-shared-testsuite</artifactId>
<version>${jbossws.shared.testsuite.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-shared-testsuite</artifactId>
<version>${jbossws.shared.testsuite.version}</version>
<type>zip</type>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.ws</groupId>
@@ -1173,14 +1175,25 @@
<artifactId>easymockclassextension</artifactId>
<version>2.4</version>
</dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
-
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-shared-testsuite</artifactId>
+ <version>${jbossws.shared.testsuite.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ws</groupId>
+ <artifactId>jbossws-shared-testsuite</artifactId>
+ <version>${jbossws.shared.testsuite.version}</version>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</dependencyManagement>
More information about the jbossws-commits
mailing list