Arquillian REST Extension 1.0.0.Alpha4 Released

The Arquillian team is proud to announce the 1.0.0.Alpha4 release of the Arquillian REST Extension component!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian REST Extension
Version 1.0.0.Alpha4 view tag
Release date 2015-11-05
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-rest-client-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-test-app jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-2x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-3x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-jaxrs-2 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-resteasy jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-cxf jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jaxrs-2.0 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-bom pom

Release notes and resolved issues 0

Thanks to the following list of contributors: Aslak Knutsen, Bernard Labno

Arquillian REST Extension 1.0.0.Alpha3 Released

The Arquillian team is proud to announce the 1.0.0.Alpha3 release of the Arquillian REST Extension component!

Support for Jersey as Rest-Client implementation

If you want to use Jersey as the backing framework for Rest-Client you can include the new artifact arquillian-rest-client-impl-jersey

<dependency>
  <groupId>org.jboss.arquillian.extension</groupId>
  <artifactId>arquillian-rest-client-impl-jersey</artifactId>
  <version>1.0.0.Alpha3</version>
</dependency>

Additional you need to add the dependencies on the Jersey version you would like to use.

Support for injection of WebTarget in @Test

@Test
public void banCustomerRaw(@ArquillianResteasyResource WebTarget webTarget)
{
  final Customer result = webTarget.path("/customer/1")
                           .request()
                           .post(null)
                           .readEntity(Customer.class);
}

The WebTarget will be pre initialized with the web application base URL.

Support for @Header and @Headers on @Test

@Test
@Header(name = "Authorization", value = "abc")
@Consumes(MediaType.APPLICATION_JSON)
public void banCustomer(@ArquillianResteasyResource CustomerResource customerResource)
{ .. }

This will simply set the Authorization header on the @WebTarget or proxy used when executing this request.

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian REST Extension
Version 1.0.0.Alpha3 view tag
Release date 2014-07-01
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-rest-client-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-test-app jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-2x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-3x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-jaxrs-2 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-resteasy jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-cxf jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jaxrs-2.0 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-bom pom

Release notes and resolved issues 0

Jersey support

Thanks to the following list of contributors: Bernard Labno, Aslak Knutsen

Arquillian REST Extension 1.0.0.Alpha2 Released

The Arquillian team is proud to announce the 1.0.0.Alpha2 release of the Arquillian REST Extension component!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian REST Extension
Version 1.0.0.Alpha2 view tag
Release date 2013-12-10
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-rest-client-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-2x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-3x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-jaxrs-2 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-resteasy jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-cxf jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jaxrs-2.0 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-bom pom

Release notes and resolved issues 0

JAX-RS 2 Client

Thanks to the following list of contributors: John D. Ament, Aslak Knutsen, Bernard Labno

Arquillian REST Extension 1.0.0.Alpha1 Released

The Arquillian team is proud to announce the 1.0.0.Alpha1 release of the Arquillian REST Extension component!

This is the first release of the Arquillian REST extension.

At the moment it consist of two complementary parts:

REST client

Simplifies writing the client side of testing REST services

Warp REST extension

An extension, that with a bit of magic allows you to intercept the state of the Service prior or after to it’s execution

REST client

Sometimes you need to test your REST app as a black box. You know the interface (the contract), you have some input and know what results you expect. For this purpose Arquillian REST Client Extension is your friend. It makes your code shorter by injecting configured artifacts. The extension is based on the RestEasy client library. Both RestEasy 2.x and 3.x are supported. You only need to add the proper dependency to your classpath.

@RunWith(Arquillian.class)
public class RestClientTestCase {

  @ArquillianResource
  private URL deploymentURL;

  @Deployment(testable = false)
  public static WebArchive create()
  {
      return ShrinkWrap.create(WebArchive.class)
          .addPackage(Customer.class.getPackage())
          .addClasses(CustomerResource.class, CustomerResourceImpl.class, JaxRsActivator.class);
  }

  /**
   * Arquillian calculates resource path by using deployment URL+ArquillianResteasyResource.value
   * which is by default "rest". If your API is located under different root i.e.
   * "api_v2" then use @ArquillianResteasyResource("api_v2")
   *
   * @param customerResource configured resource ready for use, injected by Arquillian
   */
  @Test
  public void getCustomerById(@ArquillianResteasyResource CustomerResource customerResource)
  {
      // Given
      final String name = "Acme Corporation";
      final long customerId = 1L;

      // When
      final Customer result = customerResource.getCustomerById(customerId);

      // Then
      assertNotNull(result);
      assertNotNull(result.getId());
      assertEquals(name, result.getName());
  }
}

For more examples on how to use these extensions and quickly get started with development you can take a look at the integration tests that are part of project source code.

Warp REST

Arquillian Warp makes it possible to perform a gray-box testing of any servlet based in-container application. Now we are introducing an API that allows you to intercept the state of the REST services and validate the generated response including, but not limiting to the security context, response HTTP status code, HTTP headers and the response entities. The actual HTTP servlet request and responses are also being recorded, allowing you to verify them directly on the server. All of this happens in the application container, before the response is returned to the invoking client!

The WARP extension targets JAX-RS major versions and already has support for JAX-RS 1.1 and 2.0.

The JAX-RS 1.1 specification did not define any support for request interception, while this has been widely supported through implementation specific hooks, that is why in order to use the extension with JAX-RS 1.1 one of JAX-RS provider specific implementation need to be chosen. Fortunately we already support most the popular providers:

  • RESTEasy
  • Jersey
  • CXF

Now, let’s write some code:

StockServiceResourceTestCase.java
@Test
@RunAsClient
public void testStockGetWarp() {

  Warp.initiate(new Activity() {
      @Override
      public void perform() {

          // invokes the service
          stockService.getStock(1L);
      }
  }).inspect(new Inspection() {

      private static final long serialVersionUID = 1L;

      @ArquillianResource
      private RestContext restContext;

      @AfterServlet
      public void testGetStock() {

          // validates the service response
          assertEquals(HttpMethod.GET, restContext.getHttpRequest().getMethod());
          assertEquals(200, restContext.getHttpResponse().getStatusCode());
          assertEquals("application/json", restContext.getHttpResponse().getContentType());
          assertNotNull(restContext.getHttpResponse().getEntity());
      }
  });
}

For more examples on how to use these extensions and quickly get started with development you can take a look at the integration tests that are part of the projects source code.

We look forward to hearing your feedback about this release in the community forums!

What is Arquillian?

Arquillian is open source software that empowers you to test JVM-based applications more effectively. Created to defend the software galaxy from bugs, Arquillian brings your test to the runtime so you can focus on testing your application's behavior rather than managing the runtime. Using Arquillian, you can develop a comprehensive suite of tests from the convenience of your IDE and run them in any IDE, build tool or continuous integration environment.

Release details

Component Arquillian REST Extension
Version 1.0.0.Alpha1 view tag
Release date 2013-10-23
Released by Aslak Knutsen
Compiled against

Published artifacts org.jboss.arquillian.extension

  • org.jboss.arquillian.extension » arquillian-rest-client-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-2x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-client-impl-3x jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-api jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-spi jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-base jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-resteasy jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jersey jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-cxf jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-impl-jaxrs-2.0 jar javadoc pom
  • org.jboss.arquillian.extension » arquillian-rest-warp-bom pom

Release notes and resolved issues 0

Thanks to the following list of contributors: Bernard Labno, Aslak Knutsen, Jakub Narloch, Lukas Fryc