use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class SpecExamples method typeRelationships.
public void typeRelationships() {
Client client = ClientBuilder.newClient();
WebTarget uri = client.target("");
Invocation.Builder builder = uri.request("text/plain");
SyncInvoker syncInvoker = builder;
AsyncInvoker asyncInvoker = builder.async();
Invocation inv = builder.buildGet();
Response r1 = builder.get();
Response r2 = syncInvoker.get();
Response r3 = inv.invoke();
Future<Response> fr1 = asyncInvoker.get();
Future<Response> fr2 = inv.submit();
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method optionsWithGenericTypeStringThrowsWebApplicationExceptionTest.
/*
* @testName: optionsWithGenericTypeStringThrowsWebApplicationExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:580;
*
* @test_Strategy: jakarta.ws.rs.client.SyncInvoker.options( GenericType )
* 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 optionsWithGenericTypeStringThrowsWebApplicationExceptionTest() throws Fault {
Runnable run = new Runnable() {
@Override
public void run() {
SyncInvoker sync = createSyncInvokerForMethod("optionsnotok");
GenericType<String> generic = createGeneric(String.class);
sync.options(generic);
}
};
assertWebApplicationException(run);
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method methodWithGenericTypeResponseWithEntityTest.
/*
* @testName: methodWithGenericTypeResponseWithEntityTest
*
* @assertion_ids: JAXRS:JAVADOC:572;
*
* @test_Strategy: Invoke an arbitrary method for the current request
* synchronously.
*/
@Test
public void methodWithGenericTypeResponseWithEntityTest() throws Fault {
Response response = null;
for (String method : ENTITY_METHODS) {
GenericType<Response> generic = createGeneric(Response.class);
SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
Entity<String> entity = createEntity(method.toLowerCase());
response = sync.method(method, entity, generic);
assertResponseOk(response);
}
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method methodWithGenericTypeStringWithEntityTest.
/*
* @testName: methodWithGenericTypeStringWithEntityTest
*
* @assertion_ids: JAXRS:JAVADOC:572;
*
* @test_Strategy: Invoke an arbitrary method for the current request
* synchronously.
*/
@Test
public void methodWithGenericTypeStringWithEntityTest() throws Fault {
String response = null;
for (String method : ENTITY_METHODS) {
GenericType<String> generic = createGeneric(String.class);
SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
Entity<String> entity = createEntity(method.toLowerCase());
response = sync.method(method, entity, generic);
assertResponseString(response, method.toLowerCase());
}
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method postTest.
// ------------------------------------------------------------------
// ---------------------------POST-----------------------------------
// ------------------------------------------------------------------
/*
* @testName: postTest
*
* @assertion_ids: JAXRS:JAVADOC:583;
*
* @test_Strategy: Invoke HTTP post method for the current request
* synchronously.
*/
@Test
public void postTest() throws Fault {
SyncInvoker sync = createSyncInvokerForMethod("post");
Entity<String> entity = createEntity("post");
Response response = sync.post(entity);
assertResponseOk(response);
}
Aggregations