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/12/13 03:57:52 UTC
svn commit: r356456 - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/context/ core/src/org/apache/axis2/deployment/
core/src/org/apache/axis2/engine/ core/test/org/apache/axis2/deployment/
core/test/org/apache/axis2/engine/ integra...
Author: deepal
Date: Mon Dec 12 18:57:46 2005
New Revision: 356456
URL: http://svn.apache.org/viewcvs?rev=356456&view=rev
Log:
fixing security test cases (which were failed due to incorrect parameter value (need to trim the para value))
Just started AxisConfiguration abstraction (need to improve this) , I will drop a mail to list explaining wt i have done
Added:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemBasedAxisConfigurationCreteator.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationCreator.java
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/InvalidServiceTest.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModifiedConfigFileTest.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SystemPhasesremovedTest.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleConfigTest.java
webservices/axis2/trunk/java/modules/integration/test-resources/security/s4.client.axis2.xml
webservices/axis2/trunk/java/modules/integration/test-resources/security/s6.client.axis2.xml
webservices/axis2/trunk/java/modules/integration/test-resources/security/s7.client.axis2.xml
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContextFactory.java Mon Dec 12 18:57:46 2005
@@ -1,13 +1,15 @@
package org.apache.axis2.context;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.DeploymentEngine;
import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.FileSystemBasedAxisConfigurationCreteator;
import org.apache.axis2.description.ModuleDescription;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurationCreator;
import org.apache.axis2.modules.Module;
+import org.apache.axis2.phaseresolver.PhaseException;
import org.apache.axis2.phaseresolver.PhaseResolver;
import org.apache.axis2.transport.TransportListener;
import org.apache.axis2.transport.TransportSender;
@@ -19,8 +21,18 @@
import java.util.Iterator;
public class ConfigurationContextFactory {
+
+
private Log log = LogFactory.getLog(getClass());
+ public ConfigurationContext getConfigurationContext(
+ AxisConfigurationCreator axisConfigurationCreator) throws AxisFault {
+ AxisConfiguration axisConfig = axisConfigurationCreator.getAxisConfiguration();
+ ConfigurationContext configContext = new ConfigurationContext(axisConfig);
+ init(configContext);
+ return configContext;
+ }
+
/**
* Builds the configuration for the Server.
*
@@ -28,23 +40,13 @@
* @return Returns the built ConfigurationContext.
* @throws DeploymentException
*/
- public ConfigurationContext buildConfigurationContext(
- String repositoryName)
- throws DeploymentException {
- ConfigurationContext configurationContext;
- try {
- DeploymentEngine deploymentEngine =
- new DeploymentEngine(repositoryName);
- AxisConfiguration configuration = deploymentEngine.load();
- PhaseResolver phaseResolver = new PhaseResolver(configuration);
-
- configurationContext = new ConfigurationContext(configuration);
- phaseResolver.buildTranspotsChains();
- initModules(configurationContext);
- initTransports(configurationContext);
- } catch (AxisFault axisFault) {
- throw new DeploymentException(axisFault);
- }
+ public ConfigurationContext buildConfigurationContext(String repositoryName)
+ throws AxisFault {
+ AxisConfigurationCreator repoBasedConfigCreator =
+ new FileSystemBasedAxisConfigurationCreteator(repositoryName, true);
+ AxisConfiguration axisConfig = repoBasedConfigCreator.getAxisConfiguration();
+ ConfigurationContext configurationContext = new ConfigurationContext(axisConfig);
+ init(configurationContext);
return configurationContext;
}
@@ -55,22 +57,42 @@
* @return Returns ConfigurationContext.
* @throws DeploymentException
*/
- public ConfigurationContext buildClientConfigurationContext(
- String axis2home)
- throws DeploymentException {
- ConfigurationContext configContext;
+ public ConfigurationContext buildClientConfigurationContext(String axis2home)
+ throws AxisFault {
+ AxisConfigurationCreator repoBasedConfigCreator =
+ new FileSystemBasedAxisConfigurationCreteator(axis2home, false);
+ AxisConfiguration axisConfig = repoBasedConfigCreator.getAxisConfiguration();
+ ConfigurationContext configurationContext = new ConfigurationContext(axisConfig);
+ init(configurationContext);
+ return configurationContext;
+ }
+
+
+ /**
+ * To get the default configuration context , this will return a AxisConfiguration
+ * which is created by fileSystem based AxisConfiguration creator
+ *
+ * @return ConfigurationContext
+ */
+ public ConfigurationContext getDafaultConfigurationContext() {
+ AxisConfiguration axisConfig = new AxisConfiguration();
+ return new ConfigurationContext(axisConfig);
+ }
+
+ /**
+ * To initilizae modules and , create Tranpsorts, this method is bean used
+ */
+ private void init(ConfigurationContext configContext) throws AxisFault {
try {
- AxisConfiguration configuration =
- new DeploymentEngine().loadClient(axis2home);
- PhaseResolver phaseResolver = new PhaseResolver(configuration);
- configContext = new ConfigurationContext(configuration);
+ PhaseResolver phaseResolver = new PhaseResolver(configContext.getAxisConfiguration());
phaseResolver.buildTranspotsChains();
initModules(configContext);
initTransports(configContext);
- } catch (AxisFault axisFault) {
- throw new DeploymentException(axisFault);
+ } catch (PhaseException e) {
+ throw new AxisFault(e);
+ } catch (DeploymentException e) {
+ throw new AxisFault(e);
}
- return configContext;
}
/**
@@ -85,7 +107,7 @@
throws DeploymentException {
try {
HashMap modules =
- ((AxisConfiguration) context.getAxisConfiguration())
+ context.getAxisConfiguration()
.getModules();
Collection col = modules.values();
for (Iterator iterator = col.iterator(); iterator.hasNext();) {
Added: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemBasedAxisConfigurationCreteator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemBasedAxisConfigurationCreteator.java?rev=356456&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemBasedAxisConfigurationCreteator.java (added)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemBasedAxisConfigurationCreteator.java Mon Dec 12 18:57:46 2005
@@ -0,0 +1,54 @@
+package org.apache.axis2.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurationCreator;
+/*
+* 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.
+*
+*
+*/
+
+public class FileSystemBasedAxisConfigurationCreteator implements AxisConfigurationCreator {
+
+ private String repoLocation;
+ /**
+ * To check whether need to create a service side or client side
+ */
+ private boolean isServer;
+
+ public FileSystemBasedAxisConfigurationCreteator(String repoLocation, boolean isServer) {
+ this.repoLocation = repoLocation;
+ this.isServer = isServer;
+ }
+
+ /**
+ * First create a Deployment engine and using that , crate an AxisConfiguration , and the
+ * Deployment Engine is totally file system dependent.
+ *
+ * @return
+ * @throws AxisFault
+ */
+
+ public AxisConfiguration getAxisConfiguration() throws AxisFault {
+ DeploymentEngine deploymentEngine;
+ if (isServer) {
+ deploymentEngine = new DeploymentEngine(repoLocation);
+ return deploymentEngine.load();
+ } else {
+ return new DeploymentEngine().loadClient(repoLocation);
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationCreator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationCreator.java?rev=356456&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationCreator.java (added)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisConfigurationCreator.java Mon Dec 12 18:57:46 2005
@@ -0,0 +1,30 @@
+package org.apache.axis2.engine;
+
+import org.apache.axis2.AxisFault;
+
+/*
+* 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.
+*
+*
+*/
+
+public interface AxisConfigurationCreator {
+ /**
+ * Configurationcontextfactory will call this method to get the AxisConfiguration
+ *
+ * @return AxisConfigurationCreator
+ */
+ AxisConfiguration getAxisConfiguration() throws AxisFault ;
+}
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/InvalidServiceTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/InvalidServiceTest.java?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/InvalidServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/InvalidServiceTest.java Mon Dec 12 18:57:46 2005
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.AxisFault;
public class InvalidServiceTest extends TestCase {
/**
@@ -31,15 +32,14 @@
try {
String filename = "./target/test-resources/InvalidDeployment";
ConfigurationContextFactory builder = new ConfigurationContextFactory();
- er =
- builder.buildConfigurationContext(filename)
+ er =builder.buildConfigurationContext(filename)
.getAxisConfiguration();
String msg = (String) er.getFaultyServices().get("invalidService");
if (msg == null || msg.equals("")) {
fail("this must failed gracefully with AxisFault ervice specifi module can not" +
"refer system pre defined phases");
}
- } catch (DeploymentException e) {
+ } catch (AxisFault e) {
return;
}
}
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModifiedConfigFileTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModifiedConfigFileTest.java?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModifiedConfigFileTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/ModifiedConfigFileTest.java Mon Dec 12 18:57:46 2005
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.AxisFault;
public class ModifiedConfigFileTest extends TestCase {
@@ -32,7 +33,7 @@
fail(
"this must failed gracefully with DeploymentException \"Invalid System predefined " +
"inphases , phase order dose not\" +\n support\\n recheck axis2.xml\"");
- } catch (DeploymentException e) {
+ } catch (AxisFault e) {
}
}
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SystemPhasesremovedTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SystemPhasesremovedTest.java?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SystemPhasesremovedTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/SystemPhasesremovedTest.java Mon Dec 12 18:57:46 2005
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -37,7 +38,7 @@
fail(
"this must failed gracefully with DeploymentException \"Invalid System predefined " +
"inphases , phase order dose not\" +\n support\\n recheck axis2.xml\"");
- } catch (DeploymentException e) {
+ } catch (AxisFault e) {
log.info(e.getCause());
}
}
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleConfigTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleConfigTest.java?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleConfigTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/engine/ModuleConfigTest.java Mon Dec 12 18:57:46 2005
@@ -31,11 +31,11 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+
public class ModuleConfigTest extends TestCase {
AxisConfiguration ar;
- String repo ="./test-resources/deployment/moduleConfig";
-
+ String repo = "./test-resources/deployment/moduleConfig";
public void testModuleConfigAtAxisConfig() {
@@ -43,23 +43,23 @@
ConfigurationContextFactory builder = new ConfigurationContextFactory();
ar = builder.buildConfigurationContext(repo).getAxisConfiguration();
ModuleConfiguration moduleConfiguration =
- ((AxisConfiguration)ar).getModuleConfig(new QName("testModule"));
+ ar.getModuleConfig(new QName("testModule"));
assertNotNull(moduleConfiguration);
Parameter para = moduleConfiguration.getParameter("testModulePara");
assertNotNull(para);
moduleConfiguration =
- ((AxisConfiguration)ar).getModuleConfig(new QName("testModule2"));
+ ar.getModuleConfig(new QName("testModule2"));
assertNotNull(moduleConfiguration);
para = moduleConfiguration.getParameter("testModulePara2");
assertNotNull(para);
- } catch (DeploymentException e) {
- fail("This can not fail with this DeploymentException " + e) ;
+ } catch (AxisFault e) {
+ fail("This can not fail with this DeploymentException " + e);
}
}
- public void testModuleConfigAtService() {
+ public void testModuleConfigAtService() {
try {
ConfigurationContextFactory builder = new ConfigurationContextFactory();
ar = builder.buildConfigurationContext(repo).getAxisConfiguration();
@@ -69,7 +69,7 @@
service.setName(new QName("testService"));
ar.addService(service);
InputStream in = new FileInputStream(repo + "/service1.xml");
- ServiceBuilder sbuilder = new ServiceBuilder(in,null,service);
+ ServiceBuilder sbuilder = new ServiceBuilder(in, null, service);
sbuilder.populateService(sbuilder.buildOM());
ModuleConfiguration moduleConfiguration = service.getModuleConfig(new QName("Servie_module"));
@@ -87,13 +87,13 @@
} catch (DeploymentException e) {
- fail("This can not fail with this DeploymentException " + e) ;
+ fail("This can not fail with this DeploymentException " + e);
} catch (FileNotFoundException e) {
- fail("This can not fail with this FileNotFoundException " + e) ;
+ fail("This can not fail with this FileNotFoundException " + e);
} catch (AxisFault axisFault) {
- fail("This can not fail with this AxisFault " + axisFault) ;
+ fail("This can not fail with this AxisFault " + axisFault);
} catch (XMLStreamException e) {
- fail("This can not fail with this AxisFault " + e) ;
+ fail("This can not fail with this AxisFault " + e);
}
- }
+ }
}
Modified: webservices/axis2/trunk/java/modules/integration/test-resources/security/s4.client.axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/s4.client.axis2.xml?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/s4.client.axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/s4.client.axis2.xml Mon Dec 12 18:57:46 2005
@@ -16,11 +16,9 @@
<passwordCallbackClass>org.apache.axis2.security.PWCallback</passwordCallbackClass>
<signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
<encryptionKeyIdentifier>EmbeddedKeyName</encryptionKeyIdentifier>
- <encryptionSymAlgorithm>
- http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
+ <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
<signaturePropFile>interop.properties</signaturePropFile>
- <EmbeddedKeyCallbackClass>
- org.apache.axis2.security.PWCallback</EmbeddedKeyCallbackClass>
+ <EmbeddedKeyCallbackClass>org.apache.axis2.security.PWCallback</EmbeddedKeyCallbackClass>
<EmbeddedKeyName>SessionKey</EmbeddedKeyName>
</action>
</parameter>
Modified: webservices/axis2/trunk/java/modules/integration/test-resources/security/s6.client.axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/s6.client.axis2.xml?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/s6.client.axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/s6.client.axis2.xml Mon Dec 12 18:57:46 2005
@@ -15,8 +15,7 @@
<user>alice</user>
<passwordCallbackClass>org.apache.axis2.security.PWCallback</passwordCallbackClass>
<encryptionKeyIdentifier>SKIKeyIdentifier</encryptionKeyIdentifier>
- <encryptionSymAlgorithm>
- http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
+ <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
<encryptionUser>bob</encryptionUser>
<signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
<signaturePropFile>interop.properties</signaturePropFile>
Modified: webservices/axis2/trunk/java/modules/integration/test-resources/security/s7.client.axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/test-resources/security/s7.client.axis2.xml?rev=356456&r1=356455&r2=356456&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/security/s7.client.axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/security/s7.client.axis2.xml Mon Dec 12 18:57:46 2005
@@ -15,14 +15,12 @@
<user>alice</user>
<passwordCallbackClass>org.apache.axis2.security.PWCallback</passwordCallbackClass>
<encryptionKeyIdentifier>SKIKeyIdentifier</encryptionKeyIdentifier>
- <encryptionSymAlgorithm>
- http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
+ <encryptionSymAlgorithm>http://www.w3.org/2001/04/xmlenc#tripledes-cbc</encryptionSymAlgorithm>
<encryptionUser>bob</encryptionUser>
<signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
<signaturePropFile>interop.properties</signaturePropFile>
<encryptionPropFile>interop.properties</encryptionPropFile>
- <signatureParts>
- {}{http://schemas.xmlsoap.org/soap/envelope/}Body;STRTransform</signatureParts>
+ <signatureParts>{}{http://schemas.xmlsoap.org/soap/envelope/}Body;STRTransform</signatureParts>
</action>
</parameter>