use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method methodWithStringClassWithEntityTest.
/*
* @testName: methodWithStringClassWithEntityTest
*
* @assertion_ids: JAXRS:JAVADOC:569;
*
* @test_Strategy: Invoke an arbitrary method for the current request
* synchronously.
*/
@Test
public void methodWithStringClassWithEntityTest() throws Fault {
String response = null;
for (String method : ENTITY_METHODS) {
SyncInvoker sync = createSyncInvokerForMethod(method.toLowerCase());
Entity<String> entity = createEntity(method.toLowerCase());
response = sync.method(method, entity, String.class);
assertResponseString(response, method.toLowerCase());
}
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method postWithStringClassTest.
/*
* @testName: postWithStringClassTest
*
* @assertion_ids: JAXRS:JAVADOC:585;
*
* @test_Strategy: Invoke HTTP post method for the current request
* synchronously.
*/
@Test
public void postWithStringClassTest() throws Fault {
Entity<String> entity = createEntity("post");
SyncInvoker sync = createSyncInvokerForMethod("post");
String response = sync.post(entity, String.class);
assertResponseString(response, "post");
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method traceWithGenericTypeStringThrowsWebApplicationExceptionTest.
/*
* @testName: traceWithGenericTypeStringThrowsWebApplicationExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:604;
*
* @test_Strategy: jakarta.ws.rs.client.SyncInvoker.trace( Entity, 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 traceWithGenericTypeStringThrowsWebApplicationExceptionTest() throws Fault {
Runnable run = new Runnable() {
@Override
public void run() {
SyncInvoker sync = createSyncInvokerForMethod("tracenotok");
GenericType<String> generic = createGeneric(String.class);
sync.trace(generic);
}
};
assertWebApplicationException(run);
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method createSyncInvokerForMethod.
/**
* Create SyncInvoker for given resource method and start time
*/
protected SyncInvoker createSyncInvokerForMethod(String methodName) {
Client client = ClientBuilder.newClient();
client.register(new JdkLoggingFilter(false));
WebTarget target = client.target(getUrl(methodName));
SyncInvoker sync = target.request();
return sync;
}
use of jakarta.ws.rs.client.SyncInvoker in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method traceWithStringClassThrowsProcessingExceptionTest.
/*
* @testName: traceWithStringClassThrowsProcessingExceptionTest
*
* @assertion_ids: JAXRS:JAVADOC:601;
*
* @test_Strategy: jakarta.ws.rs.client.SyncInvoker.trace( Entity, Class )
* throws ProcessingException in case the invocation failed.
*/
@Test
public void traceWithStringClassThrowsProcessingExceptionTest() throws Fault {
Runnable run = new Runnable() {
@Override
public void run() {
SyncInvoker sync = createSyncInvokerWrongUrl();
sync.trace(String.class);
}
};
assertProcessingException(run);
}
Aggregations