Skip to content
Browse files

[ARQ-1341] Warp JAX-RS testing.

  • Loading branch information...
1 parent 78451a8 commit e2bf8f3e08ed814d948ccdd4f4ba57a766480776 @jmnarloch jmnarloch committed Jul 11, 2013
Showing with 7,879 additions and 127 deletions.
  1. +15 −0 .gitignore
  2. +297 −127 pom.xml
  3. +146 −0 rest-client/pom.xml
  4. 0 { → rest-client}/src/main/java/org/jboss/arquillian/extension/rest/client/RestClientExtension.java
  5. 0 { → rest-client}/src/main/java/org/jboss/arquillian/extension/rest/client/RestEnricher.java
  6. 0 { → rest-client}/src/main/java/org/jboss/arquillian/extension/rest/client/RestInvoker.java
  7. 0 ...rest-client}/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
  8. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/RestClientTestCase.java
  9. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/CustomerResource.java
  10. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/model/Contact.java
  11. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/model/Customer.java
  12. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/model/LineItem.java
  13. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/model/Product.java
  14. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/model/SalesOrder.java
  15. 0 ...ent}/src/test/java/org/jboss/arquillian/extension/rest/app/persistence/EntityManagerProducer.java
  16. 0 { → rest-client}/src/test/java/org/jboss/arquillian/extension/rest/app/rs/JaxRsActivator.java
  17. 0 { → rest-client}/src/test/resources/arquillian.xml
  18. 0 { → rest-client}/src/test/resources/import.sql
  19. 0 { → rest-client}/src/test/resources/test-persistence.xml
  20. +43 −0 warp-rest/api/pom.xml
  21. +51 −0 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpMethod.java
  22. +56 −0 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpRequest.java
  23. +57 −0 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpResponse.java
  24. +62 −0 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/RestContext.java
  25. +42 −0 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/SecurityContext.java
  26. +114 −0 warp-rest/bom/pom.xml
  27. +134 −0 warp-rest/ftest/ftest-cxf/pom.xml
  28. +62 −0 ...est/ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/application/StockApplication.java
  29. +163 −0 warp-rest/ftest/ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/model/Stock.java
  30. +105 −0 ...-rest/ftest/ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/service/StockService.java
  31. +178 −0 .../ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceResource.java
  32. +67 −0 ...est/ftest/ftest-cxf/src/test/java/org/jboss/arquillian/quickstart/cxf/service/rs/Deployments.java
  33. +145 −0 ...st-cxf/src/test/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceAjaxTestCase.java
  34. +180 −0 ...xf/src/test/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceResourceTestCase.java
  35. +44 −0 warp-rest/ftest/ftest-cxf/src/test/resources/WEB-INF/web.xml
  36. +35 −0 warp-rest/ftest/ftest-cxf/src/test/resources/arquillian.xml
  37. +2 −0 warp-rest/ftest/ftest-cxf/src/test/resources/js/jquery-1.8.2.min.js
  38. +68 −0 warp-rest/ftest/ftest-cxf/src/test/resources/restclient.jsp
  39. +103 −0 warp-rest/ftest/ftest-jersey/pom.xml
  40. +45 −0 ...est-jersey/src/main/java/org/jboss/arquillian/quickstart/jersey/application/StockApplication.java
  41. +163 −0 warp-rest/ftest/ftest-jersey/src/main/java/org/jboss/arquillian/quickstart/jersey/model/Stock.java
  42. +79 −0 ...ftest/ftest-jersey/src/main/java/org/jboss/arquillian/quickstart/jersey/service/StockService.java
  43. +167 −0 ...-jersey/src/main/java/org/jboss/arquillian/quickstart/jersey/service/rs/StockServiceResource.java
  44. +70 −0 ...est/ftest-jersey/src/test/java/org/jboss/arquillian/quickstart/jersey/service/rs/Deployments.java
  45. +145 −0 ...sey/src/test/java/org/jboss/arquillian/quickstart/jersey/service/rs/StockServiceAjaxTestCase.java
  46. +183 −0 ...src/test/java/org/jboss/arquillian/quickstart/jersey/service/rs/StockServiceResourceTestCase.java
  47. +32 −0 warp-rest/ftest/ftest-jersey/src/test/resources/WEB-INF/web.xml
  48. +34 −0 warp-rest/ftest/ftest-jersey/src/test/resources/arquillian.xml
  49. +2 −0 warp-rest/ftest/ftest-jersey/src/test/resources/js/jquery-1.8.2.min.js
  50. +68 −0 warp-rest/ftest/ftest-jersey/src/test/resources/restclient.jsp
  51. +139 −0 warp-rest/ftest/ftest-resteasy/pom.xml
  52. +31 −0 ...resteasy/src/main/java/org/jboss/arquillian/quickstart/resteasy/application/StockApplication.java
  53. +163 −0 ...rest/ftest/ftest-resteasy/src/main/java/org/jboss/arquillian/quickstart/resteasy/model/Stock.java
  54. +98 −0 ...t/ftest-resteasy/src/main/java/org/jboss/arquillian/quickstart/resteasy/service/StockService.java
  55. +152 −0 ...teasy/src/main/java/org/jboss/arquillian/quickstart/resteasy/service/rs/StockServiceResource.java
  56. +46 −0 ...ftest-resteasy/src/test/java/org/jboss/arquillian/quickstart/resteasy/service/rs/Deployments.java
  57. +146 −0 ...y/src/test/java/org/jboss/arquillian/quickstart/resteasy/service/rs/StockServiceAjaxTestCase.java
  58. +186 −0 ...c/test/java/org/jboss/arquillian/quickstart/resteasy/service/rs/StockServiceResourceTestCase.java
  59. +18 −0 warp-rest/ftest/ftest-resteasy/src/test/resources/WEB-INF/web.xml
  60. +25 −0 warp-rest/ftest/ftest-resteasy/src/test/resources/arquillian.xml
  61. +2 −0 warp-rest/ftest/ftest-resteasy/src/test/resources/js/jquery-1.8.2.min.js
  62. +68 −0 warp-rest/ftest/ftest-resteasy/src/test/resources/restclient.jsp
  63. +74 −0 warp-rest/ftest/pom.xml
  64. +116 −0 warp-rest/impl/impl-base/pom.xml
  65. +99 −0 ...pl-base/src/main/java/org/jboss/arquillian/extension/rest/warp/impl/client/WarpRestExtension.java
  66. +39 −0 ...rc/main/java/org/jboss/arquillian/extension/rest/warp/impl/container/WarpRestRemoteExtension.java
  67. +48 −0 ...ain/java/org/jboss/arquillian/extension/rest/warp/impl/provider/RestContextNotFoundException.java
  68. +72 −0 ...ase/src/main/java/org/jboss/arquillian/extension/rest/warp/impl/provider/RestContextProvider.java
  69. +1 −0 ...pl/impl-base/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
  70. +140 −0 ...src/test/java/org/jboss/arquillian/extension/rest/warp/impl/client/WarpRestExtensionTestCase.java
  71. +71 −0 ...java/org/jboss/arquillian/extension/rest/warp/impl/container/WarpRestRemoteExtensionTestCase.java
  72. +146 −0 ...test/java/org/jboss/arquillian/extension/rest/warp/impl/provider/RestContextProviderTestCase.java
  73. +104 −0 warp-rest/impl/impl-cxf/pom.xml
  74. +49 −0 ...ain/java/org/jboss/arquillian/extension/rest/warp/impl/cxf/client/WarpCxfInterceptorEnricher.java
  75. +326 −0 ...rc/main/java/org/jboss/arquillian/extension/rest/warp/impl/cxf/interceptor/CxfContextBuilder.java
  76. +85 −0 ...c/main/java/org/jboss/arquillian/extension/rest/warp/impl/cxf/interceptor/WarpCxfInterceptor.java
  77. +1 −0 ...mpl/impl-cxf/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
  78. +89 −0 .../org/jboss/arquillian/extension/rest/warp/impl/cxf/client/WarpCxfInterceptorEnricherTestCase.java
  79. +106 −0 warp-rest/impl/impl-jersey/pom.xml
  80. +49 −0 ...va/org/jboss/arquillian/extension/rest/warp/impl/jersey/client/WarpJerseyInterceptorEnricher.java
  81. +292 −0 ...n/java/org/jboss/arquillian/extension/rest/warp/impl/jersey/integration/JerseyContextBuilder.java
  82. +85 −0 .../java/org/jboss/arquillian/extension/rest/warp/impl/jersey/integration/WarpJerseyInterceptor.java
  83. +1 −0 .../impl-jersey/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
  84. +89 −0 ...boss/arquillian/extension/rest/warp/impl/jersey/client/WarpJerseyInterceptorEnricherTestCase.java
  85. +106 −0 warp-rest/impl/impl-resteasy/pom.xml
  86. +49 −0 ...rg/jboss/arquillian/extension/rest/warp/impl/resteasy/client/WarpResteasyInterceptorEnricher.java
  87. +325 −0 ...va/org/jboss/arquillian/extension/rest/warp/impl/resteasy/integration/ResteasyContextBuilder.java
  88. +143 −0 ...a/org/jboss/arquillian/extension/rest/warp/impl/resteasy/integration/WarpResteasyInterceptor.java
  89. +1 −0 ...mpl-resteasy/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
  90. +89 −0 .../arquillian/extension/rest/warp/impl/resteasy/client/WarpResteasyInterceptorEnricherTestCase.java
  91. +42 −0 warp-rest/impl/pom.xml
  92. +85 −0 warp-rest/pom.xml
  93. +55 −0 warp-rest/spi/pom.xml
  94. +126 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/HttpRequestImpl.java
  95. +125 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/HttpResponseImpl.java
  96. +112 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/MultivaluedMapImpl.java
  97. +31 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/RestContextBuilder.java
  98. +128 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/RestContextImpl.java
  99. +81 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/SecurityContextImpl.java
  100. +32 −0 warp-rest/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/WarpRestCommons.java
  101. +36 −0 ...t/spi/src/main/java/org/jboss/arquillian/extension/rest/warp/spi/WarpRestInterceptorEnricher.java
