Search in sources :

Example 51 with HandlerTracker

use of handler.handler_processing.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTest method testSOAPHeader1.

/*
     * Test soap header. This test has a handler add header elements
     * and another handler check for them. Test1 is two client side
     * handlers.
     */
public void testSOAPHeader1() throws Exception {
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    TestService testStub = getTestStub(getService());
    tracker.clearAll();
    tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_ADD_HEADER_OUTBOUND);
    tracker.setHandlerAction(CLIENT_PREFIX + 7, HA_CHECK_FOR_ADDED_HEADER_OUTBOUND);
    testStub.testInt(123);
}
Also used : HandlerTracker(handler.handler_processing.common.HandlerTracker)

Example 52 with HandlerTracker

use of handler.handler_processing.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTest method testClientOneWayReturnFalse2.

/*
     * Have one of the client handlers return false during a
     * one-way request. The handler chain caller should stop
     * calling handlers and dispatch the message to the endpoint.
     *
     * Also check the server handlers to make sure the message
     * went through to the endpoint.
     */
public void testClientOneWayReturnFalse2() throws Exception {
    TestService_Service service = getService();
    TestService testStub = getTestStub(service);
    ReportService reportStub = getReportStub(service);
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    reportStub.clearHandlerTracker();
    tracker.clearAll();
    for (int i = 0; i < numTotalHandlers; i++) {
        tracker.setHandlerAction(CLIENT_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
    }
    tracker.setHandlerAction(CLIENT_PREFIX + 3, HA_RETURN_FALSE);
    testStub.testIntOneWay(0);
    // handler 3 won't register
    int[] calledNames = { 0, 1 };
    int[] closed = { 3, 1, 0 };
    List<String> calledHandlers = tracker.getCalledHandlers();
    List<String> closedHandlers = tracker.getClosedHandlers();
    assertEquals("did not get the right number of called handlers", calledNames.length, calledHandlers.size());
    for (int i = 0; i < calledNames.length; i++) {
        assertEquals("did not get expected handler name", CLIENT_PREFIX + calledNames[i], calledHandlers.get(i));
    }
    assertEquals("did not get the right number of closed handlers", closed.length, closedHandlers.size());
    for (int i = 0; i < closed.length; i++) {
        assertEquals("did not get expected handler name", CLIENT_PREFIX + closed[i], closedHandlers.get(i));
    }
}
Also used : HandlerTracker(handler.handler_processing.common.HandlerTracker)

Example 53 with HandlerTracker

use of handler.handler_processing.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTest method testSOAPMessageContextInformationClient.

/*
     * Check SOAPMessageContext in handlers on client side.
     */
public void testSOAPMessageContextInformationClient() throws Exception {
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    TestService testStub = getTestStub(getService());
    tracker.clearAll();
    tracker.setHandlerAction(CLIENT_PREFIX + "4", HA_CHECK_SMC);
    tracker.setHandlerAction(CLIENT_PREFIX + "5", HA_CHECK_SMC);
    tracker.setHandlerAction(CLIENT_PREFIX + "7", HA_CHECK_SMC);
    testStub.testInt(3);
}
Also used : HandlerTracker(handler.handler_processing.common.HandlerTracker)

Example 54 with HandlerTracker

use of handler.handler_processing.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTest method testClientOutboundReturnFalse3.

/*
     * Have one of the client handlers return false and change
     * the message contents to look like a reply. Should get 0
     * back as result and proper handlers were called and closed.
     * Have first handler return false. Test for bug 6232834.
     */
public void testClientOutboundReturnFalse3() throws Exception {
    TestService_Service service = getService();
    TestService testStub = getTestStub(service);
    ReportService reportStub = getReportStub(service);
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    reportStub.clearHandlerTracker();
    tracker.clearAll();
    for (int i = 0; i < numTotalHandlers; i++) {
        tracker.setHandlerAction(CLIENT_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
    }
    tracker.setHandlerAction(CLIENT_PREFIX + 0, HA_RETURN_FALSE_CHANGE_MESSAGE);
    int result = testStub.testInt(0);
    assertEquals("did not get expected value back", 0, result);
    // check called handlers
    int[] called = { 0 };
    int[] closed = { 0 };
    List<String> calledHandlers = tracker.getCalledHandlers();
    assertEquals("Did not get proper number of called handlers", called.length, calledHandlers.size());
    for (int i = 0; i < called.length; i++) {
        assertEquals("did not find expected handler", CLIENT_PREFIX + called[i], calledHandlers.get(i));
    }
    // check closed handlers
    List<String> closedHandlers = tracker.getClosedHandlers();
    assertEquals("Did not get proper number of closed handlers", closed.length, closedHandlers.size());
    for (int i = 0; i < closed.length; i++) {
        assertEquals("did not find expected handler", CLIENT_PREFIX + closed[i], closedHandlers.get(i));
    }
}
Also used : HandlerTracker(handler.handler_processing.common.HandlerTracker)

Example 55 with HandlerTracker

use of handler.handler_processing.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.

the class EndToEndTest method testServerOutboundReturnFalse2.

/*
     * Have one of the server handlers return false and check
     * that the proper handlers were called.
     */
public void testServerOutboundReturnFalse2() throws Exception {
    TestService_Service service = getService();
    TestService testStub = getTestStub(service);
    ReportService reportStub = getReportStub(service);
    HandlerTracker tracker = HandlerTracker.getClientInstance();
    reportStub.clearHandlerTracker();
    for (int i = 0; i < numTotalServerHandlers; i++) {
        reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
    }
    reportStub.setInstruction(SERVER_PREFIX + "1", HA_RETURN_FALSE_OUTBOUND);
    tracker.clearAll();
    int result = testStub.testInt(0);
    assertEquals("did not get expected value back", 0, result);
    // check called handlers on server side
    List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
    // server0 called twice, the rest are skipped
    int[] called = { 4, 2, 1, 0, 0, 1 };
    assertEquals("Did not get proper number of called handlers", called.length, calledHandlers.size());
    for (int i = 0; i < called.length; i++) {
        assertEquals("did not find expected handler", SERVER_PREFIX + called[i], calledHandlers.get(i));
    }
}
Also used : HandlerTracker(handler.handler_processing.common.HandlerTracker)

Aggregations

HandlerTracker (handler.handler_processing.common.HandlerTracker)62 WebServiceException (jakarta.xml.ws.WebServiceException)16 SOAPFaultException (jakarta.xml.ws.soap.SOAPFaultException)16 ProtocolException (jakarta.xml.ws.ProtocolException)13 SOAPFault (jakarta.xml.soap.SOAPFault)8 TestProtocolException (handler.handler_processing.common.TestProtocolException)5 Map (java.util.Map)4 BindingProvider (jakarta.xml.ws.BindingProvider)3 Binding (jakarta.xml.ws.Binding)1 Handler (jakarta.xml.ws.handler.Handler)1 SOAPBinding (jakarta.xml.ws.soap.SOAPBinding)1 QName (javax.xml.namespace.QName)1