axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r280880 - in /webservices/axis2/trunk/java/modules: core/src/org/apache/axis2/ core/src/org/apache/axis2/clientapi/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/engine/ integration/test/org/apache/axis2/engine/ integration/t...
Date Wed, 14 Sep 2005 16:22:35 GMT
Author: chinthaka
Date: Wed Sep 14 09:21:59 2005
New Revision: 280880

URL: http://svn.apache.org/viewcvs?rev=280880&view=rev
Log:
Fixing more test cases (some more to come ...)

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/InstanceDispatcher.java
Wed Sep 14 09:21:59 2005
@@ -39,6 +39,10 @@
      */
     public void invoke(MessageContext msgContext) throws AxisFault {
 
+        if(msgContext.getOperationContext() != null && msgContext.getServiceContext()
!= null){
+            return;
+        }
+
         OperationDescription operationDesc = msgContext.getOperationDescription();
 
         //  1. look up opCtxt using mc.addressingHeaders.relatesTo[0]

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
Wed Sep 14 09:21:59 2005
@@ -242,6 +242,7 @@
                         + "/"
                         + axisop.getName().getLocalPart(),
                         listenerTransport.getName().getLocalPart()));
+                msgctx.setTo(this.to);
                 //create and set the Operation context
                 msgctx.setOperationContext(axisop.findOperationContext(msgctx, serviceContext));
                 msgctx.setServiceContext(serviceContext);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
Wed Sep 14 09:21:59 2005
@@ -27,11 +27,7 @@
 
 import javax.xml.namespace.QName;
 import java.io.File;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -46,28 +42,44 @@
 
     private Map sessionContextMap;
     private Map moduleContextMap;
-    
+
     private transient ThreadPool threadPool;
-    
+
     private File rootDir;
 
     /**
      * Map containing <code>MessageID</code> to
      * <code>OperationContext</code> mapping.
      */
-    private final Map operationContextMap = new HashMap();
+    private static final Map operationContextMap = new HashMap();
 
     private final Map serviceContextMap = new HashMap ();
 
     private final Map serviceGroupContextMap = new HashMap();
 
+    public ConfigurationContext(AxisConfiguration axisConfiguration) {
+        super(null);
+        this.axisConfiguration = axisConfiguration;
+    }
+
     /**
      * The method is used to do the intialization of the EngineContext
+     *
      * @throws AxisFault
      */
