All pastes #263565 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-01 17:19 UTC
rendered paste body
import javax.jbi.messaging.InOut;
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;

import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.jbi.container.JBIContainer;
import org.apache.servicemix.jsr181.Jsr181Component;

import junit.framework.TestCase;


public class Test extends TestCase
{

	public void test() throws Exception {
		JBIContainer jbi = new JBIContainer();
		jbi.setEmbedded(true);
		jbi.init();
		jbi.start();
		Jsr181Component comp = new Jsr181Component();
		jbi.activateComponent(comp, "jsr181");
		comp.getServiceUnitManager().deploy("su", "target/classes");
		comp.getServiceUnitManager().init("su", "target/classes");
		comp.getServiceUnitManager().start("su");
		
		DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
		InOut me = client.createInOutExchange();
		me.getInMessage().setContent(new StreamSource(getClass().getResourceAsStream("legality-request.xml")));
		me.setService(new QName("http://emergo.sabre.com/integration/legality", "LegalityValidationService"));
		client.sendSync(me);
	}
	
}