1 17 package org.apache.servicemix.eip; 18 19 import javax.jbi.messaging.ExchangeStatus; 20 import javax.jbi.messaging.InOnly; 21 import javax.xml.namespace.QName ; 22 23 import org.apache.servicemix.eip.patterns.Pipeline; 24 import org.apache.servicemix.tck.ReceiverComponent; 25 26 public class PipelineTxTest extends AbstractEIPTransactionalTest { 27 28 protected Pipeline pipeline; 29 30 protected void setUp() throws Exception { 31 super.setUp(); 32 33 pipeline = new Pipeline(); 34 pipeline.setTransformer(createServiceExchangeTarget(new QName ("transformer"))); 35 pipeline.setTarget(createServiceExchangeTarget(new QName ("target"))); 36 configurePattern(pipeline); 37 activateComponent(pipeline, "pipeline"); 38 } 39 40 public void testInOnlySync() throws Exception { 41 activateComponent(new ReturnOutComponent(), "transformer"); 42 ReceiverComponent target = activateReceiver("target"); 43 44 tm.begin(); 45 46 InOnly me = client.createInOnlyExchange(); 47 me.setService(new QName ("pipeline")); 48 me.getInMessage().setContent(createSource("<hello/>")); 49 client.sendSync(me); 50 assertEquals(ExchangeStatus.DONE, me.getStatus()); 51 52 tm.commit(); 53 54 target.getMessageList().assertMessagesReceived(1); 55 56 listener.assertExchangeCompleted(); 57 } 58 59 public void testInOnlyAsync() throws Exception { 60 activateComponent(new ReturnOutComponent(), "transformer"); 61 ReceiverComponent target = activateReceiver("target"); 62 63 tm.begin(); 64 65 InOnly me = client.createInOnlyExchange(); 66 me.setService(new QName ("pipeline")); 67 me.getInMessage().setContent(createSource("<hello/>")); 68 client.send(me); 69 70 tm.commit(); 71 72 me = (InOnly) client.receive(); 73 assertEquals(ExchangeStatus.DONE, me.getStatus()); 74 75 target.getMessageList().assertMessagesReceived(1); 76 77 listener.assertExchangeCompleted(); 78 } 79 80 } 81 | Popular Tags |