1 17 package org.apache.servicemix.components.xfire; 18 19 import javax.jbi.JBIException; 20 import javax.xml.namespace.QName ; 21 import javax.xml.transform.Source ; 22 23 import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver; 24 import org.apache.servicemix.tck.TestSupport; 25 import org.springframework.context.support.AbstractXmlApplicationContext; 26 import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; 27 28 public class XFireOutBindingTest extends TestSupport { 29 private OneWayService receiverService; 30 31 protected void setUp() throws Exception { 32 super.setUp(); 33 34 receiverService = (OneWayService) getBean("xfireReceiverService"); 35 } 36 37 public void testSendingAndReceivingMessagesUsingSpring() throws Exception { 38 sendFile(new QName ("http://xfire.components.servicemix.org", "OneWayService"), 39 "/org/apache/servicemix/components/xfire/oneway.xml"); 40 41 receiverService.getMessageList().assertMessagesReceived(1); 42 } 43 44 protected void sendFile(QName serviceName, String fileOnClassPath) throws JBIException { 45 Source content = getSourceFromClassPath(fileOnClassPath); 46 47 ServiceNameEndpointResolver resolver = new ServiceNameEndpointResolver(serviceName); 48 49 client.send(resolver, null, null, content); 50 } 51 52 protected AbstractXmlApplicationContext createBeanFactory() { 53 return new ClassPathXmlApplicationContext(new String [] { 54 "/org/apache/servicemix/components/xfire/xfire-out.xml", 55 "/org/codehaus/xfire/spring/xfire.xml" 56 }); 57 } 58 } 59 | Popular Tags |