View
15 .gitignore
@@ -1,4 +1,19 @@
+# Eclipse
.project
.classpath
.settings/
+
+# IntelliJ
+*.iml
+*.ipr
+*.iws
+.idea
+
+# Maven
target/
+
+# TestNG
+test-output/
+
+# JBoss AS
+transaction.log
View
424 pom.xml
@@ -1,156 +1,326 @@
<?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">
+<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 -->
+ <parent>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-parent</artifactId>
+ <version>8</version>
+ <relativePath />
+ </parent>
+
+ <!-- Model Version -->
<modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.arquillian</groupId>
- <artifactId>arquillian-extension-rest</artifactId>
- <version>1.0.0.Alpha1-SNAPSHOT</version>
- <name>Arquillian Extension: REST</name>
- <description>Integrates a REST client API (using RestEasy Client Proxies) to facilitate testing REST endpoints</description>
+
+ <!-- Artifact Configuration -->
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-extension-rest-parent</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Arquillian Extension: REST Parent</name>
+ <description>Parent project for the Arquillian REST extensions.</description>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
<properties>
- <version.resteasy>2.2.3.GA</version.resteasy>
- <version.jboss_spec>1.0.0.Final</version.jboss_spec>
- <version.arquillian_core>1.0.0.Final</version.arquillian_core>
- <version.jbossas_7>7.1.1.Final</version.jbossas_7>
+ <!-- Arquillian -->
+ <version.arquillian_core>1.0.4.Final</version.arquillian_core>
+ <version.arquillian_drone>1.1.0.CR3</version.arquillian_drone>
+ <version.arquillian_warp>1.0.0.Alpha3</version.arquillian_warp>
+
+ <!-- JAX-RS implementations -->
+ <version.resteasy>2.3.4.Final</version.resteasy>
+ <version.jersey>1.17</version.jersey>
+ <version.cxf>2.7.2</version.cxf>
+ <version.springframework>3.2.1.RELEASE</version.springframework>
+
+ <!-- Tests -->
+ <version.junit>4.10</version.junit>
+ <version.mockito>1.9.0</version.mockito>
+ <version.fest.assert>1.4</version.fest.assert>
+ <version.shrinkwrap_resolver>2.0.0-alpha-1</version.shrinkwrap_resolver>
+ <version.jboss_spec>3.0.0.Final</version.jboss_spec>
+ <version.org.jboss.jbossas>7.1.1.Final</version.org.jboss.jbossas>
+ <version.org.glassfish>3.1.2</version.org.glassfish>
+
+ <!-- override from parent -->
+ <maven.compiler.argument.target>1.5</maven.compiler.argument.target>
+ <maven.compiler.argument.source>1.5</maven.compiler.argument.source>
</properties>
+ <modules>
+ <module>rest-client</module>
+ <module>warp-rest</module>
+ </modules>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<dependencyManagement>
<dependencies>
+
+ <!-- Arquillian Core -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${version.arquillian_core}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
+
+ <!-- Arquillian Drone -->
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-drone-bom</artifactId>
+ <version>${version.arquillian_drone}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+
+ <!-- Arquillian Warp -->
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-warp-bom</artifactId>
+ <version>${version.arquillian_warp}</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.test</groupId>
+ <artifactId>arquillian-test-impl-base</artifactId>
+ <version>${version.arquillian_core}</version>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.core</groupId>
+ <artifactId>arquillian-core-impl-base</artifactId>
+ <version>${version.arquillian_core}</version>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <!-- Resteasy dependencies -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>${version.resteasy}</version>
+ <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<version>${version.resteasy}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jackson-provider</artifactId>
+ <version>${version.resteasy}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jsapi</artifactId>
+ <version>${version.resteasy}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Jersey dependencies -->
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ <version>${version.jersey}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-servlet</artifactId>
+ <version>${version.jersey}</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-json</artifactId>
+ <version>${version.jersey}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>${version.jersey}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- CXF dependencies -->
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${version.cxf}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ <version>${version.cxf}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-jaxrs</artifactId>
+ <version>1.9.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>1.3.3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-servlet_3.0_spec</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-web-6.0</artifactId>
+ <version>${version.jboss_spec}</version>
+ <type>pom</type>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>xalan</groupId>
+ <artifactId>xalan</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.ws.rs</groupId>
+ <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
+ <version>1.0.1.Final</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Containers -->
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${version.junit}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>${version.mockito}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.core</groupId>
+ <artifactId>arquillian-core-impl-base</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ <version>${version.arquillian_core}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.test</groupId>
+ <artifactId>arquillian-test-impl-base</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ <version>${version.arquillian_core}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert</artifactId>
+ <version>${version.fest.assert}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
+ <version>1.0.0.CR3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-glassfish-remote-3.1</artifactId>
+ <version>1.0.0.CR3</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.main.extras</groupId>
+ <artifactId>glassfish-embedded-all</artifactId>
+ <version>${version.org.glassfish}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>6.0</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.jboss.arquillian.core</groupId>
- <artifactId>arquillian-core-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.test</groupId>
- <artifactId>arquillian-test-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.container</groupId>
- <artifactId>arquillian-container-test-spi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jaxrs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jaxb-provider</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.junit</groupId>
- <artifactId>arquillian-junit-container</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- <version>4.10</version>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>${version.jboss_spec}</version>
- <scope>test</scope>
- <type>pom</type>
- </dependency>
-
- </dependencies>
-
- <profiles>
- <profile>
- <id>arq-jbossas-managed-7</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${version.jbossas_7}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemProperties>
- <jboss.version>${version.jbossas_7}</jboss.version>
- </systemProperties>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <version>${version.jbossas_7}</version>
- <type>zip</type>
- <overWrite>false</overWrite>
- <outputDirectory>${project.build.directory}/</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>arq-jbossas-remote-7</id>
- <dependencies>
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-remote</artifactId>
- <version>${version.jbossas_7}</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-</project>
+</project>
View
146 rest-client/pom.xml
@@ -0,0 +1,146 @@
+<?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">
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-extension-rest-parent</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ </parent>
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Configuration -->
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-extension-rest</artifactId>
+ <version>1.0.0.Alpha1-SNAPSHOT</version>
+ <name>Arquillian Extension: REST Client</name>
+ <description>Integrates a REST client API (using RestEasy Client Proxies) to facilitate testing REST endpoints</description>
+
+ <properties>
+
+ </properties>
+
+ <dependencies>
+ <!-- Arquillian -->
+ <dependency>
+ <groupId>org.jboss.arquillian.core</groupId>
+ <artifactId>arquillian-core-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.test</groupId>
+ <artifactId>arquillian-test-spi</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-container-test-spi</artifactId>
+ </dependency>
+
+ <!-- Resteasy -->
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-web-6.0</artifactId>
+ <type>pom</type>
+ <scope>provided</scope>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>arq-jbossas-managed-7</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <jboss.version>${version.org.jboss.jbossas}</jboss.version>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <type>zip</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.directory}/</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>arq-jbossas-remote-7</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-remote</artifactId>
+ <version>${version.org.jboss.jbossas}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+</project>
View
0 ...sion/rest/client/RestClientExtension.java → ...sion/rest/client/RestClientExtension.java
File renamed without changes.
View
0 ...n/extension/rest/client/RestEnricher.java → ...n/extension/rest/client/RestEnricher.java
File renamed without changes.
View
0 ...an/extension/rest/client/RestInvoker.java → ...an/extension/rest/client/RestInvoker.java
File renamed without changes.
View
0 ...oss.arquillian.core.spi.LoadableExtension → ...oss.arquillian.core.spi.LoadableExtension
File renamed without changes.
View
0 ...an/extension/rest/RestClientTestCase.java → ...an/extension/rest/RestClientTestCase.java
File renamed without changes.
View
0 .../extension/rest/app/CustomerResource.java → .../extension/rest/app/CustomerResource.java
File renamed without changes.
View
0 ...ian/extension/rest/app/model/Contact.java → ...ian/extension/rest/app/model/Contact.java
File renamed without changes.
View
0 ...an/extension/rest/app/model/Customer.java → ...an/extension/rest/app/model/Customer.java
File renamed without changes.
View
0 ...an/extension/rest/app/model/LineItem.java → ...an/extension/rest/app/model/LineItem.java
File renamed without changes.
View
0 ...ian/extension/rest/app/model/Product.java → ...ian/extension/rest/app/model/Product.java
File renamed without changes.
View
0 .../extension/rest/app/model/SalesOrder.java → .../extension/rest/app/model/SalesOrder.java
File renamed without changes.
View
0 ...pp/persistence/EntityManagerProducer.java → ...pp/persistence/EntityManagerProducer.java
File renamed without changes.
View
0 ...extension/rest/app/rs/JaxRsActivator.java → ...extension/rest/app/rs/JaxRsActivator.java
File renamed without changes.
View
0 src/test/resources/arquillian.xml → ...-client/src/test/resources/arquillian.xml
File renamed without changes.
View
0 src/test/resources/import.sql → rest-client/src/test/resources/import.sql
File renamed without changes.
View
0 src/test/resources/test-persistence.xml → ...t/src/test/resources/test-persistence.xml
File renamed without changes.
View
43 warp-rest/api/pom.xml
@@ -0,0 +1,43 @@
+<?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">
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-parent</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ </parent>
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>arquillian-rest-warp-api</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Arquillian Warp REST Extension: API</name>
+ <description>API for Arquillian Warp JAX-RS</description>
+
+ <!-- Properties -->
+ <properties>
+
+ </properties>
+
+ <!-- Licenses -->
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.ws.rs</groupId>
+ <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
+ </dependency>
+ </dependencies>
+
+</project>
View
51 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpMethod.java
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.extension.rest.warp.api;
+
+/**
+ * Represents the http method.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+public enum HttpMethod {
+
+ /**
+ * HTTP GET method.
+ */
+ GET,
+
+ /**
+ * HTTP PUT method.
+ */
+ PUT,
+
+ /**
+ * HTTP POST method.
+ */
+ POST,
+
+ /**
+ * HTTP DELETE method.
+ */
+ DELETE,
+
+ /**
+ * HTTP HEAD method.
+ */
+ HEAD
+}
View
56 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpRequest.java
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.extension.rest.warp.api;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+/**
+ * HTTP request that were received by the server.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+public interface HttpRequest {
+
+ /**
+ * Retrieves the http method.
+ *
+ * @return the http method.
+ */
+ HttpMethod getMethod();
+
+ /**
+ * Retrieves the request content type.
+ *
+ * @return the request content type
+ */
+ String getContentType();
+
+ /**
+ * Retrieves the request entity.
+ *
+ * @return the request entity
+ */
+ Object getEntity();
+
+ /**
+ * Retrieves the request http headers.
+ *
+ * @return the request http headers
+ */
+ MultivaluedMap<String, String> getHeaders();
+}
View
57 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/HttpResponse.java
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.extension.rest.warp.api;
+
+import javax.ws.rs.core.MultivaluedMap;
+
+/**
+ * HTTP response that were send by the server back to the client. The response contains the http status code, the mime
+ * type of the response and gives access to the entity that has been returned from the service.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+public interface HttpResponse {
+
+ /**
+ * Retrieves the status code.
+ *
+ * @return the status code
+ */
+ int getStatusCode();
+
+ /**
+ * Retrieves the content type.
+ *
+ * @return the content type
+ */
+ String getContentType();
+
+ /**
+ * Retrieves the entity.
+ *
+ * @return the entity
+ */
+ Object getEntity();
+
+ /**
+ * Retrieves the request http headers.
+ *
+ * @return the request http headers
+ */
+ MultivaluedMap<String, String> getHeaders();
+}
View
62 warp-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/RestContext.java
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.extension.rest.warp.api;
+
+import javax.ws.rs.core.Response;
+
+/**
+ * Represents the captured rest execution context. Gives access to the http request and response allowing to verify the
+ * response statuses or retrieve the request/response entity. The rest context can be injected into Warp {@link
+ * Inspection} by using {@link ArquillianResource} injection. It's possible to access the service response through
+ * {@link #getResponse()}.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ * @see HttpRequest
+ * @see HttpResponse
+ * @see ArquillianResource
+ */
+public interface RestContext {
+
+ /**
+ * Retrieves the http request.
+ *
+ * @return the http request
+ */
+ HttpRequest getHttpRequest();
+
+ /**
+ * Retrieves the http response
+ *
+ * @return the http response
+ */
+ HttpResponse getHttpResponse();
+
+ /**
+ * Retrieves the service response.
+ *
+ * @return the service response
+ */
+ Response getResponse();
+
+ /**
+ * Retrieves the security context.
+ *
+ * @return security context
+ */
+ SecurityContext getSecurityContext();
+}
View
42 ...-rest/api/src/main/java/org/jboss/arquillian/extension/rest/warp/api/SecurityContext.java
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.extension.rest.warp.api;
+
+import java.security.Principal;
+
+/**
+ * The security context of the given request.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+public interface SecurityContext {
+
+ /**
+ * Retrieves the principal.
+ *
+ * @return the principal
+ */
+ Principal getPrincipal();
+
+ /**
+ * Retrieves the authentication scheme.
+ *
+ * @return the authentication scheme
+ */
+ String getAuthenticationScheme();
+}
View
114 warp-rest/bom/pom.xml
@@ -0,0 +1,114 @@
+<?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">
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Artifact Configuration -->
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-bom</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Arquillian Warp REST Extension: BOM</name>
+ <url>http://arquillian.org</url>
+ <description>Arquillian Warp JAX-RS Bill Of Material</description>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.jboss.com/jira/browse/ARQ</url>
+ </issueManagement>
+
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <id>arquillian.org</id>
+ <name>Arquillian Community</name>
+ <organization>arquillian.org</organization>
+ <organizationUrl>http://arquillian.org</organizationUrl>
+ </developer>
+ </developers>
+
+ <properties>
+
+ <jboss.releases.repo.url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</jboss.releases.repo.url>
+ <jboss.snapshots.repo.url>https://repository.jboss.org/nexus/content/repositories/snapshots/</jboss.snapshots.repo.url>
+
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ </dependencies>
+
+ <!-- Dependencies Management -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-impl-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-spi</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-impl-resteasy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-impl-jersey</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-impl-cxf</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>jboss-releases-repository</id>
+ <name>JBoss Releases Repository</name>
+ <url>${jboss.releases.repo.url}</url>
+ </repository>
+ <snapshotRepository>
+ <id>jboss-snapshots-repository</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>${jboss.snapshots.repo.url}</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
+
View
134 warp-rest/ftest/ftest-cxf/pom.xml
@@ -0,0 +1,134 @@
+<?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">
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-ftest-parent</artifactId>
+ <version>1.0.0.Final-SNAPSHOT</version>
+ </parent>
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>arquillian-rest-warp-ftest-cxf</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Arquillian Warp REST Extension: CXF Functional Tests</name>
+ <description>CXF Functional Tests for Arquillian Warp JAX-RS</description>
+
+ <!-- Properties -->
+ <properties>
+
+ </properties>
+
+ <!-- Licenses -->
+ <licenses>
+ <license>
+ <name>Apache License, Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+ </license>
+ </licenses>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-extension-providers</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-warp-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-rest-warp-impl-cxf</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.extension</groupId>
+ <artifactId>arquillian-drone-webdriver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>glassfish-embedded</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.main.extras</groupId>
+ <artifactId>glassfish-embedded-all</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
+ <id>tomcat-embedded</id>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-tomcat-embedded-7</artifactId>
+ <version>1.0.0.CR4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>7.0.19</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-jasper</artifactId>
+ <version>7.0.19</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-juli</artifactId>
+ <version>7.0.19</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jdt.core.compiler</groupId>
+ <artifactId>ecj</artifactId>
+ <version>3.7</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
+
View
62 ...t-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/application/StockApplication.java
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.application;
+
+import org.apache.cxf.jaxrs.provider.json.JSONProvider;
+import org.jboss.arquillian.quickstart.cxf.service.rs.StockServiceResource;
+import org.jboss.arquillian.extension.rest.warp.impl.cxf.interceptor.WarpCxfInterceptor;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * The stock application
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@ApplicationPath("/rest")
+public class StockApplication extends Application {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Object> getSingletons() {
+
+ JSONProvider provider = new JSONProvider();
+ provider.setSerializeAsArray(true);
+ provider.setConvention("badgerfish");
+
+ Set<Object> singletons = new HashSet<Object>();
+ singletons.add(new StockServiceResource());
+ singletons.add(provider);
+ return singletons;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<Class<?>> getClasses() {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ classes.add(WarpCxfInterceptor.class);
+ return classes;
+ }
+}
View
163 warp-rest/ftest/ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/model/Stock.java
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * Represents a stock.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@XmlRootElement(name = "stock")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Stock {
+
+ /**
+ * The stock id.
+ */
+ @XmlAttribute
+ private Long id;
+
+ /**
+ * The stock name.
+ */
+ @XmlElement
+ private String name;
+
+ /**
+ * The stock three letter code.
+ */
+ @XmlElement
+ private String code;
+
+ /**
+ * The stock valuation date.
+ */
+ @XmlElement
+ private Date date;
+
+ /**
+ * The stock value.
+ */
+ @XmlElement
+ private BigDecimal value;
+
+ /**
+ * Creates new instance of stock.
+ */
+ public Stock() {
+ // empty constructor
+ }
+
+ /**
+ * Retrieves the stock id.
+ *
+ * @return the stock id
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * Sets the stock id.
+ *
+ * @param id the stock id
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
+ * Retrieves the stock name.
+ *
+ * @return the stock name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the stock name.
+ *
+ * @param name the stock name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Retrieves the stock code.
+ *
+ * @return the stock code
+ */
+ public String getCode() {
+ return code;
+ }
+
+ /**
+ * Sets the stock code.
+ *
+ * @param code the stock id
+ */
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ /**
+ * Retrieves the stock valuation date.
+ *
+ * @return the stock valuation date
+ */
+ public Date getDate() {
+ return date;
+ }
+
+ /**
+ * Sets the stock valuation date.
+ *
+ * @param date the stock valuation date
+ */
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+ /**
+ * Retrieves the stock value.
+ *
+ * @return the stock value
+ */
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ /**
+ * Retrieves the stock value.
+ *
+ * @param value the stock value
+ */
+ public void setValue(BigDecimal value) {
+ this.value = value;
+ }
+}
View
105 ...est/ftest-cxf/src/main/java/org/jboss/arquillian/quickstart/cxf/service/StockService.java
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.service;
+
+import org.jboss.arquillian.quickstart.cxf.model.Stock;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.List;
+
+/**
+ * A REST service contract.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@Path("/stocks")
+@Consumes({MediaType.APPLICATION_JSON})
+@Produces({MediaType.APPLICATION_JSON})
+public interface StockService {
+
+ /**
+ * Creates new stock.
+ *
+ * @param stock the stock to create
+ *
+ * @return the response
+ */
+ @Path("/")
+ @POST
+ @Consumes({MediaType.APPLICATION_JSON})
+ Response createStock(Stock stock);
+
+ /**
+ * Updates the stock.
+ *
+ * @param id stock id
+ * @param stock the stock to update
+ */
+ @Path("/{id}")
+ @PUT
+ @Consumes({MediaType.APPLICATION_JSON})
+ void updateStock(@PathParam("id") long id, Stock stock);
+
+ /**
+ * Retrieves the stock by it's id.
+ *
+ * @param id the stock id
+ *
+ * @return the stock that matches the given id
+ */
+ @Path("/{id}")
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ Stock getStock(@PathParam("id") long id);
+
+ /**
+ * Retrieves the stock list.
+ *
+ * @param startIndex the starting index
+ * @param size the number stocks to retrieve
+ *
+ * @return the list of stocks
+ */
+ @Path("/")
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ List<Stock> getStocks(@DefaultValue("0") @QueryParam("startIndex") int startIndex, @DefaultValue("10") @QueryParam("size") int size);
+
+ /**
+ * Deletes the stock
+ *
+ * @param id the stock id
+ *
+ * @return the response
+ */
+ @Path("/{id}")
+ @DELETE
+ @Consumes({MediaType.APPLICATION_JSON})
+ Response deleteStock(@PathParam("id") long id);
+}
View
178 ...xf/src/main/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceResource.java
@@ -0,0 +1,178 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.service.rs;
+
+import org.jboss.arquillian.quickstart.cxf.model.Stock;
+import org.jboss.arquillian.quickstart.cxf.service.StockService;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.MediaType;
+import javax.ws.rs.core.Response;
+import java.math.BigDecimal;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * A REST service implementation.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@Path("/stocks")
+@Consumes({MediaType.APPLICATION_JSON})
+@Produces({MediaType.APPLICATION_JSON})
+public class StockServiceResource implements StockService {
+
+ /**
+ * Stores the stocks using ids as map keys.
+ */
+ private static final Map<Long, Stock> stockMap = new ConcurrentHashMap<Long, Stock>();
+
+ /**
+ * Counter used for assigning the id of newly created stocks.
+ */
+ private static final AtomicLong counter = new AtomicLong(1L);
+
+ /**
+ * Creates new instance of {@link StockServiceResource} class.
+ */
+ public StockServiceResource() {
+
+ // creates test stock
+ Stock stock = new Stock();
+ stock.setId(1L);
+ stock.setName("Acme");
+ stock.setCode("ACM");
+ stock.setValue(new BigDecimal(37.5D));
+ stock.setDate(new Date());
+
+ stockMap.put(stock.getId(), stock);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Path("/")
+ @POST
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Override
+ public Response createStock(Stock stock) {
+
+ // assigns the stock id
+ stock.setId(counter.incrementAndGet());
+ // saves the stock
+ stockMap.put(stock.getId(), stock);
+ // creates response
+ return Response.created(URI.create("/stocks/" + stock.getId())).build();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Path("/{id}")
+ @PUT
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Override
+ public void updateStock(@PathParam("id") long id, Stock stock) {
+
+ Stock current = stockMap.get(id);
+ if (current == null) {
+ throw new WebApplicationException(Response.Status.NOT_FOUND);
+ }
+
+ // updates the stock
+ current.setName(stock.getName());
+ current.setCode(stock.getCode());
+ current.setDate(stock.getDate());
+ current.setValue(stock.getValue());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Path("/{id}")
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ @Override
+ public Stock getStock(@PathParam("id") long id) {
+
+ Stock stock = stockMap.get(id);
+ if (stock == null) {
+ throw new WebApplicationException(Response.Status.NOT_FOUND);
+ }
+
+ return stock;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Path("/")
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ @Override
+ public List<Stock> getStocks(@DefaultValue("0") int startIndex, @DefaultValue("10") int size) {
+
+ // gets the list of all stocks in the current map
+ List<Stock> stocks = new ArrayList<Stock>(size);
+
+ Iterator<Stock> iter = stockMap.values().iterator();
+ int count = 0;
+
+ // skips records
+ while (iter.hasNext() && count < startIndex) {
+ iter.next();
+ }
+
+ while (iter.hasNext() && count < size) {
+ stocks.add(iter.next());
+ }
+
+ return stocks;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Path("/{id}")
+ @DELETE
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Override
+ public Response deleteStock(@PathParam("id") long id) {
+
+ if (stockMap.remove(id) == null) {
+ throw new WebApplicationException(Response.Status.NOT_FOUND);
+ }
+
+ return Response.ok().build();
+ }
+}
View
67 ...t/ftest-cxf/src/test/java/org/jboss/arquillian/quickstart/cxf/service/rs/Deployments.java
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.service.rs;
+
+import org.jboss.arquillian.quickstart.cxf.application.StockApplication;
+import org.jboss.arquillian.quickstart.cxf.model.Stock;
+import org.jboss.arquillian.quickstart.cxf.service.StockService;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.shrinkwrap.resolver.api.DependencyResolvers;
+import org.jboss.shrinkwrap.resolver.api.maven.MavenDependencyResolver;
+
+import java.io.File;
+
+/**
+ * An utility class that creates the test deployments.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+final class Deployments {
+
+ /**
+ * Creates test deployment.
+ *
+ * @return the test deployment
+ */
+ public static Archive createDeployment() {
+ File[] libs = loadLibraries();
+
+ return ShrinkWrap.create(WebArchive.class)
+ .addClasses(StockApplication.class, Stock.class, StockService.class, StockServiceResource.class)
+ .addAsWebInfResource("WEB-INF/web.xml")
+ .addAsWebResource("restclient.jsp")
+ .addAsWebResource("js/jquery-1.8.2.min.js", "js/jquery-1.8.2.min.js")
+ .addAsLibraries(libs);
+ }
+
+ /**
+ * Loads all required dependencies needed to run the application in the application server.
+ *
+ * @return the loaded dependencies
+ */
+ private static File[] loadLibraries() {
+ return DependencyResolvers.use(MavenDependencyResolver.class)
+ .loadMetadataFromPom("pom.xml")
+ .artifacts("org.apache.cxf:cxf-rt-frontend-jaxrs")
+ .artifacts("org.apache.cxf:cxf-rt-rs-extension-providers")
+ .artifacts("org.codehaus.jettison:jettison")
+ .resolveAsFiles();
+ }
+}
View
145 ...rc/test/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceAjaxTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.service.rs;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.quickstart.cxf.model.Stock;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.Activity;
+import org.jboss.arquillian.warp.Inspection;
+import org.jboss.arquillian.warp.Warp;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.arquillian.extension.rest.warp.api.HttpMethod;
+import org.jboss.arquillian.extension.rest.warp.api.RestContext;
+import org.jboss.arquillian.warp.servlet.AfterServlet;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+
+import javax.ws.rs.core.Response;
+import java.net.URL;
+import java.util.List;
+
+import static org.fest.assertions.Assertions.assertThat;
+import static org.jboss.arquillian.warp.client.filter.http.HttpFilters.request;
+
+/**
+ * An Drone/Selenium test case that calls the service through AJAX.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@WarpTest
+@RunWith(Arquillian.class)
+public class StockServiceAjaxTestCase {
+
+ /**
+ * Creates the test deployment.
+ *
+ * @return the test deployment
+ */
+ @Deployment
+ @OverProtocol("Servlet 3.0")
+ public static Archive createTestArchive() {
+
+ return Deployments.createDeployment();
+ }
+
+ /**
+ * The context path of the deployed application.
+ */
+ @ArquillianResource
+ private URL contextPath;
+
+ /**
+ * The web driver instance.
+ */
+ @Drone
+ WebDriver browser;
+
+ @Test
+ @RunAsClient
+ public void testAjaxGetStocks() {
+
+ Warp.initiate(new Activity() {
+
+ @Override
+ public void perform() {
+
+ browser.navigate().to(contextPath + "restclient.jsp");
+ }
+ }).group().observe(request().uri().endsWith("/stocks")).inspect(new Inspection() {
+
+ private static final long serialVersionUID = 1L;
+
+ @ArquillianResource
+ private RestContext restContext;
+
+ @AfterServlet
+ public void testGetStocks() {
+
+ assertThat(restContext.getHttpRequest().getMethod()).isEqualTo(HttpMethod.GET);
+ assertThat(restContext.getHttpResponse().getStatusCode()).isEqualTo(Response.Status.OK.getStatusCode());
+ assertThat(restContext.getHttpResponse().getContentType()).isEqualTo("application/json");
+
+ List list = (List) restContext.getHttpResponse().getEntity();
+ assertThat(list.size()).isEqualTo(1);
+ }
+ });
+ }
+
+ @Test
+ @RunAsClient
+ public void testAjaxGetStock() {
+
+ browser.navigate().to(contextPath + "restclient.jsp");
+
+ Warp.initiate(new Activity() {
+
+ @Override
+ public void perform() {
+
+ browser.findElement(By.className("stockLink")).click();
+ }
+ }).group().observe(request().uri().endsWith("/stocks/1")).inspect(new Inspection() {
+
+ private static final long serialVersionUID = 1L;
+
+ @ArquillianResource
+ private RestContext restContext;
+
+ @AfterServlet
+ public void testGetStock() {
+
+ assertThat(restContext.getHttpRequest().getMethod()).isEqualTo(HttpMethod.GET);
+ assertThat(restContext.getHttpResponse().getStatusCode()).isEqualTo(Response.Status.OK.getStatusCode());
+ assertThat(restContext.getHttpResponse().getContentType()).isEqualTo("application/json");
+
+ Stock stock = (Stock) restContext.getHttpResponse().getEntity();
+ assertThat(stock.getId()).isEqualTo(1L);
+ assertThat(stock.getName()).isEqualTo("Acme");
+ assertThat(stock.getCode()).isEqualTo("ACM");
+ }
+ });
+ }
+}
View
180 ...est/java/org/jboss/arquillian/quickstart/cxf/service/rs/StockServiceResourceTestCase.java
@@ -0,0 +1,180 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors
+ * as indicated by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed 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 org.jboss.arquillian.quickstart.cxf.service.rs;
+
+import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.jaxrs.provider.json.JSONProvider;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.OverProtocol;
+import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.quickstart.cxf.model.Stock;
+import org.jboss.arquillian.quickstart.cxf.service.StockService;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.warp.Activity;
+import org.jboss.arquillian.warp.Inspection;
+import org.jboss.arquillian.warp.Warp;
+import org.jboss.arquillian.warp.WarpTest;
+import org.jboss.arquillian.extension.rest.warp.api.HttpMethod;
+import org.jboss.arquillian.extension.rest.warp.api.RestContext;
+import org.jboss.arquillian.warp.servlet.AfterServlet;
+import org.jboss.shrinkwrap.api.Archive;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Date;
+
+import static org.jboss.arquillian.warp.client.filter.http.HttpFilters.request;
+import static org.junit.Assert.assertEquals;
+
+/**
+ * The test case that uses CXF client API for calling the REST test.
+ *
+ * @author <a href="mailto:jmnarloch@gmail.com">Jakub Narloch</a>
+ */
+@WarpTest
+@RunWith(Arquillian.class)
+public class StockServiceResourceTestCase {
+
+ /**
+ * Creates the test deployment.
+ *
+ * @return the test deployment
+ */
+ @Deployment
+ @OverProtocol("Servlet 3.0")
+ public static Archive createTestArchive() {
+
+ return Deployments.createDeployment();
+ }
+
+ /**
+ * The context path of the deployed application.
+ */
+ @ArquillianResource
+ private URL contextPath;
+
+ /**
+ * Represents the REST service client.
+ */
+ private StockService stockService;
+
+ /**
+ * Represents the REST service client.
+ */
+ private WebClient client;
+
+ /**
+ * <p>Sets up the test environment.</p>
+ */
+ @Before
+ public void setUp() {
+
+ JSONProvider provider = new JSONProvider();
+ provider.setSerializeAsArray(true);
+ provider.setConvention("badgerfish");
+
+ stockService = JAXRSClientFactory.create(contextPath + "app/rest/",
+ StockService.class, Arrays.asList(provider));
+
+ WebClient.client(stockService)
+ .type(MediaType.APPLICATION_JSON_TYPE)
+ .accept(MediaType.APPLICATION_JSON_TYPE);
+ }
+
+ @Test
+ @RunAsClient
+ public void testStockCreate() {
+
+ Stock stock = createStock();
+
+ Response response = stockService.createStock(stock);
+
+ assertEquals("The request didn't succeeded.", Response.Status.CREATED.getStatusCode(), response.getStatus());
+ }
+
+ @Test
+ @RunAsClient
+ public void testStockGet() {
+
+ Stock stock = createStock();
+ stockService.createStock(stock);
+
+ Stock result = stockService.getStock(2L);
+
+ assertEquals("Stock has invalid name.", stock.getName(), result.getName());
+ assertEquals("Stock has invalid code.", stock.getCode(), result.getCode());
+ assertEquals("Stock has invalid value.", stock.getValue(), result.getValue());
+ }
+
+ @Test
+ @RunAsClient
+ public void testStockGetWarp() {
+
+ final Stock stock = createStock();
+ stockService.createStock(stock);
+
+ Warp.initiate(new Activity() {
+ @Override
+ public void perform() {
+
+ Stock result = stockService.getStock(2l);
+
+ assertEquals("Stock has invalid name.", stock.getName(), result.getName());
+ assertEquals("Stock has invalid code.", stock.getCode(), result.getCode());
+ assertEquals("Stock has invalid value.", stock.getValue(), result.getValue());
+ }
+ }).observe(request().uri().contains("rest/stocks/2")).inspect(new Inspection() {
+
+ private static final long serialVersionUID = 1L;
+
+ @ArquillianResource
+ private RestContext restContext;
+
+ @AfterServlet
+ public void testGetStock() {
+
+ assertEquals(HttpMethod.GET, restContext.getHttpRequest().getMethod());
+ assertEquals(200, restContext.getHttpResponse().getStatusCode());
+ assertEquals("text/xml", restContext.getHttpResponse().getContentType());
+ }
+ });
+ }
+
+ /**
+ * Creates the instance of {@link Stock} for testing
+ *
+ * @return the created stock instance
+ */
+ private Stock createStock() {
+
+ Stock stock = new Stock();
+ stock.setName("Acme");
+ stock.setCode("ACM");
+ stock.setValue(new BigDecimal(127D));
+ stock.setDate(new Date());
+ return stock;
+ }
+}
View
44 warp-rest/ftest/ftest-cxf/src/test/resources/WEB-INF/web.xml
@@ -0,0 +1,44 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <!--<context-param>-->
+ <!--<param-name>contextConfigLocation</param-name>-->
+ <!--<param-value>WEB-INF/cxf.xml</param-value>-->
+ <!--</context-param>-->
+
+ <!--<listener>-->
+ <!--<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>-->
+ <!--</listener>-->
+
+ <!--<servlet>-->
+ <!--<servlet-name>CXFServlet</servlet-name>-->
+ <!--<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>-->
+ <!--<load-on-startup>1</load-on-startup>-->
+ <!--</servlet>-->
+
+ <!--<servlet-mapping>-->
+ <!--<servlet-name>CXFServlet</servlet-name>-->
+ <!--<url-pattern>/rest/*</url-pattern>-->
+ <!--</servlet-mapping>-->
+
+ <servlet>
+ <servlet-name>CXFServlet</servlet-name>
+ <servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.jboss.arquillian.quickstart.cxf.application.StockApplication</param-value>
+ </init-param>
+ <init-param>
+ <param-name>jaxrs.application.address.ignore</param-name>
+ <param-value>false</param-value>
+ </init-param>