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 di...@apache.org on 2007/02/25 20:57:05 UTC

svn commit: r511585 [9/10] - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/wsdl/ src/org/apache/axis2/builder/ src/org/apache/axis2/cluster/ src/org/apache/axis2/context/ src/org/apach...

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java Sun Feb 25 11:56:59 2007
@@ -1,48 +1,48 @@
-/*
-* 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.axis2.dispatchers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.ContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import junit.framework.TestCase;
-
-public class RequestURIBasedServiceDispatcherTest extends TestCase {
-
-    public void testFindService() throws AxisFault{
-        MessageContext messageContext ;
-        AxisService as1 = new AxisService("Service1");
-        AxisService as2 = new AxisService("Service2");
-
-        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
-        AxisConfiguration ac = cc.getAxisConfiguration();
-        ac.addService(as1);
-        ac.addService(as2);
-        messageContext = ContextFactory.createMessageContext(cc);
-
-        messageContext.setTo(new EndpointReference("http://127.0.0.1:8080/axis2/services/Service2"));
-        
-        RequestURIBasedServiceDispatcher ruisd = new RequestURIBasedServiceDispatcher();
-        ruisd.invoke(messageContext);
-        
-        assertEquals(as2, messageContext.getAxisService());
-    }
-
-}
+/*
+* 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.axis2.dispatchers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import junit.framework.TestCase;
+
+public class RequestURIBasedServiceDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        MessageContext messageContext ;
+        AxisService as1 = new AxisService("Service1");
+        AxisService as2 = new AxisService("Service2");
+
+        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
+        AxisConfiguration ac = cc.getAxisConfiguration();
+        ac.addService(as1);
+        ac.addService(as2);
+        messageContext = ContextFactory.createMessageContext(cc);
+
+        messageContext.setTo(new EndpointReference("http://127.0.0.1:8080/axis2/services/Service2"));
+        
+        RequestURIBasedServiceDispatcher ruisd = new RequestURIBasedServiceDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(as2, messageContext.getAxisService());
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/RequestURIBasedServiceDispatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java Sun Feb 25 11:56:59 2007
@@ -1,63 +1,63 @@
-/*
-* 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.axis2.dispatchers;
-
-import junit.framework.TestCase;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ContextFactory;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOnlyAxisOperation;
-import org.apache.axis2.engine.AxisConfiguration;
-
-import javax.xml.namespace.QName;
-
-public class SOAPMessageBodyBasedOperationDispatcherTest extends TestCase {
-
-    public void testFindOperation() throws AxisFault {
-        MessageContext messageContext;
-        AxisService as1 = new AxisService("Service1");
-
-
-        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
-        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
-        as1.addOperation(operation1);
-        as1.addOperation(operation2);
-
-        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
-        AxisConfiguration ac = cc.getAxisConfiguration();
-        ac.addService(as1);
-        messageContext = ContextFactory.createMessageContext(cc);
-
-        messageContext.setAxisService(as1);
-
-        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
-        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
-        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://test", "pfx"));
-        messageContext.setEnvelope(se);
-
-
-        SOAPMessageBodyBasedOperationDispatcher ruisd = new SOAPMessageBodyBasedOperationDispatcher();
-        ruisd.invoke(messageContext);
-
-        assertEquals(operation2, messageContext.getAxisOperation());
-    }
-
-}
+/*
+* 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.axis2.dispatchers;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.AxisConfiguration;
+
+import javax.xml.namespace.QName;
+
+public class SOAPMessageBodyBasedOperationDispatcherTest extends TestCase {
+
+    public void testFindOperation() throws AxisFault {
+        MessageContext messageContext;
+        AxisService as1 = new AxisService("Service1");
+
+
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        as1.addOperation(operation1);
+        as1.addOperation(operation2);
+
+        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
+        AxisConfiguration ac = cc.getAxisConfiguration();
+        ac.addService(as1);
+        messageContext = ContextFactory.createMessageContext(cc);
+
+        messageContext.setAxisService(as1);
+
+        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
+        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
+        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://test", "pfx"));
+        messageContext.setEnvelope(se);
+
+
+        SOAPMessageBodyBasedOperationDispatcher ruisd = new SOAPMessageBodyBasedOperationDispatcher();
+        ruisd.invoke(messageContext);
+
+        assertEquals(operation2, messageContext.getAxisOperation());
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedOperationDispatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java Sun Feb 25 11:56:59 2007
@@ -1,53 +1,53 @@
-/*
-* 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.axis2.dispatchers;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.context.ContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.AxisConfiguration;
-
-public class SOAPMessageBodyBasedServiceDispatcherTest extends TestCase {
-
-    public void testFindService() throws AxisFault{
-        MessageContext messageContext ;
-        AxisService as1 = new AxisService("Service1");
-        AxisService as2 = new AxisService("Service2");
-        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
-         AxisConfiguration ac = cc.getAxisConfiguration();
-        ac.addService(as1);
-        ac.addService(as2);
-        messageContext = ContextFactory.createMessageContext(cc);
-
-        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
-        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
-        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://127.0.0.1:8080/axis2/services/Service2", "pfx"));
-        messageContext.setEnvelope(se);
-        
-        
-        SOAPMessageBodyBasedServiceDispatcher ruisd = new SOAPMessageBodyBasedServiceDispatcher();
-        ruisd.invoke(messageContext);
-        
-        assertEquals(as2, messageContext.getAxisService());
-    }
-
-}
+/*
+* 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.axis2.dispatchers;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+
+public class SOAPMessageBodyBasedServiceDispatcherTest extends TestCase {
+
+    public void testFindService() throws AxisFault{
+        MessageContext messageContext ;
+        AxisService as1 = new AxisService("Service1");
+        AxisService as2 = new AxisService("Service2");
+        ConfigurationContext cc = ConfigurationContextFactory.createEmptyConfigurationContext();
+         AxisConfiguration ac = cc.getAxisConfiguration();
+        ac.addService(as1);
+        ac.addService(as2);
+        messageContext = ContextFactory.createMessageContext(cc);
+
+        SOAPEnvelope se = OMAbstractFactory.getSOAP11Factory().createSOAPEnvelope();
+        SOAPBody sb = OMAbstractFactory.getSOAP11Factory().createSOAPBody(se);
+        sb.addChild(OMAbstractFactory.getSOAP11Factory().createOMElement("operation2", "http://127.0.0.1:8080/axis2/services/Service2", "pfx"));
+        messageContext.setEnvelope(se);
+        
+        
+        SOAPMessageBodyBasedServiceDispatcher ruisd = new SOAPMessageBodyBasedServiceDispatcher();
+        ruisd.invoke(messageContext);
+        
+        assertEquals(as2, messageContext.getAxisService());
+    }
+
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/dispatchers/SOAPMessageBodyBasedServiceDispatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextChangeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveATest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveBTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java Sun Feb 25 11:56:59 2007
@@ -18,8 +18,8 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.deployment.DeploymentException;
 import org.apache.axis2.deployment.ServiceBuilder;
 import org.apache.axis2.description.AxisOperation;
@@ -36,8 +36,8 @@
 public class ModuleConfigTest extends TestCase {
 
     AxisConfiguration ar;
-    String axis2xml = System.getProperty("basedir")+"/target/test-resources/deployment/moduleConfig/axis2.xml";
-    String repo = System.getProperty("basedir")+"/target/test-resources/deployment/moduleConfig";
+    String axis2xml = System.getProperty("basedir") + "/target/test-resources/deployment/moduleConfig/axis2.xml";
+    String repo = System.getProperty("basedir") + "/target/test-resources/deployment/moduleConfig";
 
 
     public void testModuleConfigAtAxisConfig() {

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OperationContextSaveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/OptionsSaveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java Sun Feb 25 11:56:59 2007
@@ -1,151 +1,151 @@
-/*
-* 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.axis2.engine;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOnlyAxisOperation;
-
-import junit.framework.TestCase;
-
-public class SOAPActionBasedDispatcherTest extends TestCase {
-
-    public void testFindOperation() throws Exception{
-        MessageContext messageContext = new MessageContext();
-        AxisService as = new AxisService("Service1");
-        messageContext.setAxisService(as);
-        
-        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
-        operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-        
-        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
-        operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        
-        as.addOperation(operation1);
-        as.addOperation(operation2);
-        
-        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-        
-        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
-        soapActionDispatcher.invoke(messageContext);
-        assertEquals(operation1, messageContext.getAxisOperation());
-    }
-    
-    public void testEmptyAction() throws Exception {
-        // We shouldn't be able to route on an emtpy-string action.
-        MessageContext messageContext = new MessageContext();
-        AxisService as = new AxisService("Service1");
-        messageContext.setAxisService(as);
-        
-        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
-        operation1.setSoapAction("");
-        
-        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
-        operation2.setSoapAction("");
-        
-        as.addOperation(operation1);
-        as.addOperation(operation2);
-        
-        messageContext.setSoapAction("");
-        
-        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
-        soapActionDispatcher.invoke(messageContext);
-        assertNull(messageContext.getAxisOperation());
-    }
-    
-    public void testNullAction() throws Exception {
-        // We shouldn't be able to route on a null action.
-        MessageContext messageContext = new MessageContext();
-        AxisService as = new AxisService("Service1");
-        messageContext.setAxisService(as);
-        
-        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
-        operation1.setSoapAction(null);
-        
-        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
-        operation2.setSoapAction(null);
-        
-        as.addOperation(operation1);
-        as.addOperation(operation2);
-        
-        messageContext.setSoapAction(null);
-        
-        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
-        soapActionDispatcher.invoke(messageContext);
-        assertNull(messageContext.getAxisOperation());
-    }
-
-    public void testDuplicateAction() throws Exception {
-        // We shouldn't be able to route on a SOAPAction that is a duplicate.
-        MessageContext messageContext = new MessageContext();
-        AxisService as = new AxisService("Service1");
-        messageContext.setAxisService(as);
-        
-        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
-        operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-        
-        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
-        operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        
-        as.addOperation(operation1);
-        as.addOperation(operation2);
-        
-        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        
-        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
-        soapActionDispatcher.invoke(messageContext);
-        assertEquals(operation2, messageContext.getAxisOperation());
-        
-        // Now add a duplicate action, then validate we can't route on it anymore.
-        AxisOperation operation3 = new InOnlyAxisOperation(new QName("operation3"));
-        // Note that the SOAPAction is intentionally duplicated with operation 2 above.
-        operation3.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        as.addOperation(operation3);
-
-        messageContext = new MessageContext();
-        messageContext.setAxisService(as);
-        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        soapActionDispatcher.invoke(messageContext);
-        assertNull(messageContext.getAxisOperation());
-        
-        // Now verify that adding another operation with the duplicate SOAPAction 
-        // doesn't somehow get it added back into the valid alias map
-        AxisOperation operation4 = new InOnlyAxisOperation(new QName("operation4"));
-        // Note that the SOAPAction is intentionally duplicated with operation 2 above.
-        operation3.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        as.addOperation(operation3);
-        
-        messageContext = new MessageContext();
-        messageContext.setAxisService(as);
-        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
-        soapActionDispatcher.invoke(messageContext);
-        assertNull(messageContext.getAxisOperation());
-        
-        // And finally, verify that after all the above, we can still route on a valid
-        // SOAPAction for operation 1 (whose SOAPAction was never duplicated, so should still be
-        // valid)
-        messageContext = new MessageContext();
-        messageContext.setAxisService(as);
-        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
-        soapActionDispatcher.invoke(messageContext);
-        assertEquals(operation1, messageContext.getAxisOperation());
-        
-
-    }
-
-
-}
+/*
+* 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.axis2.engine;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOnlyAxisOperation;
+
+import junit.framework.TestCase;
+
+public class SOAPActionBasedDispatcherTest extends TestCase {
+
+    public void testFindOperation() throws Exception{
+        MessageContext messageContext = new MessageContext();
+        AxisService as = new AxisService("Service1");
+        messageContext.setAxisService(as);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
+        
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        
+        as.addOperation(operation1);
+        as.addOperation(operation2);
+        
+        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
+        
+        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
+        soapActionDispatcher.invoke(messageContext);
+        assertEquals(operation1, messageContext.getAxisOperation());
+    }
+    
+    public void testEmptyAction() throws Exception {
+        // We shouldn't be able to route on an emtpy-string action.
+        MessageContext messageContext = new MessageContext();
+        AxisService as = new AxisService("Service1");
+        messageContext.setAxisService(as);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        operation1.setSoapAction("");
+        
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        operation2.setSoapAction("");
+        
+        as.addOperation(operation1);
+        as.addOperation(operation2);
+        
+        messageContext.setSoapAction("");
+        
+        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
+        soapActionDispatcher.invoke(messageContext);
+        assertNull(messageContext.getAxisOperation());
+    }
+    
+    public void testNullAction() throws Exception {
+        // We shouldn't be able to route on a null action.
+        MessageContext messageContext = new MessageContext();
+        AxisService as = new AxisService("Service1");
+        messageContext.setAxisService(as);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        operation1.setSoapAction(null);
+        
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        operation2.setSoapAction(null);
+        
+        as.addOperation(operation1);
+        as.addOperation(operation2);
+        
+        messageContext.setSoapAction(null);
+        
+        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
+        soapActionDispatcher.invoke(messageContext);
+        assertNull(messageContext.getAxisOperation());
+    }
+
+    public void testDuplicateAction() throws Exception {
+        // We shouldn't be able to route on a SOAPAction that is a duplicate.
+        MessageContext messageContext = new MessageContext();
+        AxisService as = new AxisService("Service1");
+        messageContext.setAxisService(as);
+        
+        AxisOperation operation1 = new InOnlyAxisOperation(new QName("operation1"));
+        operation1.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
+        
+        AxisOperation operation2 = new InOnlyAxisOperation(new QName("operation2"));
+        operation2.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        
+        as.addOperation(operation1);
+        as.addOperation(operation2);
+        
+        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        
+        SOAPActionBasedDispatcher soapActionDispatcher = new SOAPActionBasedDispatcher();
+        soapActionDispatcher.invoke(messageContext);
+        assertEquals(operation2, messageContext.getAxisOperation());
+        
+        // Now add a duplicate action, then validate we can't route on it anymore.
+        AxisOperation operation3 = new InOnlyAxisOperation(new QName("operation3"));
+        // Note that the SOAPAction is intentionally duplicated with operation 2 above.
+        operation3.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        as.addOperation(operation3);
+
+        messageContext = new MessageContext();
+        messageContext.setAxisService(as);
+        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        soapActionDispatcher.invoke(messageContext);
+        assertNull(messageContext.getAxisOperation());
+        
+        // Now verify that adding another operation with the duplicate SOAPAction 
+        // doesn't somehow get it added back into the valid alias map
+        AxisOperation operation4 = new InOnlyAxisOperation(new QName("operation4"));
+        // Note that the SOAPAction is intentionally duplicated with operation 2 above.
+        operation3.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        as.addOperation(operation3);
+        
+        messageContext = new MessageContext();
+        messageContext.setAxisService(as);
+        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation2");
+        soapActionDispatcher.invoke(messageContext);
+        assertNull(messageContext.getAxisOperation());
+        
+        // And finally, verify that after all the above, we can still route on a valid
+        // SOAPAction for operation 1 (whose SOAPAction was never duplicated, so should still be
+        // valid)
+        messageContext = new MessageContext();
+        messageContext.setAxisService(as);
+        messageContext.setSoapAction("urn:org.apache.axis2.dispatchers.test:operation1");
+        soapActionDispatcher.invoke(messageContext);
+        assertEquals(operation1, messageContext.getAxisOperation());
+        
+
+    }
+
+
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/SOAPActionBasedDispatcherTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java Sun Feb 25 11:56:59 2007
@@ -1,97 +1,97 @@
-/*
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.axis2.java.security.action;
-
-import org.apache.axis2.java.security.interf.Actor;
-import org.apache.axis2.java.security.driver.Java2SecTest;
-
-import java.io.CharArrayWriter;
-import java.io.FileReader;
-import java.io.IOException;
-
-
-
-/** 
- * Action reads the data from an input file  
- * and then saves the file input to Java2SecTest class
- */
-
-public class Action implements Actor {
-
-    private String fileName;
-    private FileReader fileReader;
-
-    // Constructor
-    public Action(String fileName) {
-        this.fileName = fileName;
-    }
-
-    // Implementing Actor's takeAction method
-    public void takeAction () {
-	try {
-	    // Print out maven's base,build, and test direcotories
-	    String baseDir = System.getProperty("basedir");
-	    System.out.println("basedir => " + baseDir);
-
-	    String buildDir = System.getProperty("maven_build_dir");
-	    System.out.println("buildDir => " + buildDir);
-	    
-	    String testDir = System.getProperty("maven_test_dest");
-	    System.out.println("testDir => " + testDir);
-	    
-	    // Convert the \ (back slash) to / (forward slash)
-	    String baseDirM = baseDir.replace('\\', '/');
-	    System.out.println("baseDirM => "+ baseDirM);
-	    
-	    String fs = "/";
-
-	    // Build the file URL
-	    String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
-	    System.out.println("File URL => " + fileURL);
-        	
-	    if (fileName != null)
-		    fileReader = new FileReader(fileURL);
-	    else 
-		    fileReader = new FileReader("public.txt");
-        	
-            try {
-                CharArrayWriter caw = new CharArrayWriter();
-                int c;
-		while ((c = fileReader.read()) != -1) {
-                    caw.write(c);
-                }
-		// Set/save the file input as test result onto Java2SecTest
-                Java2SecTest.testResult = caw.toString();
-            }
-            catch (IOException e) {
-		e.printStackTrace(System.out);
-            }
-            finally {
-                try {
-                    fileReader.close();
-                }
-                catch (IOException e) {
-		    e.printStackTrace(System.out);
-                }
-            }
-        }
-        catch (IOException e) {
-	    e.printStackTrace(System.out);
-        }
-    }
-}
+/*
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.java.security.action;
+
+import org.apache.axis2.java.security.interf.Actor;
+import org.apache.axis2.java.security.driver.Java2SecTest;
+
+import java.io.CharArrayWriter;
+import java.io.FileReader;
+import java.io.IOException;
+
+
+
+/** 
+ * Action reads the data from an input file  
+ * and then saves the file input to Java2SecTest class
+ */
+
+public class Action implements Actor {
+
+    private String fileName;
+    private FileReader fileReader;
+
+    // Constructor
+    public Action(String fileName) {
+        this.fileName = fileName;
+    }
+
+    // Implementing Actor's takeAction method
+    public void takeAction () {
+    try {
+        // Print out maven's base,build, and test direcotories
+        String baseDir = System.getProperty("basedir");
+        System.out.println("basedir => " + baseDir);
+
+        String buildDir = System.getProperty("maven_build_dir");
+        System.out.println("buildDir => " + buildDir);
+        
+        String testDir = System.getProperty("maven_test_dest");
+        System.out.println("testDir => " + testDir);
+        
+        // Convert the \ (back slash) to / (forward slash)
+        String baseDirM = baseDir.replace('\\', '/');
+        System.out.println("baseDirM => "+ baseDirM);
+        
+        String fs = "/";
+
+        // Build the file URL
+        String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
+        System.out.println("File URL => " + fileURL);
+            
+        if (fileName != null)
+            fileReader = new FileReader(fileURL);
+        else 
+            fileReader = new FileReader("public.txt");
+            
+            try {
+                CharArrayWriter caw = new CharArrayWriter();
+                int c;
+        while ((c = fileReader.read()) != -1) {
+                    caw.write(c);
+                }
+        // Set/save the file input as test result onto Java2SecTest
+                Java2SecTest.testResult = caw.toString();
+            }
+            catch (IOException e) {
+        e.printStackTrace(System.out);
+            }
+            finally {
+                try {
+                    fileReader.close();
+                }
+                catch (IOException e) {
+            e.printStackTrace(System.out);
+                }
+            }
+        }
+        catch (IOException e) {
+        e.printStackTrace(System.out);
+        }
+    }
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/action/Action.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java?view=diff&rev=511585&r1=511584&r2=511585
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java Sun Feb 25 11:56:59 2007
@@ -1,545 +1,545 @@
-/*
- * Copyright 2006 International Business Machines Corp.
- *
- * 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.axis2.java.security.driver;
-
-import org.apache.axis2.java.security.action.Action;
-import org.apache.axis2.java.security.less.LessPermission;
-import org.apache.axis2.java.security.more.MorePermission;
-import org.apache.axis2.java.security.less.LessPermissionPrivilegedExceptionAction;
-import org.apache.axis2.java.security.more.MorePermissionPrivilegedExceptionAction;
-import org.apache.axis2.java.security.less.LessPermissionAccessControlContext;
-import org.apache.axis2.java.security.more.MorePermissionAccessControlContext;
-import org.apache.axis2.java.security.AccessController;
-
-import junit.framework.TestCase;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
-import java.util.Calendar;
-import java.util.TimeZone;
-import java.security.AccessControlException;
-import java.security.Permission;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * Java2SecTest demostrates the usages of AccessController class and Policy file(s) while Security Manager is enabled: 
- *    1. testNoPrivilegePassed shows the usage of no AccessController but it still work fine
- *          because it has all the permissions.
- *    2. testNoPrivilegeFailure shows the usage of AccessController with LessPermission.java, 
- *          which is not right approach.
- *    3. testDoPrivilegePassed shows the correct practice of java 2 security by granting the appropriate 
- *          permission in the policy file(s0 and wrapping the AccessController calls with MorePermission.java. 
- *    4. testDoPrivilegeFailure shows the reverse call order of MorePermission and LessPermission 
- *          from testDoPrivilegedPassed.
- *    5. testAccessControlContextFailure shows the AccessContext which contains a no-permission class 
- *          on the stack can cause a failure. In our case, the no-permission class is 
- *          LessPermissionAccessControlContext.
- *
- */
-
-public class Java2SecTest extends TestCase {
-    // Static variable to keep the test result 
-    public static String testResult = "";
-    
-    // Default constructor
-    public Java2SecTest() {
-	super();
-	System.out.println("\nJava2SecTest ctor 1");
-	Calendar cal = Calendar.getInstance(TimeZone.getDefault());
-	String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
-	java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
-	sdf.setTimeZone(TimeZone.getDefault());     		  
-	System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
-    }
-
-    // Constructor
-    public Java2SecTest(String arg) {
-	super(arg);
-	System.out.println("\nJava2SecTest ctor 2");
-	Calendar cal = Calendar.getInstance(TimeZone.getDefault());
-	String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
-	java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
-	sdf.setTimeZone(TimeZone.getDefault());     		  
-	System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
-    }
-	
-	// This method is added for running this test as a pure junit test
-	 public static void main(String[] args) {
-		  TestRunner.run(suite());
-		 
-	 }
-	 
-	 // This method is added for running this test as a pure junit test
-	 public static Test suite() {
-		  TestSuite suite = new TestSuite(Java2SecTest.class);
-		  
-		  return suite;
-		 
-	 }
-	
-
-
-	 /**
-	  * testNoPrivilegedSuccessed
-	  */
- 	 
-	 public void testNoPrivilegeSuccessed() throws Exception {
-		 Java2SecTest.testResult = "testNoPrivilegeSuccessed failed.";
-	     SecurityManager oldSM = null;
-	     String expectedString = "This line is from public.txt.";
-
-	     System.out.println("\ntestNoPrivilegedSuccessed() begins");
-	     // Check whether the security manager is enabled or not.
-	     // If not, turn it on
-	     oldSM = System.getSecurityManager();
-	     if (oldSM != null) {
-		 System.out.println("\nSecurity Manager is enabled.");
-	     } else {
-		 System.out.println("\nSecurity Manager is disabled.");
-		 System.out.println("Enabling the default Java Security Manager");
-		 System.setSecurityManager(new SecurityManager());
-	     }
-			    	
-	     // Run test WITHOUT AccessController.doPrivileged wrapper
-	     Action dp= new Action("public/public.txt");
-	     MorePermission mp = new MorePermission(dp, false);
-	     LessPermission lp = new LessPermission(mp, false);		
-	     lp.takeAction();
-			    	
-	     // Disable security manager if it is enabled by this testcsae
-	     if (System.getSecurityManager() != null && oldSM == null) {	
-		 System.setSecurityManager(null);
-		 if (System.getSecurityManager() == null) {
-		     System.out.println("Security Manager is successfully disabled.");
-		 } else {
-		     System.out.println("Security Manager is still enabled");
-		 }
-	     }
-	     // Remove extra characters within the result string
-	     testResult = testResult.replaceAll("\\r", "");
-	     testResult = testResult.replaceAll("\\n", "");
-	     System.out.println("Resulting string is " + testResult);
-			    	
-	     // Verify the test result by comparing the test result with expected string   	    	
-	     assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
-			    	
-	     System.out.println("\ntestNoPrivilegedSuccessed() ends\n\n");      	
-	 }
-	 
-
-    
-	/**
-	 * testNoPrivilegedFailure
-	 */
-	 
-	public void testNoPrivilegeFailure() throws Exception {
-		Java2SecTest.testResult = "testNoPrivilegeFailure failed.";
-	    SecurityManager oldSM = null;
-	    	
-	    System.out.println("\ntestNoPrivilegedFailured() begins");
-	    // Check whether the security is enable or not.
-	    // if it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }	
-	    // Run test with AccessController.doPrivilege wrapper
-	    Action dp= new Action("private/private.txt");
-	    MorePermission mp = new MorePermission(dp, false);
-	    LessPermission lp = new LessPermission(mp, false);
-	    try {
-		lp.takeAction();
-	    } catch (Exception e){
-		// verify the test result
-		assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
-	    } finally {
-		// Disable security manager if it is enabled by this testcsae
-		if (System.getSecurityManager() != null && oldSM == null) {	
-		    System.setSecurityManager(null);
-		    if (System.getSecurityManager() == null) {
-			System.out.println("Security Manager is successfully disabled.");
-		    } else {
-			System.out.println("Security Manager is still enabled");
-		    }
-		}
-		System.out.println("\ntesNoPrivilegedFailure() ends\n\n");
-	    }
-	}
-	 	
-
-
-	/**
-	 * testDoPrivilegedSuccessed
-	 */
-	 
-	public void testDoPrivilegeSuccessed() throws Exception {
-		Java2SecTest.testResult = "testDoPrivilegeSuccessed failed.";
-	    SecurityManager oldSM = null;
-	    String expectedString = "This line is from private.txt.";
-	    	
-	    System.out.println("\ntestDoPrivilegedSuccessed() begins");
-	    // Check whether the security is enable or not.
-	    // If it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Java Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }
-	      
-	    // Run test with AccessController.doPrivilege
-	    Action dp= new Action("private/private.txt");
-	    MorePermission mp = new MorePermission(dp, true);
-	    LessPermission lp = new LessPermission(mp, false);
-	    lp.takeAction();
-
-
-	    // Disable security manager if it is enabled by this testcsae
-	    if (System.getSecurityManager() != null && oldSM == null) {	
-		System.setSecurityManager(null);
-		if (System.getSecurityManager() == null) {
-		    System.out.println("Security Manager is successfully disabled.");
-		} else {
-		    System.out.println("Security Manager is still enabled");
-		}
-	    }
-	    	    	
-	    // Remove extra characters within the result string
-	    testResult = testResult.replaceAll("\\r", "");
-	    testResult = testResult.replaceAll("\\n", "");
-	    System.out.println("Resulting string is " + testResult);          	
-	    
-	    // Verify the test result by comparing the test result with expected string   	    	
-	    assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
-	    System.out.println("\ntestDoPrivilegedSuccessed() ends\n\n");
-	}
-	
-
-
-	/**
-	 * testDoPrivilegedFailure
-	 */
-	 
-	public void testDoPrivilegeFailure() throws Exception {
-		Java2SecTest.testResult = "testDoPrivilegeFailure failed.";
-	    SecurityManager oldSM = null;
-	    String expectedString = "This line is from private.txt.";
-	    	
-	    System.out.println("\ntestDoPrivilegedFailure() begins");
-	    // Check whether the security is enable or not.
-	    // If it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Java Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }
-	      
-	    // Run test with AccessController.doPrivilege
-	    Action dp= new Action("private/private.txt");
-	    MorePermission mp = new MorePermission(dp, false);
-	    LessPermission lp = new LessPermission(mp, true);
-	    try {
-		mp.takeAction();
-	    } catch (Exception e) {
-		// Verify the test result
-		assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
-
-	    } finally {
-		// Disable security manager if it is enabled by this testcsae
-		if (System.getSecurityManager() != null && oldSM == null) {	
-		    System.setSecurityManager(null);
-		    if (System.getSecurityManager() == null) {
-			System.out.println("Security Manager is successfully disabled.");
-		    } else {
-			System.out.println("Security Manager is still enabled");
-		    }
-		}
-		System.out.println("\ntestDoPrivilegedFailure() ends\n\n");
-	    }
-	}
-	
-
-	
-
-	/**
-	 * testAccessControlContextFailure
-	 */
-         
-	public void testAccessControlContextFailure() throws Exception {
-		Java2SecTest.testResult = "testAccessControlContextFailure failed.";
-		SecurityManager oldSM = null;
-	    String expectedString = "This line is from private.txt.";
-	    	
-	    System.out.println("\ntestAccessControlContextFailure() begins");
-	    // Check whether the security is enable or not.
-	    // If it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Java Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }
-	      
-	    // Run test with AccessController.doPrivilege
-	    Action dp= new Action("private/private.txt");
-	    MorePermissionAccessControlContext mp = new MorePermissionAccessControlContext(dp, false);
-	    LessPermissionAccessControlContext lp = new LessPermissionAccessControlContext(mp, true);
-	    try {
-		lp.takeAction();
-	    } catch (Exception e) {
-		// Verify the test result
-		assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
-
-	    } finally {
-		// Disable security manager if it is enabled by this testcsae
-		if (System.getSecurityManager() != null && oldSM == null) {	
-		    System.setSecurityManager(null);
-		    if (System.getSecurityManager() == null) {
-			System.out.println("Security Manager is successfully disabled.");
-		    } else {
-			System.out.println("Security Manager is still enabled");
-		    }
-		}
-		System.out.println("\ntestAccessControlContextFailure() ends\n\n");
-	    }
-	}
-
-	// 2 begins
-	
-	/**
-	 * testPrivilegedExceptionActionSuccessed
-	 */
-	 
-	public void testPrivilegedExceptionSuccessed() throws Exception {
-		Java2SecTest.testResult = "testPrivielgedExceptionSuccessed failed";
-		SecurityManager oldSM = null;
-	    String expectedString = "This line is from private.txt.";
-	    	
-	    System.out.println("\ntestPrivilegedExceptionActionSuccessed() begins");
-	    // Check whether the security is enable or not.
-	    // If it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Java Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }
-	      
-	    // Run test with AccessController.doPrivilege
-	    Action dp= new Action("private/private.txt");
-	    MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, true);
-	    LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, false);
-	    lp.takeAction();
-
-
-	    // Disable security manager if it is enabled by this testcsae
-	    if (System.getSecurityManager() != null && oldSM == null) {	
-		System.setSecurityManager(null);
-		if (System.getSecurityManager() == null) {
-		    System.out.println("Security Manager is successfully disabled.");
-		} else {
-		    System.out.println("Security Manager is still enabled");
-		}
-	    }
-	    	    	
-	    // Remove extra characters within the result string
-	    testResult = testResult.replaceAll("\\r", "");
-	    testResult = testResult.replaceAll("\\n", "");
-	    System.out.println("testDoPrivilege's result string is " + testResult);          	
-	    
-	    // Verify the test result by comparing the test result with expected string   	    	
-	    assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
-	    System.out.println("\ntestDoPrivilegeSuccessed() ends\n\n");
-	}
-	
-
-
-	/**
-	 * testPrivilegedExceptionActionFailure
-	 */
-	 
-	public void testPrivilegedExceptionActionFailure() throws Exception {
-		Java2SecTest.testResult = "testPrivilegedExceptionActionFailure failed.";
-		SecurityManager oldSM = null;
-	    String expectedString = "This line is from private.txt.";
-	    	
-	    System.out.println("\ntestPrivilegedExceptionActionFailure() begins");
-	    // Check whether the security is enable or not.
-	    // If it is not enabled, turn it on
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-	        System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-	        System.out.println("\nSecurity Manager is disabled.");
-	        System.out.println("Enabling the default Java Security Manager");
-	        System.setSecurityManager(new SecurityManager());
-	    }
-	      
-	    // Run test with AccessController.doPrivilege
-	    Action dp= new Action("private/private.txt");
-	    MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, false);
-	    LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, true);
-	    try {
-	        mp.takeAction();
-	    } catch (Exception e) {
-	        // Verify the test result
-	        assertTrue("It is not the security exception.", (e instanceof java.security.PrivilegedActionException));
-        } finally {
-		// Disable security manager if it is enabled by this testcsae
-		if (System.getSecurityManager() != null && oldSM == null) {	
-		    System.setSecurityManager(null);
-		    if (System.getSecurityManager() == null) {
-			System.out.println("Security Manager is successfully disabled.");
-		    } else {
-			System.out.println("Security Manager is still enabled");
-		    }
-		}
-		System.out.println("\ntestPrivilegedExceptionActionFailure() ends\n\n");
-	    }
-	}
-
-	/**
-	 * testCheckPermissionAllowed
-	 */
-	
-	public void testCheckPermissionAllowed() throws Exception {
-		Java2SecTest.testResult = "testCheckPermissionAllowed failed.";
-		SecurityManager oldSM = null;
-
-	    System.out.println("\ntestCheckPermissionAllowed() begins.\n");
-	    boolean allowed = false;
-	    String fileName = "public/public.txt";
-
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-		System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-		System.out.println("\nSecurity Manager is disabled.");
-		System.out.println("Enabling the default Java Security Manager");
-		System.setSecurityManager(new SecurityManager());
-	    }
-
-	    try {     
-                // Print out maven's base,build, and test direcotories    
-                String baseDir = System.getProperty("basedir");   
-                System.out.println("basedir => " + baseDir);    
-                // Convert the \ (back slash) to / (forward slash)    
-                String baseDirM = baseDir.replace('\\', '/');    
-                System.out.println("baseDirM => "+ baseDirM);   
-                String fs = "/";
-                
-                // Build the file URL    
-                String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
-                Permission perm = new java.io.FilePermission(fileURL, "read");   
-                AccessController.checkPermission(perm);
-                allowed = true;
-            } catch (Exception e) {
-                if (e instanceof AccessControlException) {
-                    e.printStackTrace(System.out); 
-                }
-	    } finally {
-                assertTrue("Accessing to public.txt file is denied; Test failed.", allowed);
-		// Disable security manager if it is enabled by this testcsae
-		if (System.getSecurityManager() != null && oldSM == null) {	
-		    System.setSecurityManager(null);
-		    if (System.getSecurityManager() == null) {
-			    System.out.println("Security Manager is successfully disabled.");
-		    } else {
-			    System.out.println("Security Manager is still enabled");
-		    }
-		}
-		System.out.println("\ntestCheckPermissionAllowed() ends.\n");
-	    }
-
-	}
-
-
-	
-	/**
-	 * testCheckPermissionDenied
-	 */
-	
-	public void testCheckPermissionDenied() throws Exception {
-		Java2SecTest.testResult = "testCheckPermissionDenied failed";
-		SecurityManager oldSM = null;
-
-	    System.out.println("\ntestCheckPermissionDenied() begins.\n");
-	    boolean denied = true;
-	    String fileName = "private/private.txt";
-
-	    oldSM = System.getSecurityManager();
-	    if (oldSM != null) {
-	        System.out.println("\nSecurity Manager is enabled.");
-	    } else {
-	        System.out.println("\nSecurity Manager is disabled.");
-	        System.out.println("Enabling the default Java Security Manager");
-	        System.setSecurityManager(new SecurityManager());
-	    }
-
-	    try {
-	        // Print out maven's base,build, and test direcotories
-	        String baseDir = System.getProperty("basedir");
-	        System.out.println("basedir => " + baseDir);
-	    
-	        // Convert the \ (back slash) to / (forward slash)
-	        String baseDirM = baseDir.replace('\\', '/');
-	        System.out.println("baseDirM => "+ baseDirM);
-	    
-	        String fs = "/";
-	    
-	        // Build the file URL
-	        String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
-	        Permission perm = new java.io.FilePermission(fileURL, "read");
-	        AccessController.checkPermission(perm);
-	        denied = false;
-	    } catch (Exception e) {
-	        if (!(e instanceof AccessControlException)) {
-	            denied = false;
-	        }
-            e.printStackTrace(System.out);    
-	    } finally {
-	        assertTrue("Accessing to private.txt file is allowed; Test failed.", denied);
-
-	        // Disable security manager if it is enabled by this testcsae
-	        if (System.getSecurityManager() != null && oldSM == null) {	
-	            System.setSecurityManager(null);
-	            if (System.getSecurityManager() == null) {
-	                System.out.println("Security Manager is successfully disabled.");
-	            } else {
-	                System.out.println("Security Manager is still enabled");
-	            }
-	        }
-            System.out.println("\ntestCheckPermissionDenied() ends.\n");
-	    }
-	}	
-}
+/*
+ * Copyright 2006 International Business Machines Corp.
+ *
+ * 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.axis2.java.security.driver;
+
+import org.apache.axis2.java.security.action.Action;
+import org.apache.axis2.java.security.less.LessPermission;
+import org.apache.axis2.java.security.more.MorePermission;
+import org.apache.axis2.java.security.less.LessPermissionPrivilegedExceptionAction;
+import org.apache.axis2.java.security.more.MorePermissionPrivilegedExceptionAction;
+import org.apache.axis2.java.security.less.LessPermissionAccessControlContext;
+import org.apache.axis2.java.security.more.MorePermissionAccessControlContext;
+import org.apache.axis2.java.security.AccessController;
+
+import junit.framework.TestCase;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import java.util.Calendar;
+import java.util.TimeZone;
+import java.security.AccessControlException;
+import java.security.Permission;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+/**
+ * Java2SecTest demostrates the usages of AccessController class and Policy file(s) while Security Manager is enabled: 
+ *    1. testNoPrivilegePassed shows the usage of no AccessController but it still work fine
+ *          because it has all the permissions.
+ *    2. testNoPrivilegeFailure shows the usage of AccessController with LessPermission.java, 
+ *          which is not right approach.
+ *    3. testDoPrivilegePassed shows the correct practice of java 2 security by granting the appropriate 
+ *          permission in the policy file(s0 and wrapping the AccessController calls with MorePermission.java. 
+ *    4. testDoPrivilegeFailure shows the reverse call order of MorePermission and LessPermission 
+ *          from testDoPrivilegedPassed.
+ *    5. testAccessControlContextFailure shows the AccessContext which contains a no-permission class 
+ *          on the stack can cause a failure. In our case, the no-permission class is 
+ *          LessPermissionAccessControlContext.
+ *
+ */
+
+public class Java2SecTest extends TestCase {
+    // Static variable to keep the test result 
+    public static String testResult = "";
+    
+    // Default constructor
+    public Java2SecTest() {
+    super();
+    System.out.println("\nJava2SecTest ctor 1");
+    Calendar cal = Calendar.getInstance(TimeZone.getDefault());
+    String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+    sdf.setTimeZone(TimeZone.getDefault());               
+    System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
+    }
+
+    // Constructor
+    public Java2SecTest(String arg) {
+    super(arg);
+    System.out.println("\nJava2SecTest ctor 2");
+    Calendar cal = Calendar.getInstance(TimeZone.getDefault());
+    String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(DATE_FORMAT);
+    sdf.setTimeZone(TimeZone.getDefault());               
+    System.out.println("Current time => " + sdf.format(cal.getTime()) + "\n");
+    }
+    
+    // This method is added for running this test as a pure junit test
+     public static void main(String[] args) {
+          TestRunner.run(suite());
+         
+     }
+     
+     // This method is added for running this test as a pure junit test
+     public static Test suite() {
+          TestSuite suite = new TestSuite(Java2SecTest.class);
+          
+          return suite;
+         
+     }
+    
+
+
+     /**
+      * testNoPrivilegedSuccessed
+      */
+      
+     public void testNoPrivilegeSuccessed() throws Exception {
+         Java2SecTest.testResult = "testNoPrivilegeSuccessed failed.";
+         SecurityManager oldSM = null;
+         String expectedString = "This line is from public.txt.";
+
+         System.out.println("\ntestNoPrivilegedSuccessed() begins");
+         // Check whether the security manager is enabled or not.
+         // If not, turn it on
+         oldSM = System.getSecurityManager();
+         if (oldSM != null) {
+         System.out.println("\nSecurity Manager is enabled.");
+         } else {
+         System.out.println("\nSecurity Manager is disabled.");
+         System.out.println("Enabling the default Java Security Manager");
+         System.setSecurityManager(new SecurityManager());
+         }
+                    
+         // Run test WITHOUT AccessController.doPrivileged wrapper
+         Action dp= new Action("public/public.txt");
+         MorePermission mp = new MorePermission(dp, false);
+         LessPermission lp = new LessPermission(mp, false);        
+         lp.takeAction();
+                    
+         // Disable security manager if it is enabled by this testcsae
+         if (System.getSecurityManager() != null && oldSM == null) {    
+         System.setSecurityManager(null);
+         if (System.getSecurityManager() == null) {
+             System.out.println("Security Manager is successfully disabled.");
+         } else {
+             System.out.println("Security Manager is still enabled");
+         }
+         }
+         // Remove extra characters within the result string
+         testResult = testResult.replaceAll("\\r", "");
+         testResult = testResult.replaceAll("\\n", "");
+         System.out.println("Resulting string is " + testResult);
+                    
+         // Verify the test result by comparing the test result with expected string               
+         assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
+                    
+         System.out.println("\ntestNoPrivilegedSuccessed() ends\n\n");          
+     }
+     
+
+    
+    /**
+     * testNoPrivilegedFailure
+     */
+     
+    public void testNoPrivilegeFailure() throws Exception {
+        Java2SecTest.testResult = "testNoPrivilegeFailure failed.";
+        SecurityManager oldSM = null;
+            
+        System.out.println("\ntestNoPrivilegedFailured() begins");
+        // Check whether the security is enable or not.
+        // if it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }    
+        // Run test with AccessController.doPrivilege wrapper
+        Action dp= new Action("private/private.txt");
+        MorePermission mp = new MorePermission(dp, false);
+        LessPermission lp = new LessPermission(mp, false);
+        try {
+        lp.takeAction();
+        } catch (Exception e){
+        // verify the test result
+        assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+        } finally {
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+            System.setSecurityManager(null);
+            if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+            } else {
+            System.out.println("Security Manager is still enabled");
+            }
+        }
+        System.out.println("\ntesNoPrivilegedFailure() ends\n\n");
+        }
+    }
+         
+
+
+    /**
+     * testDoPrivilegedSuccessed
+     */
+     
+    public void testDoPrivilegeSuccessed() throws Exception {
+        Java2SecTest.testResult = "testDoPrivilegeSuccessed failed.";
+        SecurityManager oldSM = null;
+        String expectedString = "This line is from private.txt.";
+            
+        System.out.println("\ntestDoPrivilegedSuccessed() begins");
+        // Check whether the security is enable or not.
+        // If it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Java Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }
+          
+        // Run test with AccessController.doPrivilege
+        Action dp= new Action("private/private.txt");
+        MorePermission mp = new MorePermission(dp, true);
+        LessPermission lp = new LessPermission(mp, false);
+        lp.takeAction();
+
+
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+        System.setSecurityManager(null);
+        if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+        } else {
+            System.out.println("Security Manager is still enabled");
+        }
+        }
+                    
+        // Remove extra characters within the result string
+        testResult = testResult.replaceAll("\\r", "");
+        testResult = testResult.replaceAll("\\n", "");
+        System.out.println("Resulting string is " + testResult);              
+        
+        // Verify the test result by comparing the test result with expected string               
+        assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
+        System.out.println("\ntestDoPrivilegedSuccessed() ends\n\n");
+    }
+    
+
+
+    /**
+     * testDoPrivilegedFailure
+     */
+     
+    public void testDoPrivilegeFailure() throws Exception {
+        Java2SecTest.testResult = "testDoPrivilegeFailure failed.";
+        SecurityManager oldSM = null;
+        String expectedString = "This line is from private.txt.";
+            
+        System.out.println("\ntestDoPrivilegedFailure() begins");
+        // Check whether the security is enable or not.
+        // If it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Java Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }
+          
+        // Run test with AccessController.doPrivilege
+        Action dp= new Action("private/private.txt");
+        MorePermission mp = new MorePermission(dp, false);
+        LessPermission lp = new LessPermission(mp, true);
+        try {
+        mp.takeAction();
+        } catch (Exception e) {
+        // Verify the test result
+        assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+
+        } finally {
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+            System.setSecurityManager(null);
+            if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+            } else {
+            System.out.println("Security Manager is still enabled");
+            }
+        }
+        System.out.println("\ntestDoPrivilegedFailure() ends\n\n");
+        }
+    }
+    
+
+    
+
+    /**
+     * testAccessControlContextFailure
+     */
+         
+    public void testAccessControlContextFailure() throws Exception {
+        Java2SecTest.testResult = "testAccessControlContextFailure failed.";
+        SecurityManager oldSM = null;
+        String expectedString = "This line is from private.txt.";
+            
+        System.out.println("\ntestAccessControlContextFailure() begins");
+        // Check whether the security is enable or not.
+        // If it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Java Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }
+          
+        // Run test with AccessController.doPrivilege
+        Action dp= new Action("private/private.txt");
+        MorePermissionAccessControlContext mp = new MorePermissionAccessControlContext(dp, false);
+        LessPermissionAccessControlContext lp = new LessPermissionAccessControlContext(mp, true);
+        try {
+        lp.takeAction();
+        } catch (Exception e) {
+        // Verify the test result
+        assertTrue("It is not the security exception.", (e instanceof java.security.AccessControlException));
+
+        } finally {
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+            System.setSecurityManager(null);
+            if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+            } else {
+            System.out.println("Security Manager is still enabled");
+            }
+        }
+        System.out.println("\ntestAccessControlContextFailure() ends\n\n");
+        }
+    }
+
+    // 2 begins
+    
+    /**
+     * testPrivilegedExceptionActionSuccessed
+     */
+     
+    public void testPrivilegedExceptionSuccessed() throws Exception {
+        Java2SecTest.testResult = "testPrivielgedExceptionSuccessed failed";
+        SecurityManager oldSM = null;
+        String expectedString = "This line is from private.txt.";
+            
+        System.out.println("\ntestPrivilegedExceptionActionSuccessed() begins");
+        // Check whether the security is enable or not.
+        // If it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Java Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }
+          
+        // Run test with AccessController.doPrivilege
+        Action dp= new Action("private/private.txt");
+        MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, true);
+        LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, false);
+        lp.takeAction();
+
+
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+        System.setSecurityManager(null);
+        if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+        } else {
+            System.out.println("Security Manager is still enabled");
+        }
+        }
+                    
+        // Remove extra characters within the result string
+        testResult = testResult.replaceAll("\\r", "");
+        testResult = testResult.replaceAll("\\n", "");
+        System.out.println("testDoPrivilege's result string is " + testResult);              
+        
+        // Verify the test result by comparing the test result with expected string               
+        assertTrue("The string contents do not match.", expectedString.equalsIgnoreCase(testResult));
+        System.out.println("\ntestDoPrivilegeSuccessed() ends\n\n");
+    }
+    
+
+
+    /**
+     * testPrivilegedExceptionActionFailure
+     */
+     
+    public void testPrivilegedExceptionActionFailure() throws Exception {
+        Java2SecTest.testResult = "testPrivilegedExceptionActionFailure failed.";
+        SecurityManager oldSM = null;
+        String expectedString = "This line is from private.txt.";
+            
+        System.out.println("\ntestPrivilegedExceptionActionFailure() begins");
+        // Check whether the security is enable or not.
+        // If it is not enabled, turn it on
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+            System.out.println("\nSecurity Manager is enabled.");
+        } else {
+            System.out.println("\nSecurity Manager is disabled.");
+            System.out.println("Enabling the default Java Security Manager");
+            System.setSecurityManager(new SecurityManager());
+        }
+          
+        // Run test with AccessController.doPrivilege
+        Action dp= new Action("private/private.txt");
+        MorePermissionPrivilegedExceptionAction mp = new MorePermissionPrivilegedExceptionAction(dp, false);
+        LessPermissionPrivilegedExceptionAction lp = new LessPermissionPrivilegedExceptionAction(mp, true);
+        try {
+            mp.takeAction();
+        } catch (Exception e) {
+            // Verify the test result
+            assertTrue("It is not the security exception.", (e instanceof java.security.PrivilegedActionException));
+        } finally {
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+            System.setSecurityManager(null);
+            if (System.getSecurityManager() == null) {
+            System.out.println("Security Manager is successfully disabled.");
+            } else {
+            System.out.println("Security Manager is still enabled");
+            }
+        }
+        System.out.println("\ntestPrivilegedExceptionActionFailure() ends\n\n");
+        }
+    }
+
+    /**
+     * testCheckPermissionAllowed
+     */
+    
+    public void testCheckPermissionAllowed() throws Exception {
+        Java2SecTest.testResult = "testCheckPermissionAllowed failed.";
+        SecurityManager oldSM = null;
+
+        System.out.println("\ntestCheckPermissionAllowed() begins.\n");
+        boolean allowed = false;
+        String fileName = "public/public.txt";
+
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+        System.out.println("\nSecurity Manager is enabled.");
+        } else {
+        System.out.println("\nSecurity Manager is disabled.");
+        System.out.println("Enabling the default Java Security Manager");
+        System.setSecurityManager(new SecurityManager());
+        }
+
+        try {     
+                // Print out maven's base,build, and test direcotories    
+                String baseDir = System.getProperty("basedir");   
+                System.out.println("basedir => " + baseDir);    
+                // Convert the \ (back slash) to / (forward slash)    
+                String baseDirM = baseDir.replace('\\', '/');    
+                System.out.println("baseDirM => "+ baseDirM);   
+                String fs = "/";
+                
+                // Build the file URL    
+                String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
+                Permission perm = new java.io.FilePermission(fileURL, "read");   
+                AccessController.checkPermission(perm);
+                allowed = true;
+            } catch (Exception e) {
+                if (e instanceof AccessControlException) {
+                    e.printStackTrace(System.out); 
+                }
+        } finally {
+                assertTrue("Accessing to public.txt file is denied; Test failed.", allowed);
+        // Disable security manager if it is enabled by this testcsae
+        if (System.getSecurityManager() != null && oldSM == null) {    
+            System.setSecurityManager(null);
+            if (System.getSecurityManager() == null) {
+                System.out.println("Security Manager is successfully disabled.");
+            } else {
+                System.out.println("Security Manager is still enabled");
+            }
+        }
+        System.out.println("\ntestCheckPermissionAllowed() ends.\n");
+        }
+
+    }
+
+
+    
+    /**
+     * testCheckPermissionDenied
+     */
+    
+    public void testCheckPermissionDenied() throws Exception {
+        Java2SecTest.testResult = "testCheckPermissionDenied failed";
+        SecurityManager oldSM = null;
+
+        System.out.println("\ntestCheckPermissionDenied() begins.\n");
+        boolean denied = true;
+        String fileName = "private/private.txt";
+
+        oldSM = System.getSecurityManager();
+        if (oldSM != null) {
+            System.out.println("\nSecurity Manager is enabled.");
+        } else {
+            System.out.println("\nSecurity Manager is disabled.");
+            System.out.println("Enabling the default Java Security Manager");
+            System.setSecurityManager(new SecurityManager());
+        }
+
+        try {
+            // Print out maven's base,build, and test direcotories
+            String baseDir = System.getProperty("basedir");
+            System.out.println("basedir => " + baseDir);
+        
+            // Convert the \ (back slash) to / (forward slash)
+            String baseDirM = baseDir.replace('\\', '/');
+            System.out.println("baseDirM => "+ baseDirM);
+        
+            String fs = "/";
+        
+            // Build the file URL
+            String fileURL=baseDirM+fs+"test-resources"+fs+"java2sec"+fs+fileName;
+            Permission perm = new java.io.FilePermission(fileURL, "read");
+            AccessController.checkPermission(perm);
+            denied = false;
+        } catch (Exception e) {
+            if (!(e instanceof AccessControlException)) {
+                denied = false;
+            }
+            e.printStackTrace(System.out);    
+        } finally {
+            assertTrue("Accessing to private.txt file is allowed; Test failed.", denied);
+
+            // Disable security manager if it is enabled by this testcsae
+            if (System.getSecurityManager() != null && oldSM == null) {    
+                System.setSecurityManager(null);
+                if (System.getSecurityManager() == null) {
+                    System.out.println("Security Manager is successfully disabled.");
+                } else {
+                    System.out.println("Security Manager is still enabled");
+                }
+            }
+            System.out.println("\ntestCheckPermissionDenied() ends.\n");
+        }
+    }    
+}

Propchange: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/java/security/driver/Java2SecTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org