Skip to content

Latest commit

 

History

History
152 lines (127 loc) · 7.86 KB

README.adoc

File metadata and controls

152 lines (127 loc) · 7.86 KB

jaxrs-client: JAX-RS Client API example

The jaxrs-client quickstart demonstrates JAX-RS Client API, which interacts with a JAX-RS Web service that runs on WildFly.

What is it?

The jaxrs-client quickstart demonstrates the JAX-RS Client API which interacts with a JAX-RS Web service.

This client "calls" many POST, GET, and DELETE operations using different ways: synchronized, asynchronous, delayed and filtered invocations.

Run the Arquillian Tests

This quickstart provides Arquillian tests. By default, these tests are configured to be skipped as Arquillian tests require the use of a container.

  1. Start the WildFly server with the standalone default profile as described above.

  2. Open a terminal and navigate to the root directory of this quickstart.

  3. Type the following command to run the test goal with the following profile activated:

    $ mvn clean verify -Parq-remote

You can also let Arquillian manage the WildFly server by using the arq-managed profile. For more information about how to run the Arquillian tests, see Run the Arquillian Tests.

Investigate the Console Output

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest
Dec 29, 2014 3:34:44 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest requestResponseFiltersTest
INFO: ### Testing Request and Response Filters ###
Dec 29, 2014 3:34:44 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest requestResponseFiltersTest
INFO: dropping all contacts
Dec 29, 2014 3:34:45 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest requestResponseFiltersTest
INFO: Invoking create new contact using a ClientRequestFilter
Dec 29, 2014 3:34:45 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest requestResponseFiltersTest
INFO: Invoking list all contacts using a ClientResponseFilter
Dec 29, 2014 3:34:45 PM org.jboss.as.quickstarts.jaxrsclient.test.LogResponseFilter filter
INFO: Date: Mon Dec 29 15:34:45 BRST 2014- Status: 200
Dec 29, 2014 3:34:45 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: ### Testing Delayed invocaton ###
Dec 29, 2014 3:34:45 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: dropping all contacts
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: Creating a new contact invocation
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: Creating list all contacts invocation
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: invoking the new contact
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest delayedInvocationTest
INFO: invoking list all contacts ASYNC
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest asyncCrudTest
INFO: ### CRUD tests  ASYNC ###
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest asyncCrudTest
INFO: dropping all contacts ASYNC
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest asyncCrudTest
INFO: creating a new contact ASYNC
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest asyncCrudTest
INFO: delete a contact by id ASYNC
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest asyncCrudTest
INFO: fetching all contacts ASYNC
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest invocationCallBackTest
INFO: ### Testing invocation callback ###
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest invocationCallBackTest
INFO: dropping all contacts
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest invocationCallBackTest
INFO: Creating a InvocationCallback
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest invocationCallBackTest
INFO: Invoking a service using the InvocationCallback
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: ### CRUD tests ###
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: dropping all contacts
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: creating a new contact
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: fetching a contact by id
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: fetching all contacts
Dec 29, 2014 3:34:46 PM org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest cruedTest
INFO: delete a contact by id
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.51 sec - in org.jboss.as.quickstarts.jaxrsclient.test.ContactsRestClientTest

Results :

Tests run: 5, Failures: 0, Errors: 0, Skipped: 0

Run the Quickstart in Red Hat JBoss Developer Studio or Eclipse

You can also start the server and deploy the quickstarts or run the Arquillian tests from Eclipse using JBoss tools. For general information about how to import a quickstart, add a WildFly server, and build and deploy a quickstart, see Use JBoss Developer Studio or Eclipse to Run the Quickstarts.

To run the tests in Red Hat JBoss Developer Studio:

  1. You must first set the active Maven profile in project properties to be either arq-managed for running on managed server or arq-remote for running on remote server.

  2. Then, to run the tests, right click on the project or individual classes and select Run As –> JUnit Test in the context menu.