Author: bimargulies Date: Mon Nov 14 19:03:56 2011 New Revision: 1201826 URL: http://svn.apache.org/viewvc?rev=1201826&view=rev Log: CXF-3912: add an archetype for JAX-RS.
Added: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml (with props) cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java (with props) cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties (with props) cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/goal.txt (with props) Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/pom.xml cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/HelloWorld.java cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/JsonBean.java cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/pom.xml?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/pom.xml (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/pom.xml Mon Nov 14 19:03:56 2011 @@ -1,63 +1,32 @@ -<?xml version="1.0"?> -<!-- - licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-parent</artifactId> - <version>2.5.1-SNAPSHOT</version> - <relativePath>../../../parent/pom.xml</relativePath> - </parent> - <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.cxf.archetype</groupId> - <artifactId>cxf-jaxrs-service</artifactId> - <packaging>maven-archetype</packaging> - <name>Apache CXF Archetype - Simple JAX-RS Service</name> - <description>Creates a webapp for JAX-RS services</description> - <version>2.5.1-SNAPSHOT</version> - <url>http://cxf.apache.org</url> - <properties> - <maven.test.skip>true</maven.test.skip> - <eclipse.skip>true</eclipse.skip> - </properties> - <build> - <extensions> - <extension> - <groupId>org.apache.maven.archetype</groupId> - <artifactId>archetype-packaging</artifactId> - <version>2.1</version> - </extension> - </extensions> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-archetype-plugin</artifactId> - <version>2.1</version> - </plugin> - </plugins> - </pluginManagement> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - </build> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-jaxrs-simple-sample-archetype</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>maven-archetype</packaging> + + <name>cxf-jaxrs-simple-sample-archetype</name> + + <build> + <extensions> + <extension> + <groupId>org.apache.maven.archetype</groupId> + <artifactId>archetype-packaging</artifactId> + <version>2.2-SNAPSHOT</version> + </extension> + </extensions> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-archetype-plugin</artifactId> + <version>2.2-SNAPSHOT</version> + </plugin> + </plugins> + </pluginManagement> + </build> + + <description>Simple CXF JAX-RS webapp service using spring configuration</description> </project> Added: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1201826&view=auto ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml (added) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml Mon Nov 14 19:03:56 2011 @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="cxf-jaxrs-simple-sample" + xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <requiredProperties> + <requiredProperty key="cxf-version"> + <defaultValue>2.5.0</defaultValue> + </requiredProperty> + </requiredProperties> + <fileSets> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/main/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>src/main/webapp</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet filtered="true" packaged="true" encoding="UTF-8"> + <directory>src/test/java</directory> + <includes> + <include>**/*.java</include> + </includes> + </fileSet> + <fileSet filtered="true" encoding="UTF-8"> + <directory>.settings</directory> + <includes> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet encoding="UTF-8"> + <directory>.settings</directory> + <includes> + <include>**/*.prefs</include> + <include>**/*.component</include> + <include>**/*.container</include> + <include>**/*.name</include> + <include>**/*.jsdtscope</include> + </includes> + </fileSet> + <fileSet encoding="UTF-8"> + <directory></directory> + <includes> + <include>.classpath</include> + <include>.gitignore</include> + <include>.project</include> + </includes> + </fileSet> + </fileSets> +</archetype-descriptor> Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/META-INF/maven/archetype-metadata.xml ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/pom.xml Mon Nov 14 19:03:56 2011 @@ -1,68 +1,163 @@ -## licensed to the Apache Software Foundation (ASF) under one -## or more contributor license agreements. See the NOTICE file -## distributed with this work for additional information -## regarding copyright ownership. The ASF licenses this file -## to you under the Apache License, Version 2.0 (the -## "License"); you may not use this file except in compliance -## with the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, -## software distributed under the License is distributed on an -## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -## KIND, either express or implied. See the License for the -## specific language governing permissions and limitations -## under the License. -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <modelVersion>4.0.0</modelVersion> - <groupId>$groupId</groupId> - <artifactId>$artifactId</artifactId> - <version>$version</version> - <packaging>war</packaging> - <name>Simple CXF JAX-RS webapp service using spring configuration</name> - <description>Simple CXF JAX-RS webapp service using spring configuration</description> - <dependencies> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxrs</artifactId> - <version>${project.version}</version> - </dependency> +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>${groupId}</groupId> + <artifactId>${artifactId}</artifactId> + <version>${version}</version> + <packaging>war</packaging> + <name>Simple CXF JAX-RS webapp service using spring configuration</name> + <description>Simple CXF JAX-RS webapp service using spring configuration</description> + <properties> + <cxf.version>2.5.0</cxf.version> + <jackson.version>1.8.6</jackson.version> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-asl</artifactId> - <version>1.8.6</version> + <version>${jackson.version}</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId> - <version>1.8.6</version> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>org.codehaus.jackson</groupId> + <artifactId>jackson-jaxrs</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.10</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-api</artifactId> + <version>${cxf.version}</version> </dependency> - </dependencies> - <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.5</source> - <target>1.5</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-eclipse-plugin</artifactId> - <configuration> - <projectNameTemplate>[artifactId]-[version]</projectNameTemplate> - <wtpmanifest>true</wtpmanifest> - <wtpapplicationxml>true</wtpapplicationxml> - <wtpversion>2.0</wtpversion> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - + </dependencies> + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + <version>1.1</version> + <executions> + <execution> + <id>default-cli</id> + <goals> + <goal>run</goal> + </goals> + <configuration> + <port>13000</port> + <path>/jaxrs-service</path> + <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.5</source> + <target>1.5</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <configuration> + <projectNameTemplate>[artifactId]-[version]</projectNameTemplate> + <wtpmanifest>true</wtpmanifest> + <wtpapplicationxml>true</wtpapplicationxml> + <wtpversion>2.0</wtpversion> + </configuration> + </plugin> + </plugins> + </pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.5</version> + <executions> + <execution> + <id>reserve-network-port</id> + <goals> + <goal>reserve-network-port</goal> + </goals> + <phase>process-test-resources</phase> + <configuration> + <portNames> + <portName>test.server.port</portName> + </portNames> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>tomcat-maven-plugin</artifactId> + <executions> + <execution> + <id>start-tomcat</id> + <goals> + <goal>run-war</goal> + </goals> + <phase>pre-integration-test</phase> + <configuration> + <port>${test.server.port}</port> + <path>/jaxrs-service</path> + <fork>true</fork> + <useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader> + </configuration> + </execution> + <execution> + <id>stop-tomcat</id> + <goals> + <goal>shutdown</goal> + </goals> + <phase>post-integration-test</phase> + <configuration> + <path>/jaxrs-service</path> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <version>2.8.1</version> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>integration-test</goal> + </goals> + <configuration> + <systemPropertyVariables> + <service.url>http://localhost:${test.server.port}/jaxrs-service</service.url> + </systemPropertyVariables> + </configuration> + </execution> + <execution> + <id>verify</id> + <goals> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/HelloWorld.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/HelloWorld.java?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/HelloWorld.java (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/HelloWorld.java Mon Nov 14 19:03:56 2011 @@ -1,31 +1,14 @@ -## Licensed to the Apache Software Foundation (ASF) under one -## or more contributor license agreements. See the NOTICE file -## distributed with this work for additional information -## regarding copyright ownership. The ASF licenses this file -## to you under the Apache License, Version 2.0 (the -## "License"); you may not use this file except in compliance -## with the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, -## software distributed under the License is distributed on an -## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -## KIND, either express or implied. See the License for the -## specific language governing permissions and limitations -## under the License. - -package ${packageName}; - +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; -import javax.ws.rs.core.StreamingOutput; @Path("/hello") public class HelloWorld { @@ -40,6 +23,7 @@ public class HelloWorld { @POST @Produces("application/json") @Consumes("application/json") + @Path("/jsonBean") public Response modifyJson(JsonBean input) { input.setVal2(input.getVal1()); return Response.ok().entity(input).build(); Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/JsonBean.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/JsonBean.java?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/JsonBean.java (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/java/JsonBean.java Mon Nov 14 19:03:56 2011 @@ -1,21 +1,8 @@ -## Licensed to the Apache Software Foundation (ASF) under one -## or more contributor license agreements. See the NOTICE file -## distributed with this work for additional information -## regarding copyright ownership. The ASF licenses this file -## to you under the Apache License, Version 2.0 (the -## "License"); you may not use this file except in compliance -## with the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, -## software distributed under the License is distributed on an -## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -## KIND, either express or implied. See the License for the -## specific language governing permissions and limitations -## under the License. +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; -package ${packageName}; public class JsonBean { private String val1; @@ -30,7 +17,7 @@ public class JsonBean { } public String getVal2() { - return val1; + return val2; } public void setVal2(String val2) { Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/beans.xml Mon Nov 14 19:03:56 2011 @@ -1,19 +1,6 @@ -## licensed to the Apache Software Foundation (ASF) under one -## or more contributor license agreements. See the NOTICE file -## distributed with this work for additional information -## regarding copyright ownership. The ASF licenses this file -## to you under the Apache License, Version 2.0 (the -## "License"); you may not use this file except in compliance -## with the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, -## software distributed under the License is distributed on an -## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -## KIND, either express or implied. See the License for the -## specific language governing permissions and limitations -## under the License. +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -35,7 +22,7 @@ http://cxf.apache.org/schemas/jaxrs.xsd" <jaxrs:server id="services" address="/"> <jaxrs:serviceBeans> - <bean class="${packagename}.HelloWorld" /> + <bean class="${package}.HelloWorld" /> </jaxrs:serviceBeans> <jaxrs:providers> <bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/> Modified: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml?rev=1201826&r1=1201825&r2=1201826&view=diff ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml (original) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Mon Nov 14 19:03:56 2011 @@ -1,27 +1,15 @@ -## licensed to the Apache Software Foundation (ASF) under one -## or more contributor license agreements. See the NOTICE file -## distributed with this work for additional information -## regarding copyright ownership. The ASF licenses this file -## to you under the Apache License, Version 2.0 (the -## "License"); you may not use this file except in compliance -## with the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, -## software distributed under the License is distributed on an -## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -## KIND, either express or implied. See the License for the -## specific language governing permissions and limitations -## under the License. -<?xml version="1.0" encoding="ISO-8859-1"?> +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +<?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"> + <display-name>JAX-RS Simple Service</display-name> + <description>JAX-RS Simple Service</description> -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd"> - - -<web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/beans.xml</param-value> @@ -35,7 +23,6 @@ <servlet> <servlet-name>CXFServlet</servlet-name> - <display-name>CXF Servlet</display-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> Added: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java?rev=1201826&view=auto ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java (added) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java Mon Nov 14 19:03:56 2011 @@ -0,0 +1,54 @@ +#set( $symbol_pound = '#' ) +#set( $symbol_dollar = '$' ) +#set( $symbol_escape = '\' ) +package ${package}; + +import static org.junit.Assert.assertEquals; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.ws.rs.core.Response; + +import org.apache.cxf.helpers.IOUtils; +import org.apache.cxf.jaxrs.client.WebClient; +import org.codehaus.jackson.JsonParser; +import org.codehaus.jackson.map.MappingJsonFactory; +import org.junit.BeforeClass; +import org.junit.Test; + +public class HelloWorldIT { + private static String endpointUrl; + + @BeforeClass + public static void beforeClass() { + endpointUrl = System.getProperty("service.url"); + } + + @Test + public void testPing() throws Exception { + WebClient client = WebClient.create(endpointUrl + "/hello/echo/SierraTangoNevada"); + Response r = client.accept("text/plain").get(); + assertEquals(Response.Status.OK.getStatusCode(), r.getStatus()); + String value = IOUtils.toString((InputStream)r.getEntity()); + assertEquals("SierraTangoNevada", value); + } + + @Test + public void testJsonRoundtrip() throws Exception { + List<Object> providers = new ArrayList<Object>(); + providers.add(new org.codehaus.jackson.jaxrs.JacksonJsonProvider()); + JsonBean inputBean = new JsonBean(); + inputBean.setVal1("Maple"); + WebClient client = WebClient.create(endpointUrl + "/hello/jsonBean", providers); + Response r = client.accept("application/json") + .type("application/json") + .post(inputBean); + assertEquals(Response.Status.OK.getStatusCode(), r.getStatus()); + MappingJsonFactory factory = new MappingJsonFactory(); + JsonParser parser = factory.createJsonParser((InputStream)r.getEntity()); + JsonBean output = parser.readValueAs(JsonBean.class); + assertEquals("Maple", output.getVal2()); + } +} Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/main/resources/archetype-resources/src/test/java/HelloWorldIT.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties?rev=1201826&view=auto ============================================================================== --- cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties (added) +++ cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties Mon Nov 14 19:03:56 2011 @@ -0,0 +1,6 @@ +#Mon Nov 14 13:42:57 EST 2011 +cxf-version=2.5.0 +package=it.pkg +version=0.1-SNAPSHOT +groupId=archetype.it +artifactId=basic Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/archetype.properties ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/goal.txt URL: http://svn.apache.org/viewvc/cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/goal.txt?rev=1201826&view=auto ============================================================================== (empty) Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/goal.txt ------------------------------------------------------------------------------ svn:eol-style = native Propchange: cxf/trunk/maven-plugins/archetypes/cxf-jaxrs-service/src/test/resources/projects/basic/goal.txt ------------------------------------------------------------------------------ svn:mime-type = text/plain