use of org.apache.cxf.hello_world_jms.NoSuchCodeLitFault in project cxf by apache.
the class JMSClientServerTest method testBasicConnection.
@Test
public void testBasicConnection() throws Exception {
QName serviceName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldService");
QName portName = new QName("http://cxf.apache.org/hello_world_jms", "HelloWorldPort");
URL wsdl = getWSDLURL("/wsdl/jms_test.wsdl");
HelloWorldService service = new HelloWorldService(wsdl, serviceName);
String response1 = new String("Hello Milestone-");
String response2 = new String("Bonjour");
HelloWorldPortType greeter = service.getPort(portName, HelloWorldPortType.class);
for (int idx = 0; idx < 5; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
String exResponse = response1 + idx;
assertEquals(exResponse, greeting);
String reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
try {
greeter.testRpcLitFault("BadRecordLitFault");
fail("Should have thrown BadRecoedLitFault");
} catch (BadRecordLitFault ex) {
assertNotNull(ex.getFaultInfo());
}
try {
greeter.testRpcLitFault("NoSuchCodeLitFault");
fail("Should have thrown NoSuchCodeLitFault exception");
} catch (NoSuchCodeLitFault nslf) {
assertNotNull(nslf.getFaultInfo());
assertNotNull(nslf.getFaultInfo().getCode());
}
}
((java.io.Closeable) greeter).close();
}
use of org.apache.cxf.hello_world_jms.NoSuchCodeLitFault in project cxf by apache.
the class JMSClientServerTest method testConnectionsWithinSpring.
@Test
public void testConnectionsWithinSpring() throws Exception {
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "/org/apache/cxf/systest/jms/JMSClients.xml" });
try {
String wsdlString2 = "classpath:wsdl/jms_test.wsdl";
wsdlStrings.add(wsdlString2);
broker.updateWsdl((Bus) ctx.getBean("cxf"), wsdlString2);
HelloWorldPortType greeter = (HelloWorldPortType) ctx.getBean("jmsRPCClient");
try {
for (int idx = 0; idx < 5; idx++) {
String greeting = greeter.greetMe("Milestone-" + idx);
assertNotNull("no response received from service", greeting);
String exResponse = "Hello Milestone-" + idx;
assertEquals(exResponse, greeting);
String reply = greeter.sayHi();
assertEquals("Bonjour", reply);
try {
greeter.testRpcLitFault("BadRecordLitFault");
fail("Should have thrown BadRecoedLitFault");
} catch (BadRecordLitFault ex) {
assertNotNull(ex.getFaultInfo());
}
try {
greeter.testRpcLitFault("NoSuchCodeLitFault");
fail("Should have thrown NoSuchCodeLitFault exception");
} catch (NoSuchCodeLitFault nslf) {
assertNotNull(nslf.getFaultInfo());
assertNotNull(nslf.getFaultInfo().getCode());
}
}
} catch (UndeclaredThrowableException ex) {
ctx.close();
throw (Exception) ex.getCause();
}
HelloWorldOneWayPort greeter1 = (HelloWorldOneWayPort) ctx.getBean("jmsQueueOneWayServiceClient");
assertNotNull(greeter1);
try {
greeter1.greetMeOneWay("hello");
} catch (Exception ex) {
fail("There should not throw the exception" + ex);
}
} finally {
ctx.close();
BusFactory.setDefaultBus(getBus());
BusFactory.setThreadDefaultBus(getBus());
}
}
use of org.apache.cxf.hello_world_jms.NoSuchCodeLitFault in project cxf by apache.
the class TwoWayJMSImplBase method testRpcLitFault.
public TestRpcLitFaultResponse testRpcLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
BadRecordLit badRecord = new BadRecordLit();
badRecord.setReason("BadRecordLitFault");
if (faultType.equals(BadRecordLitFault.class.getSimpleName())) {
throw new BadRecordLitFault("TestBadRecordLit", badRecord);
}
if (faultType.equals(NoSuchCodeLitFault.class.getSimpleName())) {
ErrorCode ec = new ErrorCode();
ec.setMajor((short) 1);
ec.setMinor((short) 1);
NoSuchCodeLit nscl = new NoSuchCodeLit();
nscl.setCode(ec);
throw new NoSuchCodeLitFault("TestNoSuchCodeLit", nscl);
}
return new TestRpcLitFaultResponse();
}
use of org.apache.cxf.hello_world_jms.NoSuchCodeLitFault in project cxf by apache.
the class TwoWayJMSImplBase method testRpcLitFault.
public TestRpcLitFaultResponse testRpcLitFault(String faultType) throws BadRecordLitFault, NoSuchCodeLitFault {
BadRecordLit badRecord = new BadRecordLit();
badRecord.setReason("BadRecordLitFault");
if (faultType.equals(BadRecordLitFault.class.getSimpleName())) {
throw new BadRecordLitFault("TestBadRecordLit", badRecord);
}
if (faultType.equals(NoSuchCodeLitFault.class.getSimpleName())) {
ErrorCode ec = new ErrorCode();
ec.setMajor((short) 1);
ec.setMinor((short) 1);
NoSuchCodeLit nscl = new NoSuchCodeLit();
nscl.setCode(ec);
throw new NoSuchCodeLitFault("TestNoSuchCodeLit", nscl);
}
return new TestRpcLitFaultResponse();
}
Aggregations