use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.
the class EjbOverHttpResourceTest method invoke_ErrorMalformedArguments.
@Test
public void invoke_ErrorMalformedArguments() {
Object argValues = isJavaObjectSerialisation() ? new byte[] { 42 } : Collections.singletonMap("foo", "bar");
ErrorResponse response = invokeExpectError(mediaType, EJB_NAME, "add", new String[] { int.class.getName(), int.class.getName() }, argValues);
assertEquals("javax.ws.rs.InternalServerErrorException", response.exceptionType);
assertEquals("Failed to de-serialise method arguments from binary representation.", response.message);
}
use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.
the class EjbOverHttpResourceTest method invokeExpectError.
private static ErrorResponse invokeExpectError(String mediaType, String jndiName, String method, String[] argTypes, Object argValues) {
Entity<InvokeMethodRequest> entity = invokeBody(mediaType, jndiName, method, argTypes, argValues);
try (Response response = target.path("jndi/invoke").request(mediaType).buildPost(entity).invoke()) {
assertNotEquals(Status.OK.getStatusCode(), response.getStatus());
if (mediaType.equals(response.getMediaType().toString())) {
return response.readEntity(ErrorResponse.class);
}
fail("Unexpected error response in media type " + response.getMediaType() + ": " + response.readEntity(String.class));
return null;
}
}
use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.
the class EjbOverHttpResourceTest method invoke_ErrorClassNotFound.
@Test
public void invoke_ErrorClassNotFound() {
ErrorResponse response = invokeExpectError(mediaType, EJB_NAME, "add", new String[] { "undefined", "int" }, pack(1, 2));
assertThat(response.message, CoreMatchers.endsWith("java.lang.ClassNotFoundException: undefined"));
assertNotNull(response.cause);
}
use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.
the class EjbOverHttpResourceTest method lookup_ErrorNoGlobalJndiName.
@Test
public void lookup_ErrorNoGlobalJndiName() {
ErrorResponse response = lookupExpectError(mediaType, "java:app/myapp/" + RemoteCalculator.class.getName());
assertEquals("javax.naming.NamingException", response.exceptionType);
assertEquals("Only global names are supported but got: java:app/myapp/fish.payara.ejb.endpoint.EjbOverHttpResourceTest$RemoteCalculator", response.message);
assertNull(response.cause);
}
use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.
the class EjbOverHttpResourceTest method invoke_ErrorNoSuchEjb.
@Test
public void invoke_ErrorNoSuchEjb() {
ErrorResponse response = invokeExpectError(mediaType, EJB_NAME + "x", "add", new String[] { int.class.getName(), int.class.getName() }, pack(1, 2));
assertEquals("javax.naming.NamingException", response.exceptionType);
assertEquals("No such bean: java:global/myapp/RemoteCalculatorx", response.message);
assertNull(response.cause);
}
Aggregations