You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2006/04/26 20:06:48 UTC
svn commit: r397263 - in /webservices/axis2/trunk/java/modules/core:
src/org/apache/axis2/deployment/FileSystemConfigurator.java
test-resources/deployment/axis2.xml
test/org/apache/axis2/deployment/DeploymentTotalTest.java
Author: gdaniels
Date: Wed Apr 26 11:06:46 2006
New Revision: 397263
URL: http://svn.apache.org/viewcvs?rev=397263&view=rev
Log:
Re-fix repository reading problem which was mistakenly reverted (gr).
This time add a test which confirms that the filename defaulting works correctly; set a <parameter> in the axis2.xml that DeploymentTotalTest uses, and check that the value is correct.
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
webservices/axis2/trunk/java/modules/core/test-resources/deployment/axis2.xml
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java?rev=397263&r1=397262&r2=397263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/FileSystemConfigurator.java Wed Apr 26 11:06:46 2006
@@ -73,26 +73,30 @@
// Deal with the config file. If a filename was specified as an
// arg to this constructor, just respect it.
if (axis2xml == null) {
- String propertyAxis2xml = System.getProperty(Constants.AXIS2_CONF);
- if (propertyAxis2xml != null) {
- try {
- File axis2discriptor = new File(propertyAxis2xml);
- if (axis2discriptor.exists()) {
- this.axis2xml = axis2discriptor.getAbsolutePath();
- } else {
- this.axis2xml = null;
- }
- } catch (Exception e) {
- this.axis2xml = null;
- log.info("Error in file (axis2.xml) creation inside FileSystemConfigurator");
- }
+ // If not, check for a system property setting
+ axis2xml = System.getProperty(Constants.AXIS2_CONF);
+
+ // If system property not set, use default filename
+ if (axis2xml == null) {
+ axis2xml = Constants.AXIS2_CONF;
+ }
- } else {
- this.axis2xml = null;
+ // In either case, check that the file exists... if not
+ // we'll use the default axis2.xml on the classpath.
+ try {
+ axis2xml = this.repoLocation + File.separator + axis2xml;
+ File configFile = new File(axis2xml);
+ if (!configFile.exists()) {
+ axis2xml = null;
+ }
+ } catch (Exception e) {
+ axis2xml = null;
+ log.info("Error in file (axis2.xml) creation inside FileSystemConfigurator");
}
- } else {
- this.axis2xml = axis2xml;
}
+
+ this.axis2xml = axis2xml;
+
deploymentEngine = new DeploymentEngine();
}
Modified: webservices/axis2/trunk/java/modules/core/test-resources/deployment/axis2.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test-resources/deployment/axis2.xml?rev=397263&r1=397262&r2=397263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test-resources/deployment/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/core/test-resources/deployment/axis2.xml Wed Apr 26 11:06:46 2006
@@ -1,6 +1,7 @@
<axisconfig name="AxisJava2.0">
<parameter name="hotdeployment" locked="false">true</parameter>
<parameter name="hotupdate" locked="false">true</parameter>
+ <parameter name="FavoriteColor">purple</parameter>
<messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java?rev=397263&r1=397262&r2=397263&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/deployment/DeploymentTotalTest.java Wed Apr 26 11:06:46 2006
@@ -18,6 +18,7 @@
import junit.framework.TestCase;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.Parameter;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.phaseresolver.PhaseException;
@@ -34,6 +35,12 @@
String filename = "./target/test-resources/deployment";
er = ConfigurationContextFactory.createConfigurationContextFromFileSystem(filename, null)
.getAxisConfiguration();
+
+ // OK, no exceptions. Now make sure we read the correct file...
+ Parameter param = er.getParameter("FavoriteColor");
+ assertNotNull("No FavoriteColor parameter in axis2.xml!", param);
+
+ assertEquals("purple", param.getValue());
}
}