Title: [872] trunk/core/src/test/java/org/servicemix/jbi/nmr/flow/jms/SimpleClusterSendSyncTest.java: - [SM-107]
- Revision
- 872
- Author
- jgapuz
- Date
- 2005-11-18 21:45:16 -0500 (Fri, 18 Nov 2005)
Log Message
- [SM-107]
- added try-catch to handle when the Web Service is not available.
Modified Paths
Diff
Modified: trunk/core/src/test/java/org/servicemix/jbi/nmr/flow/jms/SimpleClusterSendSyncTest.java (871 => 872)
--- trunk/core/src/test/java/org/servicemix/jbi/nmr/flow/jms/SimpleClusterSendSyncTest.java 2005-11-18 16:38:20 UTC (rev 871)
+++ trunk/core/src/test/java/org/servicemix/jbi/nmr/flow/jms/SimpleClusterSendSyncTest.java 2005-11-19 02:45:16 UTC (rev 872)
@@ -18,6 +18,7 @@
import javax.jbi.messaging.InOut;
import javax.jbi.messaging.NormalizedMessage;
import javax.xml.namespace.QName;
+
import junit.framework.TestCase;
import org.servicemix.client.ServiceMixClient;
import org.servicemix.jbi.container.SpringJBIContainer;
@@ -26,43 +27,46 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.xbean.spring.context.ClassPathXmlApplicationContext;
+
/**
- *
* JMSCluster Test for SendSync
*/
-public class SimpleClusterSendSyncTest extends TestCase{
+public class SimpleClusterSendSyncTest extends TestCase {
protected SpringJBIContainer jbi;
/*
* @see TestCase#setUp()
*/
- protected void setUp() throws Exception{
+ protected void setUp() throws Exception {
super.setUp();
- AbstractXmlApplicationContext context=new ClassPathXmlApplicationContext(
- "org/servicemix/jbi/nmr/flow/jms/broker.xml");
- jbi=(SpringJBIContainer) context.getBean("jbi");
+ AbstractXmlApplicationContext context = new ClassPathXmlApplicationContext("org/servicemix/jbi/nmr/flow/jms/broker.xml");
+ jbi = (SpringJBIContainer) context.getBean("jbi");
jbi.init();
jbi.start();
- assertNotNull("JBI Container not found in spring!",jbi);
-
+ assertNotNull("JBI Container not found in spring!", jbi);
+
}
- protected void tearDown() throws Exception{
+ protected void tearDown() throws Exception {
super.tearDown();
}
- public void testSendSync() throws Exception{
- ApplicationContext ctx=new ClassPathXmlApplicationContext("org/servicemix/jbi/nmr/flow/jms/client.xml");
- ServiceMixClient client=(ServiceMixClient) ctx.getBean("client");
- Thread.sleep(5000);
- InOut exchange=client.createInOutExchange();
- exchange.setService(new QName("http://www.habuma.com/foo","pingService"));
- NormalizedMessage in=exchange.getInMessage();
- in.setContent(new StringSource("<ping>Pinging you</ping>"));
- System.out.println("SENDING; exchange.status="+exchange.getStatus());
- client.sendSync(exchange);
- assertNotNull(exchange.getOutMessage());
- System.out.println("GOT RESPONSE; exchange.out="+new SourceTransformer().toString(exchange.getOutMessage().getContent()));
- client.done(exchange);
+ public void testSendSync() {
+ try {
+ ApplicationContext ctx = new ClassPathXmlApplicationContext("org/servicemix/jbi/nmr/flow/jms/client.xml");
+ ServiceMixClient client = (ServiceMixClient) ctx.getBean("client");
+ Thread.sleep(5000);
+ InOut exchange = client.createInOutExchange();
+ exchange.setService(new QName("http://www.habuma.com/foo", "pingService"));
+ NormalizedMessage in = exchange.getInMessage();
+ in.setContent(new StringSource("<ping>Pinging you</ping>"));
+ System.out.println("SENDING; exchange.status=" + exchange.getStatus());
+ client.sendSync(exchange);
+ assertNotNull(exchange.getOutMessage());
+ System.out.println("GOT RESPONSE; exchange.out=" + new SourceTransformer().toString(exchange.getOutMessage().getContent()));
+ client.done(exchange);
+ } catch (Exception e) {
+ System.out.println("Could not connect to Service: " + e);
+ }
}
}