+
+    public void init() throws AxisFault {
+
+    }
+
+    public synchronized void removeService(QName name) {
+        serviceContextMap.remove(name);
+    }
+
+    /**
     public void init(AxisConfiguration axisConfiguration) throws AxisFault {
     	this.axisConfiguration = axisConfiguration;
-    	
+
     	Iterator operationContextIt = operationContextMap.keySet().iterator();
     	while (operationContextIt.hasNext()) {
     		Object key = operationContextIt.next();
@@ -75,7 +87,7 @@
     		if (operationContext!=null)
     			operationContext.init(axisConfiguration);
     	}
-    	
+
     	Iterator serviceContextIt = serviceContextMap.keySet().iterator();
     	while (serviceContextIt.hasNext()) {
     		Object key = serviceContextIt.next();
@@ -83,7 +95,7 @@
     		if (serviceContext!=null)
     			serviceContext.init(axisConfiguration);
     	}
-    	
+
     	Iterator serviceGroupContextIt = serviceGroupContextMap.keySet().iterator();
     	while (serviceGroupContextIt.hasNext()) {
     		Object key = serviceGroupContextIt.next();
@@ -92,7 +104,7 @@
     			serviceGroupContext.init(axisConfiguration);
     	}
     }
-    
+
     private void writeObject(ObjectOutputStream out) throws IOException {
     	out.defaultWriteObject();
     }
@@ -101,13 +113,14 @@
     	in.defaultReadObject();
     	threadPool = new ThreadPool ();
     }
-    
+
     public ConfigurationContext(AxisConfiguration registry) {
         super(null);
         this.axisConfiguration = registry;
         //serviceContextMap = new HashMap();
         moduleContextMap = new HashMap();
         sessionContextMap = new HashMap();
+
     }
 
     public synchronized void removeService(QName name) {
@@ -115,7 +128,6 @@
     }
 
     /**
-     * @return
      */
     public AxisConfiguration getAxisConfiguration() {
         return axisConfiguration;
@@ -167,7 +179,6 @@
      * get the ServiceContext given a id
      *
      * @param serviceInstanceID
-     * @return
      */
     public ServiceContext getServiceContext(String serviceInstanceID) {
         return (ServiceContext) this.serviceContextMap.get(serviceInstanceID);
@@ -198,7 +209,6 @@
      * root diretory
      *
      * @param path
-     * @return
      */
     public File getRealPath(String path) {
         if (rootDir == null) {
@@ -226,7 +236,6 @@
      * create a new service context for the service
      *
      * @param messageContext
-     * @return
      */
     public ServiceGroupContext fillServiceContextAndServiceGroupContext(MessageContext messageContext)
throws AxisFault {
         String serviceGroupContextId = messageContext.getServiceGroupContextId();
@@ -285,5 +294,9 @@
 
     private boolean isNull(String string) {
         return "".equals(string) || string == null;
+    }
+
+    public void init(AxisConfiguration axisConfiguration) throws AxisFault {
+        this.axisConfiguration = axisConfiguration;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AbstractDispatcher.java
Wed Sep 14 09:21:59 2005
@@ -18,6 +18,8 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.HandlerDescription;
 import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.description.ServiceDescription;
@@ -28,7 +30,7 @@
 /**
  * This the base class for all dispatchers, it is a Handler which has a one
  * traget, that is to find the Service a given SOAP message is targeted to.
- *
+ * <p/>
  * Axis2 service dispatching is model via a Chain of diapatchers, each trying to
  * Diaptach but let go without throwing a execption in case they fail.
  */
@@ -60,8 +62,24 @@
      */
     public final void invoke(MessageContext msgctx) throws AxisFault {
 
+        // first check we can dispatch using the relates to
+        if (msgctx.getRelatesTo() != null) {
+            String relatesTo = msgctx.getRelatesTo().getValue();
+            if (relatesTo != null || "".equals(relatesTo)) {
+                OperationContext operationContext = msgctx.getSystemContext().getOperationContext(relatesTo);
+                if (operationContext != null) {
+                    msgctx.setOperationDescription(operationContext.getAxisOperation());
+                    msgctx.setOperationContext(operationContext);
+                    msgctx.setServiceContext((ServiceContext) operationContext.getParent());
+                    msgctx.setServiceDescription(((ServiceContext) operationContext.getParent()).getServiceConfig());
+                }
+            }
+            return;
+        }
+
+
         ServiceDescription serviceDescription = msgctx.getServiceDescription();
-        if(serviceDescription == null){
+        if (serviceDescription == null) {
             serviceDescription = findService(msgctx);
             if (serviceDescription != null) {
                 msgctx.setServiceDescription(serviceDescription);
@@ -69,9 +87,9 @@
             }
         }
 
-        if(msgctx.getServiceDescription() != null && msgctx.getOperationDescription()
== null){
+        if (msgctx.getServiceDescription() != null && msgctx.getOperationDescription()
== null) {
             OperationDescription operationDescription = findOperation(serviceDescription,
msgctx);
-            if(operationDescription != null){
+            if (operationDescription != null) {
                 msgctx.setOperationDescription(operationDescription);
             }
         }
@@ -99,6 +117,7 @@
 
     /**
      * Give the diaptacher turn to find the Service
+     *
      * @param messageContext
      * @return
      * @throws AxisFault
@@ -108,6 +127,7 @@
 
     /**
      * Give the diaptacher turn to find the Operation
+     *
      * @param service
      * @param messageContext
      * @return

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AddressingBasedDispatcher.java
Wed Sep 14 09:21:59 2005
@@ -16,6 +16,7 @@
 package org.apache.axis2.engine;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.HandlerDescription;
@@ -28,7 +29,7 @@
 /**
  * Dispatcher based on the WS-Addressing properties
  */
-public class AddressingBasedDispatcher extends AbstractDispatcher {
+public class AddressingBasedDispatcher extends AbstractDispatcher implements AddressingConstants
{
     /**
      * Field NAME
      */
@@ -62,17 +63,23 @@
     public ServiceDescription findService(MessageContext messageContext) throws AxisFault
{
         EndpointReference toEPR = messageContext.getTo();
         ServiceDescription service = null;
-        QName serviceName = new QName(toEPR.getAddress());
-
-        String filePart = toEPR.getAddress();
-        String[] values = Utils.parseRequestURLForServiceAndOperation(
-                filePart);
-        if (values[0] != null) {
-            serviceName = new QName(values[0]);
-            AxisConfiguration registry =
-                    messageContext.getSystemContext().getAxisConfiguration();
-            return registry.getService(serviceName.getLocalPart());
+        if (toEPR != null) {
+            String address = toEPR.getAddress();
+            if (Final.WSA_ANONYMOUS_URL.equals(address) || Submission.WSA_ANONYMOUS_URL.equals(address))
{
+                return null;
+            }
+            QName serviceName = new QName(address);
+
+            String filePart = toEPR.getAddress();
+            String[] values = Utils.parseRequestURLForServiceAndOperation(
+                    filePart);
+            if (values[0] != null) {
+                serviceName = new QName(values[0]);
+                AxisConfiguration registry =
+                        messageContext.getSystemContext().getAxisConfiguration();
+                return registry.getService(serviceName.getLocalPart());
 
+            }
         }
         return service;
     }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DispatchingChecker.java
Wed Sep 14 09:21:59 2005
@@ -52,6 +52,14 @@
      * @throws AxisFault
      */
     public final void invoke(MessageContext msgctx) throws AxisFault {
+        if(msgctx.getOperationDescription() == null && msgctx.getOperationContext()
!= null ){
+            msgctx.setOperationDescription(msgctx.getOperationContext().getAxisOperation());
+        }
+
+        if(msgctx.getServiceDescription() == null && msgctx.getServiceContext() !=
null){
+            msgctx.setServiceDescription(msgctx.getServiceContext().getServiceConfig());
+        }
+        
         EndpointReference toEPR = msgctx.getTo();
         if (msgctx.getServiceDescription() == null) {
             throw new AxisFault(

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CommonsHTTPEchoRawXMLTest.java
Wed Sep 14 09:21:59 2005
@@ -24,6 +24,7 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.clientapi.AsyncResult;
 import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.axis2.description.ServiceDescription;
@@ -66,12 +67,14 @@
     }
 
     protected void setUp() throws Exception {
-        UtilServer.start();
+        ConfigurationContext configurationContext = UtilServer.start();
         service =
                 Utils.createSimpleService(serviceName,
                         Echo.class.getName(),
                         operationName);
         UtilServer.deployService(service);
+        service.getParent().getServiceGroupContext(configurationContext).fillServiceContexts();
+        ServiceContext serviceContext = service.getParent().getServiceGroupContext(configurationContext).getServiceContext(serviceName.getLocalPart());
 
     }
 
@@ -86,7 +89,9 @@
         org.apache.axis2.clientapi.Call call = new org.apache.axis2.clientapi.Call(
                 Constants.TESTING_PATH + "commons-http-enabledRepository");
 
+
         call.setTo(targetEPR);
+//        call.setWsaAction(operationName.getLocalPart());
         call.setTransportInfo(Constants.TRANSPORT_HTTP,
                 Constants.TRANSPORT_HTTP,
                 false);

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/EchoRawXMLTest.java
Wed Sep 14 09:21:59 2005
@@ -25,9 +25,9 @@
 import org.apache.axis2.clientapi.AsyncResult;
 import org.apache.axis2.clientapi.Call;
 import org.apache.axis2.clientapi.Callback;
+import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.description.ServiceDescription;
 import org.apache.axis2.integration.TestingUtils;
 import org.apache.axis2.integration.UtilServer;
@@ -126,7 +126,7 @@
         call.close();
 
 
-        log.info("send the reqest");
+        log.info("send the request");
     }
 
     public void testEchoXMLSync() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java?rev=280880&r1=280879&r2=280880&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/integration/UtilServer.java
Wed Sep 14 09:21:59 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
 import org.apache.axis2.deployment.DeploymentEngine;
 import org.apache.axis2.description.ModuleDescription;
 import org.apache.axis2.description.ServiceDescription;
@@ -41,6 +42,8 @@
         receiver.getSystemContext().getAxisConfiguration().addService(service);
         Utils.resolvePhases(receiver.getSystemContext().getAxisConfiguration(),
                 service);
+        ServiceGroupContext serviceGroupContext = service.getParent().getServiceGroupContext(receiver.getSystemContext());
+        serviceGroupContext.fillServiceContexts();
     }
 
     public static synchronized void unDeployService(QName service) throws AxisFault {



Mime
View raw message