1 17 package org.apache.servicemix.eip; 18 19 import javax.jbi.messaging.InOnly; 20 import javax.xml.namespace.QName ; 21 22 import org.apache.servicemix.client.DefaultServiceMixClient; 23 import org.apache.servicemix.client.ServiceMixClient; 24 import org.apache.servicemix.jbi.container.ActivationSpec; 25 import org.apache.servicemix.jbi.jaxp.StringSource; 26 import org.apache.servicemix.tck.Receiver; 27 import org.apache.servicemix.tck.SpringTestSupport; 28 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; 29 import org.springframework.context.support.AbstractXmlApplicationContext; 30 31 public class SpringConfigurationTest extends SpringTestSupport { 32 33 public void testConfig() throws Exception { 34 ActivationSpec as = new ActivationSpec(); 35 as.setComponentName("client"); 36 ServiceMixClient client = new DefaultServiceMixClient(jbi, as); 37 InOnly me = client.createInOnlyExchange(); 38 me.setService(new QName ("http://test", "entryPoint")); 39 me.getInMessage().setContent(new StringSource("<test xmlns=\"http://test\"><echo/><world/><earth/></test>")); 40 client.sendSync(me); 41 42 ((Receiver) getBean("trace1")).getMessageList().assertMessagesReceived(1); 43 ((Receiver) getBean("trace2")).getMessageList().assertMessagesReceived(1); 44 ((Receiver) getBean("trace3")).getMessageList().assertMessagesReceived(1); 45 ((Receiver) getBean("trace4")).getMessageList().assertMessagesReceived(2); 46 ((Receiver) getBean("trace5")).getMessageList().assertMessagesReceived(1); 47 48 Thread.sleep(50); 50 } 51 52 protected AbstractXmlApplicationContext createBeanFactory() { 53 return new ClassPathXmlApplicationContext("org/apache/servicemix/eip/spring.xml"); 54 } 55 56 } 57 | Popular Tags |