1 16 17 package org.apache.axis2.context; 18 19 import org.apache.axis2.AbstractTestCase; 20 import org.apache.axis2.addressing.miheaders.RelatesTo; 21 import org.apache.axis2.description.OperationDescription; 22 import org.apache.axis2.description.ServiceDescription; 23 import org.apache.axis2.description.TransportInDescription; 24 import org.apache.axis2.description.TransportOutDescription; 25 import org.apache.axis2.engine.AxisFault; 26 27 import javax.xml.namespace.QName ; 28 29 33 public class OperationContextTest extends AbstractTestCase { 34 35 private ConfigurationContext engineCtx = new ConfigurationContext(null); 36 37 public OperationContextTest(String arg0) { 38 super(arg0); 39 } 40 41 public void testMEPfindingOnRelatesTO() throws Exception { 42 43 ServiceContext sessionContext = new ServiceContext(new ServiceDescription(),new ConfigurationContext(null)); 44 MessageContext messageContext1 = this.getBasicMessageContext(); 45 46 messageContext1.setMessageID(new Long (System.currentTimeMillis()).toString()); 47 OperationDescription axisOperation = new OperationDescription(new QName ("test")); 48 OperationContext operationContext1 = axisOperation.findOperationContext(messageContext1, sessionContext); 49 50 MessageContext messageContext2 = this.getBasicMessageContext(); 51 messageContext2.setMessageID(new Long (System.currentTimeMillis()).toString()); 52 messageContext2.getMessageInformationHeaders().setRelatesTo(new RelatesTo(messageContext1.getMessageID())); 53 OperationContext operationContext2 = axisOperation.findOperationContext(messageContext2, sessionContext); 54 assertEquals(operationContext1, operationContext2); 55 } 56 57 public MessageContext getBasicMessageContext() throws AxisFault{ 58 59 return new MessageContext(engineCtx,new TransportInDescription(new QName ("axis")), new TransportOutDescription(new QName ("axis"))); 60 61 } 62 63 } 64 | Popular Tags |