use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method postWithGenericTypeStringTest.
/*
* @testName: postWithGenericTypeStringTest
*
* @assertion_ids: JAXRS:JAVADOC:588;
*
* @test_Strategy: Invoke HTTP post method for the current request
* synchronously.
*/
@Test
public void postWithGenericTypeStringTest() throws Fault {
GenericType<String> generic = createGeneric(String.class);
Entity<String> entity = createEntity("post");
SyncInvoker sync = createSyncInvokerForMethod("post");
String response = sync.post(entity, generic);
assertResponseString(response, "post");
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method methodWithGenericTypeResponseTest.
/*
* @testName: methodWithGenericTypeResponseTest
*
* @assertion_ids: JAXRS:JAVADOC:564;
*
* @test_Strategy: Invoke an arbitrary method for the current request
* synchronously.
*/
@Test
public void methodWithGenericTypeResponseTest() throws Fault {
GenericType<Response> generic = createGeneric(Response.class);
Response response = null;
for (String method : METHODS) {
SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
response = sync.method(method, generic);
assertResponseOk(response);
}
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method postWithStringClassThrowsProcessingExceptionTest.
/*
* @testName: postWithStringClassThrowsProcessingExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:585;
*
* @test_Strategy: jakarta.ws.rs.client.SyncInvoker.post( Entity, Class ) throws
* ProcessingException in case the invocation failed.
*/
@Test
public void postWithStringClassThrowsProcessingExceptionTest() throws Fault {
Runnable run = new Runnable() {
@Override
public void run() {
SyncInvoker sync = createSyncInvokerWrongUrl();
Entity<String> entity = createEntity("post");
sync.post(entity, String.class);
}
};
assertProcessingException(run);
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method headTest.
// ------------------------------------------------------------------
// ---------------------------HEAD-----------------------------------
// ------------------------------------------------------------------
/*
* @testName: headTest
*
* @assertion_ids: JAXRS:JAVADOC:557;
*
* @test_Strategy: Invoke HTTP HEAD method for the current request
* synchronously.
*/
@Test
public void headTest() throws Fault {
SyncInvoker sync = createSyncInvokerForMethod("head");
Response response = sync.head();
Status status = Status.fromStatusCode(response.getStatus());
assertTrue(status == Status.OK || status == Status.NO_CONTENT, "Incorrect status for head received");
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method methodWithStringClassWithEntityThrowsWebApplicationExceptionTest.
/*
* @testName: methodWithStringClassWithEntityThrowsWebApplicationExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:569;
*
* @test_Strategy: jakarta.ws.rs.client.SyncInvoker.method(String, Entity,
* Class) throws WebApplicationException - in case the response status code of
* the response returned by the server is not successful and the specified
* response type is not Response.
*/
@Test
public void methodWithStringClassWithEntityThrowsWebApplicationExceptionTest() throws Fault {
for (final String method : ENTITY_METHODS) {
Runnable run = new Runnable() {
@Override
public void run() {
SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase() + "notok");
Entity<String> entity = createEntity(method.toLowerCase());
sync.method(method, entity, String.class);
}
};
assertWebApplicationException(run);
}
}
Aggregations