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 de...@apache.org on 2005/05/11 07:17:09 UTC

svn commit: r169587 - in /webservices/axis/trunk/java/modules/core: src/org/apache/axis/engine/SimplePhase.java test/org/apache/axis/deployment/BuildWithAddressingTest.java

Author: deepal
Date: Tue May 10 22:17:08 2005
New Revision: 169587

URL: http://svn.apache.org/viewcvs?rev=169587&view=rev
Log:
fix addressing module bug :)

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SimplePhase.java
    webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildWithAddressingTest.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SimplePhase.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SimplePhase.java?rev=169587&r1=169586&r2=169587&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SimplePhase.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/engine/SimplePhase.java Tue May 10 22:17:08 2005
@@ -1,18 +1,18 @@
 /*
- * Copyright 2004,2005 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.
- */
+* Copyright 2004,2005 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.engine;
 
 import java.util.ArrayList;
@@ -48,7 +48,7 @@
      * Field NAME
      */
     public static final QName NAME = new QName("http://axis.ws.apache.org",
-                    "Phase");
+            "Phase");
 
     /**
      * Field phaseName
@@ -64,7 +64,7 @@
      * Field log
      */
     private Log log = LogFactory.getLog(getClass());
-    
+
     private int indexOfHandlerToExecute = 0;
 
     /**
@@ -75,7 +75,7 @@
     public SimplePhase(String phaseName) {
         handlers = new ArrayList();
         this.phaseName = phaseName;
-        
+
     }
 
     /**
@@ -86,7 +86,7 @@
      */
     public void addHandler(Handler handler, int index) {
         log.info("Handler " + handler.getName() + "Added to place " + 1
-                        + " At the Phase " + phaseName);
+                + " At the Phase " + phaseName);
         handlers.add(index, handler);
     }
 
@@ -97,7 +97,7 @@
      */
     public void addHandler(Handler handler) {
         log.info("Handler " + handler.getName() + " Added to the Phase "
-                        + phaseName);
+                + phaseName);
         handlers.add(handler);
     }
 
@@ -108,7 +108,7 @@
      * @throws AxisFault
      */
     public void invoke(MessageContext msgctx) throws AxisFault {
-       // Stack executionStack = new Stack();
+        // Stack executionStack = new Stack();
         try {
             while (indexOfHandlerToExecute < handlers.size() ) {
                 if(msgctx.isPaused()){
@@ -117,18 +117,18 @@
                     Handler handler = (Handler) handlers.get(indexOfHandlerToExecute);
                     if (handler != null) {
                         log.info("Invoke the Handler " + handler.getName()
-                                        + "with in the Phase " + phaseName);
+                                + "with in the Phase " + phaseName);
                         handler.invoke(msgctx);
                         //This line should be after the invoke as if the invocation failed this handlers is takn care of and 
                         //no need to revoke agien
-               //         executionStack.push(handler);
+                        //         executionStack.push(handler);
                         indexOfHandlerToExecute++;
                     }
                 }
             }
         } catch (Exception e) {
             log.info("Phase " + phaseName + " failed with the "
-                            + e.getMessage());
+                    + e.getMessage());
 //            while (!executionStack.isEmpty()) {
 //                Handler handler = (Handler) executionStack.pop();
 //                log.info("revoke the Handler " + handler.getName()
@@ -180,5 +180,10 @@
 //        // TODO Auto-generated method stub
 //
 //    }
+    
+
+    public int getHandlerCount(){
+        return handlers.size();
+    }
 
 }

Modified: webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildWithAddressingTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildWithAddressingTest.java?rev=169587&r1=169586&r2=169587&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildWithAddressingTest.java (original)
+++ webservices/axis/trunk/java/modules/core/test/org/apache/axis/deployment/BuildWithAddressingTest.java Tue May 10 22:17:08 2005
@@ -45,26 +45,25 @@
     }
 
     public void testDeployment() throws Exception {
-        //TODO fix this test case
-//        String filename = "./target/test-resources/deployment";
-//        EngineContextFactory builder = new EngineContextFactory();
-//        SystemContext er = builder.buildEngineContext(filename);
-//        ArrayList phases = er.getPhases(AxisSystem.INFLOW);
-//        AxisModule modeule = er.getEngineConfig().getModule(new QName("addressing"));
-//        assertNotNull(modeule);
-//        if (phases.size() <= 0) {
-//            fail("this must failed Since there are addressing handlers ");
-//        }
-//        for (int i = 0; i < phases.size(); i++) {
-//            SimplePhase metadata = (SimplePhase) phases.get(i);
-//            if ("pre-dispatch".equals(metadata.getPhaseName())) {
-//                if (metadata.getHandlerCount() <= 0) {
-//                    fail("this must failed Since there are addressing handlers ");
-//                } else {
-//                    System.out.println("Found pre-dispatch handlers");
-//                }
-//            }
-//        }
+        String filename = "./target/test-resources/deployment";
+        EngineContextFactory builder = new EngineContextFactory();
+        SystemContext er = builder.buildEngineContext(filename);
+        ArrayList phases = er.getPhases(AxisSystem.INFLOW);
+        AxisModule modeule = er.getEngineConfig().getModule(new QName("addressing"));
+        assertNotNull(modeule);
+        if (phases.size() <= 0) {
+            fail("this must failed Since there are addressing handlers ");
+        }
+        for (int i = 0; i < phases.size(); i++) {
+            SimplePhase metadata = (SimplePhase) phases.get(i);
+            if ("pre-dispatch".equals(metadata.getPhaseName())) {
+                if (metadata.getHandlerCount() <= 0) {
+                    fail("this must failed Since there are addressing handlers ");
+                } else {
+                    System.out.println("Found pre-dispatch handlers");
+                }
+            }
+        }
 
     }
 }