Permalink
Browse files

Various fixes to wsat-simple, and wsba-* quickstarts

* Move to Java EE 6 with tools BOM
* Disable war generation
* Disable jboss-as plugin
* Disable running tests with default profile
* Remove web.xml and use Servlet 3 annotations
* relocate context-handlers to src/test
* Switch to using Arquillian Servlet protocol
  • Loading branch information...
1 parent d15e1bb commit 259eff7749276f7f0e4051f95d902f9bd28edcec @pmuir pmuir committed Feb 14, 2012
Showing with 198 additions and 187 deletions.
  1. +41 −33 wsat-simple/pom.xml
  2. +2 −0 wsat-simple/src/main/java/org/jboss/as/quickstarts/wsat/simple/RestaurantServiceATImpl.java
  3. +0 −27 wsat-simple/src/main/resources/web.xml
  4. +1 −1 wsat-simple/src/test/java/org/jboss/as/quickstarts/wsat/simple/Client.java
  5. +8 −11 wsat-simple/src/test/java/org/jboss/as/quickstarts/wsat/simple/ClientTest.java
  6. +23 −0 wsat-simple/src/test/resources/arquillian.xml
  7. 0 wsat-simple/src/{main → test}/resources/context-handlers.xml
  8. +27 −10 wsba-coordinator-completion-simple/pom.xml
  9. +2 −0 ...le/src/main/java/org/jboss/as/quickstarts/wsba/coordinatorcompletion/simple/SetServiceBAImpl.java
  10. +0 −37 wsba-coordinator-completion-simple/src/main/resources/web.xml
  11. +1 −1 ...etion-simple/src/test/java/org/jboss/as/quickstarts/wsba/coordinatorcompletion/simple/Client.java
  12. +9 −15 ...n-simple/src/test/java/org/jboss/as/quickstarts/wsba/coordinatorcompletion/simple/ClientTest.java
  13. +23 −0 wsba-coordinator-completion-simple/src/test/resources/arquillian.xml
  14. 0 wsba-coordinator-completion-simple/src/{main → test}/resources/context-handlers.xml
  15. +26 −9 wsba-participant-completion-simple/pom.xml
  16. +2 −0 ...le/src/main/java/org/jboss/as/quickstarts/wsba/participantcompletion/simple/SetServiceBAImpl.java
  17. +0 −27 wsba-participant-completion-simple/src/main/resources/web.xml
  18. +1 −1 ...etion-simple/src/test/java/org/jboss/as/quickstarts/wsba/participantcompletion/simple/Client.java
  19. +9 −15 ...n-simple/src/test/java/org/jboss/as/quickstarts/wsba/participantcompletion/simple/ClientTest.java
  20. +23 −0 wsba-participant-completion-simple/src/test/resources/arquillian.xml
  21. 0 wsba-participant-completion-simple/src/{main → test}/resources/context-handlers.xml
