@Test
public void testRoutesWithFault() throws Exception {
URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first",
"PersonService"));
Person client = ss.getSoap();
((BindingProvider)client).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:" + port3 + "/CXFWsdlOnlyTest/PersonService/");
Holder<String> personId = new Holder<String>();
personId.value = "hello";
Holder<String> ssn = new Holder<String>();
Holder<String> name = new Holder<String>();
client.getPerson(personId, ssn, name);
assertEquals("Bonjour", name.value);
personId.value = "";
ssn = new Holder<String>();
name = new Holder<String>();
Throwable t = null;
try {
client.getPerson(personId, ssn, name);
fail("Expect exception");
} catch (UnknownPersonFault e) {
t = e;
}
assertTrue(t instanceof UnknownPersonFault);
Person client2 = ss.getSoap2();
((BindingProvider)client2).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
"http://localhost:" + port4 + "/CXFWsdlOnlyTest/PersonService/");
Holder<String> personId2 = new Holder<String>();
personId2.value = "hello";
Holder<String> ssn2 = new Holder<String>();
Holder<String> name2 = new Holder<String>();
client2.getPerson(personId2, ssn2, name2);
assertEquals("Bonjour", name2.value);
personId2.value = "";
ssn2 = new Holder<String>();
name2 = new Holder<String>();
try {
client2.getPerson(personId2, ssn2, name2);
fail("Expect exception");
} catch (UnknownPersonFault e) {
t = e;
}
assertTrue(t instanceof UnknownPersonFault);