Author: asoldano
Date: 2014-02-07 10:18:46 -0500 (Fri, 07 Feb 2014)
New Revision: 18314
Added:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/Person.java
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java
Log:
[JBWS-3617] Adding jaxws tools plugin invocations to properly decouple client and server
in the generated project
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml 2014-02-07
10:55:20 UTC (rev 18313)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/META-INF/maven/archetype.xml 2014-02-07
15:18:46 UTC (rev 18314)
@@ -1,5 +1,5 @@
<archetype>
- <id>jaxws-codefirst</id>
+ <id>$artifactId</id>
<sources>
<source>src/main/java/HelloWorld.java</source>
<source>src/main/java/HelloWorldImpl.java</source>
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml 2014-02-07
10:55:20 UTC (rev 18313)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/pom.xml 2014-02-07
15:18:46 UTC (rev 18314)
@@ -47,6 +47,7 @@
</repositories>
<build>
<testResources>
+ <!-- Copy the Log4J configuration in the test classpath -->
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
@@ -55,7 +56,8 @@
</includes>
</testResource>
</testResources>
- <finalName>jaxws-codefirst</finalName>
+ <!-- The name of the WAR deployment -->
+ <finalName>$artifactId</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
@@ -66,6 +68,7 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
+ <!-- The plugin for WildFly deploy / undeploy -->
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
@@ -78,7 +81,47 @@
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
+ <!-- JBossWS JAXWS tools plugins -->
<plugin>
+ <groupId>org.jboss.ws.plugins</groupId>
+ <artifactId>maven-jaxws-tools-plugin</artifactId>
+ <version>1.1.1.Final</version>
+ <configuration>
+ <verbose>true</verbose>
+ </configuration>
+ <executions>
+ <execution>
+ <!-- Run wsprovide to create the wsdl for the endpoint to be used later
-->
+ <!-- This also create the request/response wrapper classes that are also
included in the deployement (actually optional w/ JBossWS) -->
+ <id>wsprovide execution</id>
+ <goals>
+ <goal>wsprovide</goal>
+ </goals>
+ <configuration>
+ <endpointClass>${package}.HelloWorldImpl</endpointClass>
+ <generateWsdl>true</generateWsdl>
+ </configuration>
+ </execution>
+ <execution>
+ <!-- Run wsconsume in generate-test-sources phase to generate the portable
artifacts for creating a test client -->
+ <id>wsconsume execution</id>
+ <goals>
+ <goal>wsconsume-test</goal>
+ </goals>
+ <configuration>
+ <fork>true</fork> <!-- Fork mode to specify the log conf sys
prop below -->
+
<argLine>-Dlog4j.output.dir=\${project.build.directory}</argLine>
+ <wsdls>
+
<wsdl>\${project.build.directory}/wsprovide/resources/HelloWorldService.wsdl</wsdl>
+ </wsdls>
+ <targetPackage>client</targetPackage>
+
<outputDirectory>\${project.build.directory}/wsconsume</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Surefire (tests) plugin -->
+ <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<configuration>
@@ -92,6 +135,7 @@
</systemProperties>
</configuration>
<executions>
+ <!-- The integration tests execution, for tests against a running container
with the deployment available -->
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
@@ -106,6 +150,7 @@
</includes>
</configuration>
</execution>
+ <!-- The unit tests execution -->
<execution>
<id>tests</id>
<phase>test</phase>
@@ -128,4 +173,50 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <!-- A profile for avoid meaningless Eclipse warnings / errors (see
https://issues.jboss.org/browse/JBWS-3666) -->
+ <profile>
+ <id>eclipse-m2e</id>
+ <activation>
+ <property>
+ <name>!eclipse-m2e</name>
+ </property>
+ </activation>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.jboss.ws.plugins</groupId>
+ <artifactId>maven-jaxws-tools-plugin</artifactId>
+ <versionRange>[1.1.1.Final,)</versionRange>
+ <goals>
+ <goal>wsconsume</goal>
+ <goal>wsconsume-test</goal>
+ <goal>wsprovide</goal>
+ <goal>wsprovide-test</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java 2014-02-07
10:55:20 UTC (rev 18313)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorld.java 2014-02-07
15:18:46 UTC (rev 18314)
@@ -5,5 +5,6 @@
@WebService(targetNamespace = "http://hello.world.ns/")
public interface HelloWorld {
String sayHi(String text);
+ String greetings(Person person);
}
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java 2014-02-07
10:55:20 UTC (rev 18313)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/HelloWorldImpl.java 2014-02-07
15:18:46 UTC (rev 18314)
@@ -1,16 +1,26 @@
package ${package};
import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.Style;
+import javax.jws.soap.SOAPBinding.Use;
@WebService(endpointInterface = "${package}.HelloWorld",
targetNamespace = "http://hello.world.ns/",
name = "HelloWorld",
serviceName = "HelloWorldService",
portName = "HelloWorldPort")
+@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL)
public class HelloWorldImpl implements HelloWorld {
public String sayHi(String text) {
+ System.out.println(text);
return "Hello " + text;
}
+
+ public String greetings(Person person) {
+ System.out.println(person);
+ return "Greetings " + person.getName() + " " +
person.getSurname();
+ }
}
Added:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/Person.java
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/Person.java
(rev 0)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/Person.java 2014-02-07
15:18:46 UTC (rev 18314)
@@ -0,0 +1,23 @@
+package ${package};
+
+public class Person {
+ private String name;
+ private String surname;
+
+ public Person() {
+
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getSurname() {
+ return surname;
+ }
+ public void setSurname(String surname) {
+ this.surname = surname;
+ }
+}
\ No newline at end of file
Property changes on:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/main/java/Person.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
Modified:
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java
===================================================================
---
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java 2014-02-07
10:55:20 UTC (rev 18313)
+++
projects/plugins/maven/archetypes/jaxws-codefirst/trunk/src/main/resources/archetype-resources/src/test/java/HelloWorldIntegrationTest.java 2014-02-07
15:18:46 UTC (rev 18314)
@@ -2,19 +2,23 @@
import java.net.URL;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
import org.junit.Assert;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
+import client.HelloWorld;
+import client.HelloWorldService;
+import client.Person;
+
public class HelloWorldIntegrationTest {
@Test
- public void testSayHi() throws Exception {
- Service service = Service.create(new
URL("http://localhost:8080/jaxws-codefirst/HelloWorldService?wsdl"), new
QName("http://hello.world.ns/", "HelloWorldService"));
- HelloWorld port = service.getPort(new QName("http://hello.world.ns/",
"HelloWorldPort"), HelloWorld.class);
+ public void testHelloWorld() throws Exception {
+ HelloWorldService service = new HelloWorldService(new
URL("http://localhost:8080/\${artifactId}/HelloWorldService?wsdl"));
+ HelloWorld port = service.getHelloWorldPort();
Assert.assertEquals("Hello John", port.sayHi("John"));
+ Person p = new Person();
+ p.setName("Anne");
+ p.setSurname("Li");
+ Assert.assertEquals("Greetings Anne Li", port.greetings(p));
}
}