Prepare for release candidate
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 7 Jul 2008 09:02:51 +0000 (09:02 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 7 Jul 2008 09:02:51 +0000 (09:02 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1374 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/AntSlcApplication.java
org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/AntSlcApplicationTestCase.java [new file with mode: 0644]
org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java [deleted file]
org.argeo.slc.agent/src/main/java/org/argeo/slc/cli/DefaultSlcRuntime.java

index b6c98ebbc3e44f6c571783fd190c05a0c8ce0872..525c276af4004c3853331c4401be6bd9d069ffc0 100644 (file)
@@ -112,11 +112,9 @@ public class AntSlcApplication {
 
                try {
                        if (rootDir != null)
-                               System.setProperty(AntConstants.ROOT_DIR_PROPERTY, rootDir
-                                               .getURL().toString());
+                               setSystemPropertyForRes(AntConstants.ROOT_DIR_PROPERTY, rootDir);
                        if (confDir != null)
-                               System.setProperty(AntConstants.CONF_DIR_PROPERTY, confDir
-                                               .getURL().toString());
+                               setSystemPropertyForRes(AntConstants.CONF_DIR_PROPERTY, confDir);
                        if (workDir != null)
                                System.setProperty(AntConstants.WORK_DIR_PROPERTY, workDir
                                                .getCanonicalPath());
@@ -151,6 +149,21 @@ public class AntSlcApplication {
                }
        }
 
+       /**
+        * Set property as an absolute file path if the resource can be located on
+        * the file system, or as an url.
+        */
+       private void setSystemPropertyForRes(String key, Resource res)
+                       throws IOException {
+               String value = null;
+               try {
+                       value = res.getFile().getCanonicalPath();
+               } catch (IOException e) {
+                       value = res.getURL().toString();
+               }
+               System.setProperty(key, value);
+       }
+
        protected ConfigurableApplicationContext createExecutionContext(
                        SlcExecution slcExecution) {
                try {
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/AntSlcApplicationTestCase.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/AntSlcApplicationTestCase.java
new file mode 100644 (file)
index 0000000..7b28123
--- /dev/null
@@ -0,0 +1,34 @@
+package org.argeo.slc.ant.unit;
+
+import junit.framework.TestCase;
+
+import org.argeo.slc.ant.AntExecutionContext;
+import org.argeo.slc.cli.DefaultSlcRuntime;
+import org.argeo.slc.runtime.SlcExecutionOutput;
+
+public abstract class AntSlcApplicationTestCase extends TestCase implements
+               SlcExecutionOutput<AntExecutionContext> {
+
+       /** To be overriden */
+       public void postExecution(AntExecutionContext executionContext) {
+
+       }
+
+       protected String getRootDir() {
+               return System.getProperty("slc.rootDir", "src/main/slc/root");
+       }
+
+       protected String getAbsoluteScript(String relative) {
+               return getRootDir() + '/' + relative;
+       }
+
+       protected void execute(String relativeScript) {
+               execute(relativeScript, null);
+       }
+
+       protected void execute(String relativeScript, String targets) {
+               new DefaultSlcRuntime().executeScript(
+                               getAbsoluteScript(relativeScript), targets, this);
+       }
+
+}
diff --git a/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java b/org.argeo.slc.agent/src/main/java/org/argeo/slc/ant/unit/SlcAntAppliTestCase.java
deleted file mode 100644 (file)
index 22050b4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.argeo.slc.ant.unit;
-
-import junit.framework.TestCase;
-
-import org.argeo.slc.ant.AntExecutionContext;
-import org.argeo.slc.cli.DefaultSlcRuntime;
-import org.argeo.slc.runtime.SlcExecutionOutput;
-
-public abstract class SlcAntAppliTestCase extends TestCase implements
-               SlcExecutionOutput<AntExecutionContext> {
-
-       /** To be overriden */
-       public void postExecution(AntExecutionContext executionContext) {
-
-       }
-
-       protected String getRootDir() {
-               return System.getProperty("slc.rootDir", "src/main/slc/root");
-       }
-
-       protected String getAbsoluteScript(String relative) {
-               return getRootDir() + '/' + relative;
-       }
-
-       protected void execute(String relativeScript) {
-               execute(relativeScript, null);
-       }
-
-       protected void execute(String relativeScript, String targets) {
-               new DefaultSlcRuntime().executeScript(
-                               getAbsoluteScript(relativeScript), targets, this);
-       }
-
-}
index 10e988cc262095c9d70e80ef73fcadd339569436..3596dd61c6411141406e4c6172d0e446e8419e86 100644 (file)
@@ -199,6 +199,8 @@ public class DefaultSlcRuntime {
                try {
                        Resource slcRootFile = currDir.createRelative(SLC_ROOT_FILE_NAME);
                        if (slcRootFile.exists()) {
+                               if (log.isDebugEnabled())
+                                       log.debug("Found SLC root file: " + slcRootFile);
                                return slcRootFile;
                        } else {
                                String currPath = currDir.getURL().getPath();