Package org.servicemix.components.xfire

Source Code of org.servicemix.components.xfire.XFireOutBindingTest

package org.servicemix.components.xfire;

import javax.jbi.JBIException;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;

import org.servicemix.TestSupport;
import org.servicemix.jbi.resolver.ServiceNameEndpointResolver;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.xbean.spring.context.ClassPathXmlApplicationContext;

public class XFireOutBindingTest extends TestSupport {
    private OneWayService receiverService;

    protected void setUp() throws Exception {
        super.setUp();
       
        receiverService = (OneWayService) getBean("xfireReceiverService");
    }
   
    public void testSendingAndReceivingMessagesUsingSpring() throws Exception {
        sendFile(new QName("http://xfire.components.servicemix.org", "OneWayService"),
                "/org/servicemix/components/xfire/oneway.xml");

        receiverService.getMessageList().assertMessagesReceived(1);
    }

    protected void sendFile(QName serviceName, String fileOnClassPath) throws JBIException {
        Source content = getSourceFromClassPath(fileOnClassPath);

        ServiceNameEndpointResolver resolver = new ServiceNameEndpointResolver(serviceName);

        client.send(resolver, null, null, content);
    }

    protected AbstractXmlApplicationContext createBeanFactory() {
        return new ClassPathXmlApplicationContext(new String[] {
                "/org/servicemix/components/xfire/xfire-out.xml",
                "/org/codehaus/xfire/spring/xfire.xml"
        });
    }
}
TOP

Related Classes of org.servicemix.components.xfire.XFireOutBindingTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.