Search in sources :

Example 6 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method invoke_ErrorNoSuchMethodWrongArgumentType.

@Test
public void invoke_ErrorNoSuchMethodWrongArgumentType() {
    ErrorResponse response = invokeExpectError(mediaType, EJB_NAME, "add", new String[] { float.class.getName(), int.class.getName() }, pack(1, 2));
    assertEquals("java.lang.NoSuchMethodException", response.exceptionType);
    assertEquals("No method matching add([float, int]) found in business interface", response.message);
    assertNull(response.cause);
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Example 7 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method lookup_ErrorMalformedGlobalJndiName.

@Test
public void lookup_ErrorMalformedGlobalJndiName() {
    ErrorResponse response = lookupExpectError(mediaType, "java:global/" + RemoteCalculator.class.getName());
    assertEquals("javax.naming.NamingException", response.exceptionType);
    assertEquals("Global name must contain application name but got: java:global/fish.payara.ejb.endpoint.EjbOverHttpResourceTest$RemoteCalculator", response.message);
    assertNull(response.cause);
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Example 8 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method lookup_ErrorFullNameWithoutPackage.

@Test
public void lookup_ErrorFullNameWithoutPackage() {
    ErrorResponse response = lookupExpectError(mediaType, "java:global/myapp/CalculatorBean!RemoteCalculator");
    assertEquals("javax.naming.NamingException", response.exceptionType);
    assertNotNull(response.cause);
    assertEquals("java.lang.ClassNotFoundException", response.cause.exceptionType);
    assertEquals("RemoteCalculator", response.cause.message);
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Example 9 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method invoke_ErrorNoSuchApplication.

@Test
public void invoke_ErrorNoSuchApplication() {
    ErrorResponse response = invokeExpectError(mediaType, EJB_NAME.replace("/myapp/", "/unknownapp/"), "sub", new String[] { int.class.getName(), int.class.getName() }, pack(1, 2));
    assertEquals("javax.naming.NamingException", response.exceptionType);
    assertEquals("Unknown application: unknownapp", response.message);
    assertNull(response.cause);
}
Also used : ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Example 10 with ErrorResponse

use of fish.payara.ejb.http.protocol.ErrorResponse in project Payara by payara.

the class EjbOverHttpResourceTest method invoke_CyclicResult.

@Test
public void invoke_CyclicResult() {
    if (isJavaObjectSerialisation()) {
        InvokeMethodResponse response = invokeExpectSuccess(mediaType, EJB_NAME, "cyclic", new String[0], pack(new Object[0]));
        @SuppressWarnings("unchecked") List<Object> result = (List<Object>) response.result;
        assertEquals(1, result.size());
        assertSame(result, result.get(0));
    } else {
        ErrorResponse response = invokeExpectError(mediaType, EJB_NAME, "cyclic", new String[0], pack(new Object[0]));
        assertEquals("java.lang.StackOverflowError", response.exceptionType);
    }
}
Also used : InvokeMethodResponse(fish.payara.ejb.http.protocol.InvokeMethodResponse) ErrorResponse(fish.payara.ejb.http.protocol.ErrorResponse) Test(org.junit.Test)

Aggregations

ErrorResponse (fish.payara.ejb.http.protocol.ErrorResponse)12 Test (org.junit.Test)10 InvokeMethodResponse (fish.payara.ejb.http.protocol.InvokeMethodResponse)2 InvokeMethodRequest (fish.payara.ejb.http.protocol.InvokeMethodRequest)1 LookupResponse (fish.payara.ejb.http.protocol.LookupResponse)1 Response (javax.ws.rs.core.Response)1