View
@@ -6,7 +6,7 @@
<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-wsat-simple</artifactId>
<version>7.0.2-SNAPSHOT</version>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>JBoss AS Quickstarts: Simple WS-AT Web service</name>
<description>JBoss AS Quickstarts: Simple WS-AT Web service</description>
@@ -61,25 +61,21 @@
</pluginRepositories>
<dependencyManagement>
- <dependencies>
- <!-- Define the version of JBoss' Java EE 6 APIs we want to import.
- Any dependencies from org.jboss.spec will have their version defined by this
- BOM -->
- <!-- JBoss distributes a complete set of Java EE 6 APIs including
- a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
- a collection) of artifacts. We use this here so that we always get the correct
- versions of artifacts. Here we use the jboss-javaee-6.0 stack (you can
- read this as the JBoss stack of the Java EE 6 APIs). You can actually
- use this stack with any version of JBoss AS that implements Java EE 6, not
- just JBoss AS 7! -->
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>3.0.0.Beta1</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill
+ of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection)
+ of artifacts. We use this here so that we always get the correct versions
+ of artifacts. Here we use the jboss-javaee-6.0-with tools stack (you can read this as
+ the JBoss stack of the Java EE 6 APIs, with some extras tools for your project, such
+ as Arquillian for testing) -->
+ <dependency>
+ <groupId>org.jboss.bom</groupId>
+ <artifactId>jboss-javaee-6.0-with-tools</artifactId>
+ <version>1.0.0.M2</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
</dependencyManagement>
<dependencies>
@@ -130,40 +126,33 @@ as the API is included in JBoss AS 7 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
- <version>1.0.0.CR7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
- <version>1.0.0.CR7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
- <!-- Set the name of the war, used as the context root when the app
- is deployed -->
- <finalName>${project.artifactId}</finalName>
<plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- </plugin>
- <!-- JBoss AS plugin to deploy war -->
+ <!-- JBoss AS deployment disabled, as this is a test-only example! -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.1.0.CR1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
@@ -180,6 +169,27 @@ as the API is included in JBoss AS 7 -->
<profiles>
<profile>
+ <!-- The default profile skips all tests, though you can tune it
+ to run just unit tests based on a custom pattern -->
+ <!-- Seperate profiles are provided for running all tests, including
+ Arquillian tests that execute in the specified container -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<!-- An optional Arquillian testing profile that executes tests
in your JBoss AS instance -->
<!-- This profile will start a new JBoss AS instance, and execute
@@ -190,7 +200,6 @@ as the API is included in JBoss AS 7 -->
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>7.1.0.CR1b</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -206,7 +215,6 @@ as the API is included in JBoss AS 7 -->
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
- <version>7.1.0.CR1b</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -39,6 +39,7 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.servlet.annotation.WebServlet;
/**
* An adapter class that exposes the RestaurantManager business API as a transactional Web Service.
@@ -49,6 +50,7 @@
@WebService(serviceName = "RestaurantServiceATService", portName = "RestaurantServiceAT", name = "RestaurantServiceAT", targetNamespace = "http://www.jboss.com/jbossas/quickstarts/wsat/simple/Restaurant")
@HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")
@SOAPBinding(style = SOAPBinding.Style.RPC)
+@WebServlet("/RestaurantServiceAT")
public class RestaurantServiceATImpl implements RestaurantServiceAT {
private MockRestaurantManager mockRestaurantManager = MockRestaurantManager.getSingletonInstance();
@@ -1,27 +0,0 @@
-<!-- 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 in the distribution for a full listing of individual contributors.
- This copyrighted material is made available to anyone wishing to use, modify,
- copy, or redistribute it subject to the terms and conditions of the GNU Lesser
- General Public License, v. 2.1. This program is distributed in the hope that
- it will be useful, but WITHOUT A 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, v.2.1 along with this distribution;
- if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
- Fifth Floor, Boston, MA 02110-1301, USA. (C) 2005-2006, @author JBoss Inc. -->
-<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>RestaurantServiceAT</servlet-name>
- <servlet-class>org.jboss.as.quickstarts.wsat.simple.RestaurantServiceATImpl</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>RestaurantServiceAT</servlet-name>
- <url-pattern>/RestaurantServiceAT</url-pattern>
- </servlet-mapping>
-
-</web-app>
@@ -50,7 +50,7 @@
* @throws MalformedURLException if the WSDL url is malformed.
*/
public Client() throws MalformedURLException {
- URL wsdlLocation = new URL("http://localhost:8080/simple_wsat/RestaurantServiceAT?wsdl");
+ URL wsdlLocation = new URL("http://localhost:8080/test/RestaurantServiceAT?wsdl");
QName serviceName = new QName("http://www.jboss.com/jbossas/quickstarts/wsat/simple/Restaurant",
"RestaurantServiceATService");
QName portName = new QName("http://www.jboss.com/jbossas/quickstarts/wsat/simple/Restaurant", "RestaurantServiceAT");
@@ -25,6 +25,9 @@
@RunWith(Arquillian.class)
public class ClientTest {
+ private static final String ManifestMF = "Manifest-Version: 1.0\n"
+ + "Dependencies: org.jboss.xts,org.jboss.modules,org.jboss.msc,org.jboss.jts\n";
+
@Inject
@ClientStub
private RestaurantServiceAT client;
@@ -37,18 +40,12 @@
@Deployment
public static WebArchive createTestArchive() {
- WebArchive archive = ShrinkWrap.create(WebArchive.class, "simple_wsat.war")
- .addPackages(true, "org.jboss.as.quickstarts.wsat.simple").addAsResource("context-handlers.xml")
- .addAsWebInfResource("web.xml", "web.xml")
- .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addPackages(true, RestaurantServiceATImpl.class.getPackage())
+ .addAsResource("context-handlers.xml")
+ .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"))
- // Specify the module dependencies
- archive.delete(ArchivePaths.create("META-INF/MANIFEST.MF"));
- String ManifestMF = "Manifest-Version: 1.0\n"
- + "Dependencies: org.jboss.xts,org.jboss.modules,deployment.arquillian-service,org.jboss.msc,org.jboss.jts\n";
- archive.setManifest(new StringAsset(ManifestMF));
-
- return archive;
+ .setManifest(new StringAsset(ManifestMF));
}
/**
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<arquillian xmlns="http://jboss.org/schema/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://jboss.org/schema/arquillian
+ http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
+
+ <!-- Uncomment to have test archives exported to the file system for inspection -->
+ <engine>
+ <property name="deploymentExportPath">target/</property>
+ </engine>
+
+ <!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->
+ <defaultProtocol type="Servlet 3.0" />
+
+ <!-- Example configuration for a remote JBoss AS 7 instance -->
+ <container qualifier="jboss" default="true">
+ <!-- If you want to use the JBOSS_HOME environment variable, just delete the jbossHome property -->
+ <configuration>
+ <property name="jbossHome">/path/to/jboss/as</property>
+ </configuration>
+ </container>
+
+</arquillian>
@@ -6,7 +6,7 @@
<groupId>org.jboss.as.quickstarts</groupId>
<artifactId>jboss-as-wsba-coordinator-completion-simple</artifactId>
<version>7.0.2-SNAPSHOT</version>
- <packaging>war</packaging>
+ <packaging>jar</packaging>
<name>JBoss AS Quickstarts: Simple WS-BA with Coordinator Driven Completion</name>
<description>JBoss AS Quickstarts: Simple WS-BA with Coordinator Driven Completion</description>
@@ -145,19 +145,15 @@ as the API is included in JBoss AS 7 -->
</dependencies>
<build>
- <!-- Set the name of the war, used as the context root when the app
- is deployed -->
- <finalName>${project.artifactId}</finalName>
<plugins>
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- </plugin>
- <!-- JBoss AS plugin to deploy war -->
+ <!-- JBoss AS deployment disabled, as this is a test-only example! -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
- <version>7.1.0.Beta1b</version>
+ <version>7.1.0.CR1</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
</plugin>
<!-- Compiler plugin enforces Java 1.6 compatibility and activates
annotation processors -->
@@ -174,6 +170,27 @@ as the API is included in JBoss AS 7 -->
<profiles>
<profile>
+ <!-- The default profile skips all tests, though you can tune it
+ to run just unit tests based on a custom pattern -->
+ <!-- Seperate profiles are provided for running all tests, including
+ Arquillian tests that execute in the specified container -->
+ <id>default</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<!-- An optional Arquillian testing profile that executes tests
in your JBoss AS instance -->
<!-- This profile will start a new JBoss AS instance, and execute
@@ -29,6 +29,7 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
+import javax.servlet.annotation.WebServlet;
/**
* An adapter class that exposes a set as a transactional Web Service.
@@ -38,6 +39,7 @@
@WebService(serviceName = "SetServiceBAService", portName = "SetServiceBA", name = "SetServiceBA", targetNamespace = "http://www.jboss.com/as/quickstarts/helloworld/wsba/coordinatorcompletion/set")
@HandlerChain(file = "/context-handlers.xml", name = "Context Handlers")
@SOAPBinding(style = SOAPBinding.Style.RPC)
+@WebServlet("/SetServiceBA")
public class SetServiceBAImpl implements SetServiceBA {
/**
* Add an item to a set and enroll a Participant if necessary then pass the call through to the business logic.
@@ -1,37 +0,0 @@
-<!--
- 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 in the distribution for a full listing
- of individual contributors.
- This copyrighted material is made available to anyone wishing to use,
- modify, copy, or redistribute it subject to the terms and conditions
- of the GNU Lesser General Public License, v. 2.1.
- This program is distributed in the hope that it will be useful, but WITHOUT A
- 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,
- v.2.1 along with this distribution; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- MA 02110-1301, USA.
-
-
- (C) 2005-2006,
- @author JBoss Inc.
--->
-<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>SetServiceBA</servlet-name>
- <servlet-class>org.jboss.as.quickstarts.wsba.coordinatorcompletion.simple.SetServiceBAImpl</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>SetServiceBA</servlet-name>
- <url-pattern>/SetServiceBA</url-pattern>
- </servlet-mapping>
-
-</web-app>
@@ -48,7 +48,7 @@
* @throws MalformedURLException if the WSDL url is malformed.
*/
public Client() throws MalformedURLException {
- URL wsdlLocation = new URL("http://localhost:8080/wsba/SetServiceBA?wsdl");
+ URL wsdlLocation = new URL("http://localhost:8080/test/SetServiceBA?wsdl");
QName serviceName = new QName("http://www.jboss.com/as/quickstarts/helloworld/wsba/coordinatorcompletion/set",
"SetServiceBAService");
QName portName = new QName("http://www.jboss.com/as/quickstarts/helloworld/wsba/coordinatorcompletion/set",
Oops, something went wrong.

0 comments on commit 259eff7

Please sign in to comment.