1 17 package org.apache.servicemix.jbi.messaging; 18 19 import java.io.IOException ; 20 import java.io.ObjectInput ; 21 22 import javax.jbi.messaging.ExchangeStatus; 23 import javax.jbi.messaging.MessageExchange; 24 25 import org.apache.servicemix.jbi.messaging.ExchangePacket; 26 import org.apache.servicemix.jbi.messaging.MessageExchangeImpl; 27 28 import junit.framework.TestCase; 29 30 public class MessageExchangeTest extends TestCase { 31 32 public static class TestMessageExchange extends MessageExchangeImpl { 33 private static final long serialVersionUID = 5572313276570983400L; 34 public TestMessageExchange() { 35 super(new ExchangePacket(), STATES); 36 } 37 public void readExternal(ObjectInput in) throws IOException , ClassNotFoundException { 38 } 39 private static int[][] STATES = { 40 { CAN_CONSUMER + CAN_OWNER + CAN_SET_IN_MSG + CAN_SEND + CAN_STATUS_ACTIVE, -1, -1, -1 }, 41 }; 42 } 43 44 public void testErrorStatus() throws Exception { 45 MessageExchange me = new TestMessageExchange(); 46 assertEquals(ExchangeStatus.ACTIVE, me.getStatus()); 47 assertNull(me.getError()); 48 me.setError(new Exception ()); 49 assertEquals(ExchangeStatus.ERROR, me.getStatus()); 50 assertNotNull(me.getError()); 51 } 52 53 } 54 | Popular Tags |