You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/05/16 13:02:42 UTC

svn commit: r170357 - in /webservices/axis/trunk/java/modules/core/test/org/apache/axis/context: MEPContextTest.java OperationContextTest.java

Author: chathura
Date: Mon May 16 04:02:41 2005
New Revision: 170357

URL: http://svn.apache.org/viewcvs?rev=170357&view=rev
Log:
Refactored the Test class

Added:
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
Removed:
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/MEPContextTest.java

Added: webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java?rev=170357&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java (added)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/context/OperationContextTest.java Mon May 16 04:02:41 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.context;
+
+import org.apache.axis.AbstractTestCase;
+import org.apache.axis.addressing.miheaders.RelatesTo;
+import org.apache.axis.description.OperationDescription;
+import org.apache.axis.description.ServiceDescription;
+import org.apache.axis.description.TransportInDescription;
+import org.apache.axis.description.TransportOutDescription;
+import org.apache.axis.engine.AxisFault;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @author chathura@opensource.lk
+ *
+ */
+public class OperationContextTest extends AbstractTestCase {
+
+	private ConfigurationContext engineCtx = new ConfigurationContext(null);
+
+    public OperationContextTest(String arg0) {
+        super(arg0);
+    }
+    
+    public void testMEPfindingOnRelatesTO() throws Exception{
+    	 
+    	ServiceContext sessionContext = new ServiceContext(new ServiceDescription(),new ConfigurationContext(null));
+		MessageContext messageContext1 = this.getBasicMessageContext();
+    	
+    	messageContext1.setMessageID(new Long(System.currentTimeMillis()).toString());
+    	OperationDescription axisOperation = new OperationDescription(new QName("test"));
+    	OperationContext operationContext1 = axisOperation.findOperationContext(messageContext1, sessionContext, true);
+    	
+    	MessageContext messageContext2 = this.getBasicMessageContext();
+    	messageContext2.setMessageID(new Long(System.currentTimeMillis()).toString());
+    	messageContext2.getMessageInformationHeaders().setRelatesTo(new RelatesTo(messageContext1.getMessageID()));
+    	OperationContext operationContext2 = axisOperation.findOperationContext(messageContext2, sessionContext,  true);
+    	assertEquals(operationContext1, operationContext2);
+    }
+    
+    public MessageContext getBasicMessageContext() throws AxisFault{
+
+    	return new MessageContext(null,new TransportInDescription(new QName("axis")), new TransportOutDescription(new QName("axis")),engineCtx);
+
+    }
+    
+}