use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndErrorTester method testServerMustUnderstand1.
/*
* Test to make sure mustUnderstand headers that are not understood
* cause a fault.
*/
public void testServerMustUnderstand1() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
// these lines make calls to the server
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
// so we clear out the client handlers afterwards
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_ADD_BAD_MU_HEADER_OUTBOUND);
// should get fault
try {
int result = testStub.testInt(5);
fail("did not receive remote exception");
} catch (WebServiceException e) {
// ok
}
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndErrorTester method testServerInboundRuntimeException2.
/*
* Have one of the server handlers throw a runtime
* exception and check that the proper methods are called.
* This test uses a protocol handler.
*/
public void testServerInboundRuntimeException2() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
// these lines make calls to the server
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
reportStub.setInstruction(SERVER_PREFIX + 2, HA_THROW_RUNTIME_EXCEPTION_INBOUND);
// so we clear out the client handlers afterwards
tracker.clearAll();
try {
testStub.testInt(3);
fail("did not receive exception");
} catch (ProtocolException e) {
// ok
}
// check result
String[] called = { "4", "2" };
List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
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));
}
// should be no destroyed handlers
List<String> destroyedHandlers = reportStub.getReport(REPORT_DESTROYED_HANDLERS);
assertTrue("Should be no destroyed handlers", destroyedHandlers.isEmpty());
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndErrorTester method testServerInboundRuntimeException1.
/*
* Have one of the server handlers throw a runtime
* exception and check that the proper methods are called.
* This test uses a logical handler.
*/
public void testServerInboundRuntimeException1() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
// these lines make calls to the server
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
reportStub.setInstruction(SERVER_PREFIX + 1, HA_THROW_RUNTIME_EXCEPTION_INBOUND);
// so we clear out the client handlers afterwards
tracker.clearAll();
try {
testStub.testInt(3);
fail("did not receive exception");
} catch (ProtocolException e) {
// pass
}
// check result
String[] called = { "4", "2", "1" };
List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
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));
}
// should be no destroyed handlers
List<String> destroyedHandlers = reportStub.getReport(REPORT_DESTROYED_HANDLERS);
assertTrue("Should be no destroyed handlers", destroyedHandlers.isEmpty());
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndErrorTester method testServerOutboundProtocolException1.
/*
* Have one of the server handlers throw a simple protocol
* exception and check that the proper methods are called.
*/
public void testServerOutboundProtocolException1() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
// these lines make calls to the server
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
reportStub.setInstruction(SERVER_PREFIX + 2, HA_THROW_PROTOCOL_EXCEPTION_OUTBOUND);
// so we clear out the client handlers afterwards
tracker.clearAll();
try {
testStub.testInt(3);
fail("did not receive exception");
} catch (ProtocolException e) {
// ok
}
// check result
String[] called = { "4", "2", "1", "0", "0", "1", "2" };
List<String> calledHandlers = reportStub.getReport(REPORT_CALLED_HANDLERS);
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));
}
// too many closes to check them all
// should be no destroyed handlers
List<String> destroyedHandlers = reportStub.getReport(REPORT_DESTROYED_HANDLERS);
assertTrue("Should be no destroyed handlers", destroyedHandlers.isEmpty());
}
use of fromwsdl.handler.common.HandlerTracker in project metro-jax-ws by eclipse-ee4j.
the class EndToEndErrorTester method testValidMustUnderstand.
/*
* Test to make sure mustUnderstand headers of the right type get
* through with no fault.
*/
public void testValidMustUnderstand() throws Exception {
TestService_Service service = getService();
TestService testStub = getTestStub(service);
ReportService reportStub = getReportStub(service);
HandlerTracker tracker = HandlerTracker.getClientInstance();
// these lines make calls to the server
reportStub.clearHandlerTracker();
for (int i = 0; i < numTotalHandlers; i++) {
reportStub.setInstruction(SERVER_PREFIX + i, HA_REGISTER_HANDLE_XYZ);
}
reportStub.setInstruction(SERVER_PREFIX + 2, HA_ADD_GOOD_MU_HEADER_OUTBOUND);
// so we clear out the client handlers afterwards
tracker.clearAll();
tracker.setHandlerAction(CLIENT_PREFIX + 5, HA_ADD_GOOD_MU_HEADER_OUTBOUND);
// should get no fault
int result = testStub.testInt(5);
assertEquals("did not get int echoed back from server", 5, result);
}
Aggregations