- Documentation
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 4 Nov 2007 15:48:51 +0000 (15:48 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 4 Nov 2007 15:48:51 +0000 (15:48 +0000)
- Override list
- Setting of the TestRun to use in slc.test Ant task

git-svn-id: https://svn.argeo.org/slc/trunk@695 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

59 files changed:
org.argeo.slc/javadoc.xml
org.argeo.slc/src/main/java/org/argeo/slc/ant/AntRegistryUtil.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/SlcAntConfig.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/SlcAntException.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/SlcProjectHelper.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/package.html
org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/AbstractSpringArg.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/AbstractSpringTask.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/OverrideArg.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/ant/structure/SAwareTask.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/structure/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/ant/test/SlcCloseTestResultTask.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/test/SlcTestTask.java
org.argeo.slc/src/main/java/org/argeo/slc/ant/test/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/SlcException.java
org.argeo.slc/src/main/java/org/argeo/slc/core/build/VersionDistributionId.java
org.argeo.slc/src/main/java/org/argeo/slc/core/build/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/DeployedSystem.java
org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/DeployedSystemId.java
org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/NumericDSId.java
org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/DefaultSRegistry.java
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/SimpleSElement.java
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/StructureElement.java
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/TreeSPath.java
org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/test/IncompatibleTestDataException.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/NumericTRId.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/SimpleResultPart.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/SimpleTestRun.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestReport.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestResult.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestResultId.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestResultListener.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestResultPart.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TestRun.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/TimeTestResultId.java [deleted file]
org.argeo.slc/src/main/java/org/argeo/slc/core/test/WritableTestRun.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/AsynchronousTreeTestResultListener.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/CompositeTreeTestDefinition.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/FullHtmlTreeReport.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/PartSubList.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/TreeTestResultLogger.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/TreeTestResultPersister.java
org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/dao/test/TestResultDao.java
org.argeo.slc/src/main/java/org/argeo/slc/dao/test/package.html [new file with mode: 0644]
org.argeo.slc/src/main/java/org/argeo/slc/hibernate/test/tree/TestResultDaoHibernate.java
org.argeo.slc/src/main/java/org/argeo/slc/hibernate/test/tree/package.html [new file with mode: 0644]
org.argeo.slc/src/test/java/org/argeo/slc/example/SimpleExampleTestDef.java
org.argeo.slc/src/test/java/org/argeo/slc/example/appli/ExampleAppli.java
org.argeo.slc/src/test/java/org/argeo/slc/example/junit/TestAntBuild.java
org.argeo.slc/src/test/slc/conf/slc.xml
org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml

index 990bb4617abbdae306e7987c19d5b98d093896ed..ccfaa6cf744c0d374f81344b3e6dc5e2a3f76e17 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <project default="javadoc">\r
 <target name="javadoc">\r
-<javadoc access="public" author="true" classpath="lib/commons-logging.jar;lib/ant-launcher.jar;lib/spring-2.0.6.jar;lib/ant.jar" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="org.argeo.slc.ant,org.argeo.slc.core.structure.tree,org.argeo.slc.core.test,org.argeo.slc.ant.test,org.argeo.slc.core.structure,org.argeo.slc.ant.spring,org.argeo.slc.ant.structure" source="1.5" sourcepath="src/test/java;src/main/java" splitindex="true" use="true" version="true"/>\r
+<javadoc access="public" author="true" classpath="lib/jta.jar;lib/commons-logging.jar;lib/ant-launcher.jar;lib/hibernate3.jar;lib/spring-2.0.6.jar;lib/commons-collections-2.1.1.jar;C:\eclipse\plugins\org.junit_3.8.2.v200706111738\junit.jar;lib/ant.jar;lib/commons-pool.jar;lib/commons-lang.jar;lib/dom4j-1.6.1.jar;lib/log4j-1.2.14.jar;lib/asm.jar;lib/hsqldb.jar;lib/commons-dbcp.jar;lib/cglib-2.1.3.jar;lib/antlr-2.7.6.jar;lib/asm-attrs.jar" destdir="doc" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="org.argeo.slc.core.structure.tree,org.argeo.slc.ant,org.argeo.slc.ant.test,org.argeo.slc.core,org.argeo.slc.ant.spring,org.argeo.slc.dao.test,org.argeo.slc.ant.structure,org.argeo.slc.core.deploy,org.argeo.slc.core.build,org.argeo.slc.core.test,org.argeo.slc.core.structure,org.argeo.slc.hibernate.test.tree,org.argeo.slc.core.test.tree" source="1.5" sourcepath="src/test/java;src/main/java" splitindex="true" use="true" version="true"/>\r
 </target>\r
 </project>\r
index 7b827935b02d94b558f7f7fafea230e190e985a6..872dd9cc1bd17432ff2b1ae076817810ce63e1d0 100644 (file)
@@ -2,7 +2,6 @@ package org.argeo.slc.ant;
 \r
 import java.io.File;\r
 import java.util.List;\r
-import java.util.Vector;\r
 \r
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
@@ -16,9 +15,10 @@ import org.argeo.slc.core.structure.StructureRegistry;
 public class AntRegistryUtil {\r
        private static Log log = LogFactory.getLog(AntRegistryUtil.class);\r
 \r
-       /** Read a structure registry from an Ant file without executing it. */\r
+       /** Reads a structure registry from an Ant file without executing it. */\r
        public static StructureRegistry readRegistry(File antFile) {\r
-\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Reads registry for Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -35,9 +35,11 @@ public class AntRegistryUtil {
                return registry;\r
        }\r
 \r
-       /** Execute only the active paths of the Ant file. */\r
+       /** Executes only the active paths of the Ant file. */\r
        public static void runActive(File antFile, List<StructurePath> activePaths) {\r
-\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Runs the " + activePaths.size()\r
+                                       + " provided active paths of Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -53,8 +55,10 @@ public class AntRegistryUtil {
                p.executeTarget(p.getDefaultTarget());\r
        }\r
 \r
-       /** Execute all paths of the default target of the Ant file. */\r
+       /** Executes all paths of the default target of the Ant file. */\r
        public static void runAll(File antFile) {\r
+               if (log.isDebugEnabled())\r
+                       log.debug("Runs all paths of Ant file " + antFile);\r
                Project p = new Project();\r
                p.setUserProperty("ant.file", antFile.getAbsolutePath());\r
                p.setBaseDir(antFile.getParentFile());\r
@@ -64,30 +68,4 @@ public class AntRegistryUtil {
                helper.parse(p, antFile);\r
                p.executeTarget(p.getDefaultTarget());\r
        }\r
-\r
-       public static void main(String[] args) {\r
-               File antFile = new File(\r
-                               "C:/dev/workspaces/default/org.argeo.slc/src/test/slc/root/Category1/SubCategory2/build.xml");\r
-               StructureRegistry registry = AntRegistryUtil.readRegistry(antFile);\r
-\r
-               StringBuffer buf = new StringBuffer("");\r
-\r
-               int count = 0;\r
-               List<StructurePath> activePaths = new Vector<StructurePath>();\r
-               for (StructurePath path : registry.listPaths()) {\r
-                       buf.append(path);\r
-                       if (count != 0 && count % 3 == 0) {\r
-                               // skip\r
-                       } else {\r
-                               activePaths.add(path);\r
-                               buf.append(" <");\r
-                       }\r
-                       buf.append('\n');\r
-                       count++;\r
-               }\r
-               log.info(buf);\r
-\r
-               runActive(antFile, activePaths);\r
-\r
-       }\r
 }\r
index 124aa0d216744d5fadb345dd3fe1583904ffb0c3..93502245d080a862c27304526d68c7156461de19 100644 (file)
@@ -3,6 +3,7 @@ package org.argeo.slc.ant;
 import java.io.File;\r
 import java.io.FileInputStream;\r
 import java.io.IOException;\r
+import java.util.Map;\r
 import java.util.Properties;\r
 import java.util.StringTokenizer;\r
 \r
@@ -10,7 +11,99 @@ import org.springframework.util.Log4jConfigurer;
 \r
 import org.apache.tools.ant.Project;\r
 \r
-/** Load reference to directories from an slcRoot.properties file */\r
+import org.argeo.slc.core.test.WritableTestRun;\r
+\r
+/**\r
+ * <p>\r
+ * Manager and initializer of the properties required by SLC Ant.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * All properties described here will get a value one way or another (see below\r
+ * for details)/ Each property will be accessible via Ant or Spring properties.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * The property <i>slc.rootFile</i> is set based on the location of the SLC\r
+ * root property file found in the directory structure of a called Ant file. The\r
+ * default name of this file is <b>slcRoot.properties</b> (can be set by\r
+ * {@link #setSlcRootFileName(String)}). <br>\r
+ * This property provides the absolute path to the unique SLC root property file\r
+ * which marks the root of an Ant SLC tree structure.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * The property <i>slc.rootDir</i> is inferred from <i>slc.rootFile</i> and\r
+ * provides a convenient shortcut to the root directory of the Ant files\r
+ * directory structure.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * A few directory and file related properties can be set in the SLC root\r
+ * property file (if they are not explicitly set their default values will be\r
+ * used):\r
+ * \r
+ * <table border="1" cellspacing="0">\r
+ * <tr>\r
+ * <th>Property</th>\r
+ * <th>Description</th>\r
+ * <th>Default</th>\r
+ * </tr>\r
+ * <tr>\r
+ * <td><i>slc.confDir</i></td>\r
+ * <td>Directory where to find the various configuration files of a given SLC\r
+ * Ant deployment</td>\r
+ * <td>${slc.rootDir}/../conf</td>\r
+ * </tr>\r
+ * <tr>\r
+ * <td><i>slc.workDir</i></td>\r
+ * <td>Directory where data can be retrieved or generated: build outputs, test\r
+ * inputs/outputs, test results, etc. The underlying directory structure is\r
+ * specified by the specific SLC application.</td>\r
+ * <td>${slc.rootDir}/../work</td>\r
+ * </tr>\r
+ * <tr>\r
+ * <td><i>slc.propertyFileNames</i></td>\r
+ * <td>Comma-separated list of the files names of the property files to load\r
+ * from the conf directory. Having various files allows to separate between SLC\r
+ * framework properties and properties specific to a given application built on\r
+ * top of SLC. All will be available across Ant and Spring.</td>\r
+ * <td>slc.properties</td>\r
+ * </tr>\r
+ * </table> <b>Note:</b> Only the properties above can be set in the SLC root\r
+ * properties file. All other properties should be defined in the registered\r
+ * conf files.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * Any property can be defined in the conf files defined in the SLC root\r
+ * properties file (see above). SLC expects some which will have defaults but\r
+ * can be overriden there. By convention they should be defined in the\r
+ * <b>slc.properties</b> file, while application specific properties should be\r
+ * defined in other conf files. This allows for a clean spearation between SLC\r
+ * and the applications built on top of it:\r
+ * \r
+ * <table border="1" cellspacing="0">\r
+ * <tr>\r
+ * <th>Property</th>\r
+ * <th>Description</th>\r
+ * <th>Default</th>\r
+ * </tr>\r
+ * <tr>\r
+ * <td><i>slc.applicationContext</i></td>\r
+ * <td>Path to the root Spring application context file used by SLC Ant.</td>\r
+ * <td>${slc.confDir}/applicationContext.xml</td>\r
+ * </tr>\r
+ * <tr>\r
+ * <td><i>slc.defaultTestRun</i></td>\r
+ * <td>Name of the {@link WritableTestRun} Spring bean that the\r
+ * <code>slc.test</code> task will use by default. This can be overridden when\r
+ * calling the task from Ant.</td>\r
+ * <td>defaultTestRun</td>\r
+ * </tr>\r
+ * </table>\r
+ * </p>\r
+ */\r
 public class SlcAntConfig {\r
        // SLC ROOT PROPERTIES\r
        public final static String ROOT_FILE_PROPERTY = "slc.rootFile";\r
@@ -32,15 +125,27 @@ public class SlcAntConfig {
        // SLC LOCAL PROPERTIES\r
        public static String DIR_DESCRIPTION_PROPERTY = "slc.dirDescription";\r
 \r
+       private String slcRootFileName = "slcRoot.properties";\r
+       private String slcLocalFileName = "slcLocal.properties";\r
+\r
        /**\r
-        * Retrieve all properties and set them as project user properties. Root\r
-        * properties (that is from slcRoot file) are added to System properties\r
-        * (e.g. in order to be used by Spring)\r
+        * Retrieves or infers all properties and set them as project user\r
+        * properties. All these properties will be set as project properties <b>if\r
+        * they had not been set as project properties before</b> (like by\r
+        * overriding through the standard Ant mechanisms).\r
+        * \r
+        * @param project\r
+        *            the Ant <code>Project</code> being run.\r
         */\r
-       public static void initProject(Project project, File slcRootFile) {\r
-               System.getProperties().putAll(project.getUserProperties());\r
-               System.setProperty(ROOT_FILE_PROPERTY, slcRootFile.getAbsolutePath());\r
-               Properties all = prepareAllProperties();\r
+       public void initProject(Project project) {\r
+               File projectBaseDir = project.getBaseDir();\r
+               File slcRootFile = findSlcRootFile(projectBaseDir);\r
+               if (slcRootFile == null) {\r
+                       throw new SlcAntException("Cannot find SLC root file");\r
+               }\r
+               // pass the project properties through the System properties\r
+               System.getProperties().putAll((Map<?, ?>) project.getUserProperties());\r
+               Properties all = prepareAllProperties(slcRootFile);\r
                for (Object o : all.keySet()) {\r
                        String key = o.toString();\r
                        if (project.getUserProperty(key) == null) {// not already set\r
@@ -49,19 +154,22 @@ public class SlcAntConfig {
                }\r
        }\r
 \r
-       public static Properties prepareAllProperties() {\r
+       /**\r
+        * Retrieves or infers all required properties.\r
+        * \r
+        * @param slcRootFile\r
+        *            the location of the SLC root file\r
+        * \r
+        * @return the prepared properties. Note that it also contains the System\r
+        *         and Ant properties which had previously been set.\r
+        */\r
+       protected Properties prepareAllProperties(File slcRootFile) {\r
                try {\r
                        Properties all = new Properties();\r
                        all.putAll(System.getProperties());\r
+                       all.put(ROOT_FILE_PROPERTY, slcRootFile.getCanonicalPath());\r
 \r
-                       if (all.getProperty(ROOT_FILE_PROPERTY) == null) {\r
-                               throw new RuntimeException("System Property "\r
-                                               + ROOT_FILE_PROPERTY + " has to be set.");\r
-                       }\r
-\r
-                       File slcRootFile = new File(all.getProperty(ROOT_FILE_PROPERTY))\r
-                                       .getAbsoluteFile();\r
-                       Properties rootProps = loadFile(slcRootFile.getAbsolutePath());\r
+                       Properties rootProps = loadFile(slcRootFile.getCanonicalPath());\r
 \r
                        final File confDir;\r
                        final File workDir;\r
@@ -97,8 +205,8 @@ public class SlcAntConfig {
                                        PROPERTY_FILE_NAMES_PROPERTY, "slc.properties"), ",");\r
                        while (st.hasMoreTokens()) {\r
                                String fileName = st.nextToken();\r
-                               properties.putAll(loadFile(confDir.getAbsolutePath() + File.separator\r
-                                               + fileName));\r
+                               properties.putAll(loadFile(confDir.getAbsolutePath()\r
+                                               + File.separator + fileName));\r
                        }\r
 \r
                        for (Object o : properties.keySet()) {\r
@@ -121,12 +229,11 @@ public class SlcAntConfig {
 \r
                        // Default log4j\r
                        if (all.getProperty("log4j.configuration") == null) {\r
-                               System.setProperty("log4j.configuration",confDir\r
+                               System.setProperty("log4j.configuration", confDir\r
                                                .getCanonicalPath()\r
-                                               + File.separator + "log4j.properties" );\r
+                                               + File.separator + "log4j.properties");\r
                                // TODO: fix dependency to log4j\r
-                               Log4jConfigurer.initLogging(confDir\r
-                                               .getCanonicalPath()\r
+                               Log4jConfigurer.initLogging(confDir.getCanonicalPath()\r
                                                + File.separator + "log4j.properties");\r
                        }\r
 \r
@@ -137,7 +244,8 @@ public class SlcAntConfig {
                }\r
        }\r
 \r
-       public static Properties loadFile(String path) {\r
+       /** Loads the content of a file as <code>Properties</code>. */\r
+       private Properties loadFile(String path) {\r
                Properties p = new Properties();\r
                try {\r
                        FileInputStream in = new FileInputStream(path);\r
@@ -149,4 +257,67 @@ public class SlcAntConfig {
                return p;\r
        }\r
 \r
+       /**\r
+        * Looks for a file named {@link #getSlcLocalFileName()} in the directory,\r
+        * loads it as properties file and return the value of the property\r
+        * {@link #DIR_DESCRIPTION_PROPERTY}.\r
+        */\r
+       public String getDescriptionForDir(File dir) {\r
+               String description = dir.getName();\r
+               File slcLocal = new File(dir.getPath() + File.separator\r
+                               + getSlcLocalFileName());\r
+               if (slcLocal.exists()) {\r
+                       Properties properties = loadFile(slcLocal.getAbsolutePath());\r
+                       description = properties.getProperty(\r
+                                       SlcAntConfig.DIR_DESCRIPTION_PROPERTY, description);\r
+               }\r
+               return description;\r
+       }\r
+\r
+       /**\r
+        * Recursively scans directories downwards until it find a file names as\r
+        * defined by {@link #getSlcRootFileName()}.\r
+        */\r
+       public File findSlcRootFile(File dir) {\r
+               for (File file : dir.listFiles()) {\r
+                       if (!file.isDirectory()\r
+                                       && file.getName().equals(getSlcRootFileName())) {\r
+                               return file;\r
+                       }\r
+               }\r
+\r
+               File parentDir = dir.getParentFile();\r
+               if (parentDir == null) {\r
+                       return null;// stop condition: not found\r
+               } else {\r
+                       return findSlcRootFile(parentDir);\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Gets the file name of the file marking the root directory, default being\r
+        * <i>slcRoot.properties</i>.\r
+        */\r
+       public String getSlcRootFileName() {\r
+               return slcRootFileName;\r
+       }\r
+\r
+       /** Sets the file name of the file marking the root directory. */\r
+       public void setSlcRootFileName(String slcRootFileName) {\r
+               this.slcRootFileName = slcRootFileName;\r
+       }\r
+\r
+       /**\r
+        * Gets the file name of the file containing directory specific properties,\r
+        * default being <i>slcLocal.properties</i>.\r
+        */\r
+       public String getSlcLocalFileName() {\r
+               return slcLocalFileName;\r
+       }\r
+\r
+       /** Sets the file name of the file containing directory specific properties. */\r
+       public void setSlcLocalFileName(String slcLocalFileName) {\r
+               this.slcLocalFileName = slcLocalFileName;\r
+       }\r
+\r
 }\r
index 70a8b5c68ea9e207a6177d48be07e238e6fc336f..dc7ebfda8a7001af97011a74a9808cb46c5724bf 100644 (file)
@@ -2,6 +2,7 @@ package org.argeo.slc.ant;
 \r
 import org.argeo.slc.core.SlcException;\r
 \r
+/** Base for all SLC Ant exceptions. */\r
 public class SlcAntException extends SlcException {\r
        static final long serialVersionUID = 1l;\r
 \r
index 07678c6ab1d16f2a4b6b9f619138605a076deab7..b0f9fabb013d78c9c298f53167079fe31265377b 100644 (file)
@@ -4,6 +4,7 @@ import java.io.File;
 import java.io.IOException;\r
 import java.io.InputStream;\r
 import java.util.List;\r
+import java.util.Map;\r
 import java.util.Properties;\r
 import java.util.Vector;\r
 \r
@@ -22,31 +23,32 @@ import org.argeo.slc.core.structure.StructureRegistry;
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 \r
 /**\r
- * Custom implementation of a <code>ProjectHelper</code> binding a Spring\r
+ * Custom implementation of an Ant <code>ProjectHelper</code> binding a Spring\r
  * application context and a structure registry with the Ant project.\r
  */\r
 public class SlcProjectHelper extends ProjectHelperImpl {\r
-       private static Log log ;\r
+       private static Log log;\r
 \r
+       /** The Ant reference to the Spring application context used. */\r
        public static String REF_ROOT_CONTEXT = "slcApplicationContext";\r
+       /** The Ant reference to the SLC structure registry used. */\r
        public static String REF_STRUCTURE_REGISTRY = "slcStructureRegistry";\r
-       public static String REF_PROJECT_PATH = "slcProjectPath";\r
-\r
-       private String slcRootFileName = "slcRoot.properties";\r
-       private String slcLocalFileName = "slcLocal.properties";\r
+       /** The Ant reference to the <code>TreePath</code> of the current project */\r
+       private static String REF_PROJECT_PATH = "slcProjectPath";\r
+       /**\r
+        * Resource path to the property file listing the SLC specific Ant tasks:\r
+        * /org/argeo/slc/ant/taskdefs.properties\r
+        */\r
+       private static String SLC_TASKDEFS_RESOURCE_PATH = "/org/argeo/slc/ant/taskdefs.properties";\r
 \r
        @Override\r
        public void parse(Project project, Object source) throws BuildException {\r
 \r
-               // look for root file\r
-               File projectBaseDir = project.getBaseDir();\r
-               File slcRootFile = findSlcRootFile(projectBaseDir);\r
-               if (slcRootFile == null) {\r
-                       throw new SlcAntException("Cannot find SLC root file");\r
-               }\r
-               SlcAntConfig.initProject(project, slcRootFile);\r
-               \r
-               if(log == null){\r
+               // initialize config\r
+               SlcAntConfig slcAntConfig = new SlcAntConfig();\r
+               slcAntConfig.initProject(project);\r
+\r
+               if (log == null) {\r
                        // log4j is initialized only now\r
                        log = LogFactory.getLog(SlcProjectHelper.class);\r
                }\r
@@ -54,7 +56,7 @@ public class SlcProjectHelper extends ProjectHelperImpl {
 \r
                // init Spring application context\r
                initSpringContext(project);\r
-               \r
+\r
                // init structure registry\r
                DefaultSRegistry registry = new DefaultSRegistry();\r
                project.addReference(REF_STRUCTURE_REGISTRY, registry);\r
@@ -63,13 +65,15 @@ public class SlcProjectHelper extends ProjectHelperImpl {
                super.parse(project, source);\r
 \r
                // create structure root\r
-               registerProjectAndParents(project);\r
+               registerProjectAndParents(project, slcAntConfig);\r
 \r
                addSlcTasks(project);\r
 \r
        }\r
 \r
-       private void registerProjectAndParents(Project project) {\r
+       /** Creates the tree-based structure for this project. */\r
+       private void registerProjectAndParents(Project project,\r
+                       SlcAntConfig slcAntConfig) {\r
                StructureRegistry registry = (StructureRegistry) project\r
                                .getReference(REF_STRUCTURE_REGISTRY);\r
                File rootDir = new File(project\r
@@ -82,32 +86,27 @@ public class SlcProjectHelper extends ProjectHelperImpl {
                do {\r
                        dirs.add(currentDir);\r
                        currentDir = currentDir.getParentFile();\r
-                       log.trace("List " + currentDir);\r
+                       if (log.isTraceEnabled())\r
+                               log.trace("List " + currentDir);\r
                } while (!currentDir.equals(rootDir.getParentFile()));\r
 \r
-               TreeSPath currPath = null;\r
+               // first path is root dir (because of previous algorithm)\r
+               TreeSPath currPath = TreeSPath.createRootPath(rootDir.getName());\r
                for (int i = dirs.size() - 1; i >= 0; i--) {\r
                        File dir = dirs.get(i);\r
 \r
-                       String description = dir.getName();\r
-                       File slcLocal = new File(dir.getPath() + File.separator\r
-                                       + slcLocalFileName);\r
-                       if (slcLocal.exists()) {\r
-                               Properties properties = SlcAntConfig.loadFile(slcLocal\r
-                                               .getAbsolutePath());\r
-                               description = properties\r
-                                               .getProperty(SlcAntConfig.DIR_DESCRIPTION_PROPERTY);\r
+                       // retrieves description for this path\r
+                       final String description;\r
+                       if (i == 0) {// project itself\r
+                               description = project.getDescription() != null ? project\r
+                                               .getDescription() : "";\r
                        } else {\r
-                               if (i == 0) {// project it self\r
-                                       description = project.getDescription() != null ? project\r
-                                                       .getDescription() : "";\r
-                               }\r
+                               description = slcAntConfig.getDescriptionForDir(dir);\r
                        }\r
                        SimpleSElement element = new SimpleSElement(description);\r
 \r
-                       if (dir.equals(rootDir)) {\r
-                               currPath = TreeSPath.createRootPath(rootDir.getName());\r
-                       } else {\r
+                       // creates and register path\r
+                       if (!dir.equals(rootDir)) {// already set\r
                                currPath = currPath.createChild(dir.getName());\r
                        }\r
                        registry.register(currPath, element);\r
@@ -115,40 +114,28 @@ public class SlcProjectHelper extends ProjectHelperImpl {
                project.addReference(REF_PROJECT_PATH, currPath);\r
        }\r
 \r
-       /** Get the path of a project (root). */\r
+       /** Gets the path of a project (root). */\r
        public static TreeSPath getProjectPath(Project project) {\r
                return (TreeSPath) project.getReference(REF_PROJECT_PATH);\r
        }\r
 \r
-       private File findSlcRootFile(File dir) {\r
-               for (File file : dir.listFiles()) {\r
-                       if (!file.isDirectory() && file.getName().equals(slcRootFileName)) {\r
-                               return file;\r
-                       }\r
-               }\r
-\r
-               File parentDir = dir.getParentFile();\r
-               if (parentDir == null) {\r
-                       return null;// stop condition: not found\r
-               } else {\r
-                       return findSlcRootFile(parentDir);\r
-               }\r
-       }\r
-\r
+       /** Initializes the Spring application context. */\r
        private void initSpringContext(Project project) {\r
-               System.getProperties().putAll(project.getProperties());\r
+               System.getProperties().putAll((Map<?, ?>) project.getProperties());\r
                String acPath = project\r
                                .getUserProperty(SlcAntConfig.APPLICATION_CONTEXT_PROPERTY);\r
-               AbstractApplicationContext context = new FileSystemXmlApplicationContext(acPath);\r
+               AbstractApplicationContext context = new FileSystemXmlApplicationContext(\r
+                               acPath);\r
                context.registerShutdownHook();\r
                project.addReference(REF_ROOT_CONTEXT, context);\r
        }\r
 \r
+       /** Loads the SLC specific Ant tasks. */\r
        private void addSlcTasks(Project project) {\r
                Properties taskdefs = new Properties();\r
                try {\r
                        InputStream in = project.getClass().getResourceAsStream(\r
-                                       "/org/argeo/slc/ant/taskdefs.properties");\r
+                                       SLC_TASKDEFS_RESOURCE_PATH);\r
                        taskdefs.load(in);\r
                        in.close();\r
                } catch (IOException e) {\r
index 14a54d1af121a5ce2475a703e7f179607a205537..9f36fb1bf5373af5bcf0aa4f4c310b853029bf77 100644 (file)
@@ -2,13 +2,37 @@
 <head></head>\r
 <body>\r
 Bases classes for SLC Ant extensions.\r
-<h2>Usage of SLC Ant extensions</h2>\r
-Add:\r
-<pre>\r
-&lt;taskdef resource="org/argeo/slc/ant/taskdefs.properties" /&gt;\r
-</pre>\r
-at the beginning of your file.\r
+<h2>Introduction</h2>\r
+SLC Ant allows to integrate Ant and Spring in order to run an\r
+application based on top of SLC. Sequence of actions are defined in Ant\r
+files with specific Ant tasks referencing Spring beans implementing the\r
+SLC interfaces. The properties of these beans can be overridden at\r
+runtime in the Ant scripts.\r
+<br />\r
+SLC Ant also provides a tree-based implementation of the SLC structure\r
+which allows to uniquely identify and reference the various actions.\r
 \r
+<h2>Installation</h2>\r
+The structure will be first defined by the directory tree where the Ant\r
+files are stored. In order to define the root of this tree, you need to\r
+place in the root directory an\r
+<b>SLC Ant root file</b>\r
+(default name: slcRoot.properties).\r
+<br />\r
+In this root file you can define a configuration directory and a work\r
+directory (default values are provided if they are not explicitly set).\r
+<br />\r
+Additional properties can then be defined in files stored under the\r
+configuration directory.\r
+<br />\r
+For details about the configuration and the various properties, please\r
+refer to {@link org.argeo.slc.ant.SlcAntConfig}.\r
+\r
+<h2>Running SLC Ant</h2>\r
+SLC Ant can be run either via pure Ant scripts or programmatically using\r
+{@link org.argeo.slc.ant.AntRegistryUtil}. In both cases, make sure that\r
+SLC and its dependencies are in the classpath (Spring (always), logging\r
+system such as log4j, Hibernate, etc.).\r
 \r
 </body>\r
 </html>
\ No newline at end of file
index 7865241b4093d268a88c8d1dd60f08e53c4597c4..6c64235986740357cfff57a52f818b13fabe5ea2 100644 (file)
@@ -31,7 +31,8 @@ public abstract class AbstractSpringArg extends DataType {
        }\r
 \r
        /**\r
-        * Retrieve the instance of the bean. <b>The value is cached.</b>\r
+        * Retrieve the instance of the bean, and sets the overriden properties.\r
+        * <b>The value is cached.</b>\r
         */\r
        public Object getBeanInstance() {\r
                if (beanInstance == null) {\r
index c732fd074384c7364fde36c5207865674dc0b71a..3e8cc8b1366df06133f3ac80514ec3784c8493a0 100644 (file)
@@ -6,10 +6,10 @@ import org.apache.tools.ant.Task;
 \r
 import org.argeo.slc.ant.SlcProjectHelper;\r
 \r
-/** Abstract Ant task providing access to a Spring context.*/\r
+/** Abstract Ant task providing access to a Spring context. */\r
 public abstract class AbstractSpringTask extends Task {\r
 \r
-       /** Gets the related Spring context.*/\r
+       /** Gets the related Spring context. */\r
        protected ApplicationContext getContext() {\r
                return (ApplicationContext) getProject().getReference(\r
                                SlcProjectHelper.REF_ROOT_CONTEXT);\r
index 80eb4731b388390a90f67222d034d2f63cb55197..14464ff20e00af16bc0646ed51ae5a575cbe4c5e 100644 (file)
@@ -1,13 +1,17 @@
 package org.argeo.slc.ant.spring;\r
 \r
+import java.util.List;\r
+import java.util.Vector;\r
+\r
 import org.apache.tools.ant.BuildException;\r
 \r
 /** Ant type allowing to override bean properties. */\r
 public class OverrideArg extends AbstractSpringArg {\r
        private String name;\r
        private Object value;\r
+       private OverrideList overrideList;\r
 \r
-       /** The nbame of the property to override. */\r
+       /** The name of the property to override. */\r
        public String getName() {\r
                return name;\r
        }\r
@@ -18,22 +22,32 @@ public class OverrideArg extends AbstractSpringArg {
 \r
        /** Both value and bean cannot be set. */\r
        public void setValue(String value) {\r
-               if (getBean() != null) {\r
-                       throw new BuildException(\r
-                                       "Cannot set both 'bean' and 'value' attributes.");\r
+               if (getBean() != null || overrideList != null) {\r
+                       throw new BuildException("Value already set.");\r
                }\r
                this.value = value;\r
        }\r
 \r
        @Override\r
        public void setBean(String bean) {\r
-               if (value != null) {\r
-                       throw new BuildException(\r
-                                       "Cannot set both 'bean' and 'value' attributes.");\r
+               if (value != null || overrideList != null) {\r
+                       throw new BuildException("Value already set.");\r
                }\r
                super.setBean(bean);\r
        }\r
 \r
+       public OverrideList createList() {\r
+               if (value != null || getBean() != null) {\r
+                       throw new BuildException("Value already set.");\r
+               }\r
+               if (overrideList == null) {\r
+                       overrideList = new OverrideList();\r
+               } else {\r
+                       throw new BuildException("Only one list can be declared");\r
+               }\r
+               return overrideList;\r
+       }\r
+\r
        /**\r
         * The related object: the value if a value had been set or an instance of\r
         * the bean if not.\r
@@ -43,9 +57,29 @@ public class OverrideArg extends AbstractSpringArg {
                        return value;\r
                } else if (getBean() != null) {\r
                        return getBeanInstance();\r
+               } else if (overrideList != null) {\r
+                       return overrideList.getAsObjectList();\r
                } else {\r
                        throw new BuildException("Value or bean not set.");\r
                }\r
        }\r
 \r
+       /** List of overrides */\r
+       protected class OverrideList {\r
+               private List<OverrideArg> list = new Vector<OverrideArg>();\r
+\r
+               public OverrideArg createOverride() {\r
+                       OverrideArg overrideArg = new OverrideArg();\r
+                       list.add(overrideArg);\r
+                       return overrideArg;\r
+               }\r
+\r
+               public List<Object> getAsObjectList() {\r
+                       List<Object> objectList = new Vector<Object>();\r
+                       for (OverrideArg arg : list) {\r
+                               objectList.add(arg.getObject());\r
+                       }\r
+                       return objectList;\r
+               }\r
+       }\r
 }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/ant/spring/package.html
new file mode 100644 (file)
index 0000000..6d141d9
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Integration of Spring in Ant.\r
+</body>\r
+</html>
\ No newline at end of file
index e0bce6731b818cb5345fe60178abbbaf7f9a1f78..3f4d35864abd8017f3ac0629caff3ec8fd9ae99c 100644 (file)
@@ -38,6 +38,10 @@ public abstract class SAwareTask extends AbstractSpringTask implements
                }\r
        }\r
 \r
+       /**\r
+        * Includes this arg in the checks for propagation of sstructure related\r
+        * information.\r
+        */\r
        protected void addSAwareArg(AbstractSpringArg arg) {\r
                sAwareArgs.add(arg);\r
        }\r
@@ -100,6 +104,7 @@ public abstract class SAwareTask extends AbstractSpringTask implements
                return projectPath.createChild(target.getName());\r
        }\r
 \r
+       /** Gets the path under which this task is registered. */\r
        public TreeSPath getPath() {\r
                return path;\r
        }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/structure/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/ant/structure/package.html
new file mode 100644 (file)
index 0000000..4210b9b
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Integration of SLC structure in Ant.\r
+</body>\r
+</html>
\ No newline at end of file
index d91c5389804600247512c307eb4e36ee6fde846e..694bd5b4c968e599f5f6019fa4f10cee3a0259f4 100644 (file)
@@ -6,10 +6,12 @@ import org.argeo.slc.core.structure.StructureRegistry;
 import org.argeo.slc.core.test.TestReport;\r
 import org.argeo.slc.core.test.TestResult;\r
 \r
+/** Ant tasks closing a given result, and optionally generating a report. */\r
 public class SlcCloseTestResultTask extends SAwareTask {\r
        private String result;\r
        private String report;\r
 \r
+       @Override\r
        public void executeActions(String mode) {\r
                if (!mode.equals(StructureRegistry.READ)) {\r
                        TestResult testResult = (TestResult) getContext().getBean(result);\r
@@ -27,10 +29,12 @@ public class SlcCloseTestResultTask extends SAwareTask {
                }\r
        }\r
 \r
+       /** Sets the bean name of the result to close. */\r
        public void setResult(String bean) {\r
                this.result = bean;\r
        }\r
 \r
+       /** Sets the bean name of the report to generate. */\r
        public void setReport(String report) {\r
                this.report = report;\r
        }\r
index 93674a01295cee24e8e98f333cbc44c469401dbe..1d5943f5868f0cf6a8c92dc74b049f4cd4c253a6 100644 (file)
@@ -16,7 +16,9 @@ import org.argeo.slc.core.test.WritableTestRun;
 \r
 /** Ant task wrapping a test run. */\r
 public class SlcTestTask extends SAwareTask {\r
-       Log log = LogFactory.getLog(SlcTestTask.class);\r
+       private Log log = LogFactory.getLog(SlcTestTask.class);\r
+\r
+       private String testRunBean = null;\r
 \r
        private TestDefinitionArg testDefinitionArg;\r
        private TestDataArg testDataArg;\r
@@ -25,27 +27,33 @@ public class SlcTestTask extends SAwareTask {
 \r
        @Override\r
        public void executeActions(String mode) throws BuildException {\r
+               final String testRunBeanT;\r
+               if (testRunBean != null) {\r
+                       testRunBeanT = testRunBean;\r
+               } else {\r
+                       testRunBeanT = getProject().getUserProperty(\r
+                                       SlcAntConfig.DEFAULT_TEST_RUN_PROPERTY);\r
+               }\r
                WritableTestRun testRun = (WritableTestRun) getContext().getBean(\r
-                               getProject().getUserProperty(\r
-                                               SlcAntConfig.DEFAULT_TEST_RUN_PROPERTY));\r
+                               testRunBeanT);\r
 \r
-               // set overriden references\r
-               if (testDataArg != null){\r
+               // set overridden references\r
+               if (testDataArg != null) {\r
                        testRun.setTestData(testDataArg.getTestData());\r
                        log.trace("Overrides test data");\r
                }\r
-               \r
-               if (testDefinitionArg != null){\r
+\r
+               if (testDefinitionArg != null) {\r
                        testRun.setTestDefinition(testDefinitionArg.getTestDefinition());\r
                        log.trace("Overrides test definition");\r
                }\r
-               \r
-               if (deployedSystemArg != null){\r
+\r
+               if (deployedSystemArg != null) {\r
                        testRun.setDeployedSystem(deployedSystemArg.getDeployedSystem());\r
                        log.trace("Overrides deployed system");\r
                }\r
-               \r
-               if (testResultArg != null){\r
+\r
+               if (testResultArg != null) {\r
                        testRun.setTestResult(testResultArg.getTestResult());\r
                        log.trace("Overrides test result");\r
                }\r
@@ -60,6 +68,15 @@ public class SlcTestTask extends SAwareTask {
                testRun.execute();\r
        }\r
 \r
+       /**\r
+        * The bean name of the test run to use. If not set the default is used.\r
+        * \r
+        * @see SlcAntConfig\r
+        */\r
+       public void setTestRun(String testRunBean) {\r
+               this.testRunBean = testRunBean;\r
+       }\r
+\r
        public TestDefinitionArg createTestDefinition() {\r
                testDefinitionArg = new TestDefinitionArg();\r
                // only test definitions can add to path\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/ant/test/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/ant/test/package.html
new file mode 100644 (file)
index 0000000..179159b
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Integration of SLC Test in Ant.\r
+</body>\r
+</html>
\ No newline at end of file
index 8d9514ba781c3879901bc984edda6b7139b05ed6..2cb303d7fd3694d5e91230cd9f3d56de5de89880 100644 (file)
@@ -1,6 +1,6 @@
 package org.argeo.slc.core;\r
 \r
-/** Basis for all SLC exceptions.*/\r
+/** Basis for all SLC exceptions. This is an unchecked exception. */\r
 public class SlcException extends RuntimeException {\r
        static final long serialVersionUID = 1l;\r
 \r
index 44af89451030f37aaa6dbb109994ece72dd570b8..27ac020b3569f3cb9d68a2ee642617272ee5ed45 100644 (file)
@@ -2,7 +2,19 @@ package org.argeo.slc.core.build;
 \r
 import java.util.StringTokenizer;\r
 \r
-\r
+/**\r
+ * <p>\r
+ * An implementation of the distribution id using the standard\r
+ * Major.Minor.Release notation. And additional arbitrary string can also be\r
+ * added.\r
+ * </p>\r
+ * \r
+ * <p>\r
+ * <b>Examples:</b><br>\r
+ * 0.2.6<br>\r
+ * 2.4.12.RC1\r
+ * </p>\r
+ */\r
 public class VersionDistributionId implements DistributionId {\r
 \r
        private Integer major;\r
@@ -10,6 +22,7 @@ public class VersionDistributionId implements DistributionId {
        private Integer release;\r
        private String additional;\r
 \r
+       /** Parse the provided string in order to set the various components. */\r
        public void setVersionString(String str) {\r
                StringTokenizer st = new StringTokenizer(str, ".");\r
                if (st.hasMoreTokens())\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/build/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/build/package.html
new file mode 100644 (file)
index 0000000..5da2052
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+SLC Build: building of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
index 250c2a498db0eab7b73f7b10553d04c2825c978e..ccec874f90651f524962a3270fe7a4701444b6d9 100644 (file)
@@ -1,6 +1,6 @@
 package org.argeo.slc.core.deploy;\r
 \r
-/** An instance of a software system.*/\r
+/** An instance of a software system. */\r
 public interface DeployedSystem {\r
        public DeployedSystemId getDeployedSystemId();\r
 }\r
index bddb81d9f16b1daa4141a186b4ef512896fb430b..43f5f6ac540d7a255e03447686f60e54d4d076aa 100644 (file)
@@ -2,7 +2,7 @@ package org.argeo.slc.core.deploy;
 \r
 import org.argeo.slc.core.build.DistributionId;\r
 \r
-/** The id uniquely identifying a deployed system.*/\r
+/** The id uniquely identifying a deployed system. */\r
 public interface DeployedSystemId {\r
        public DistributionId getDistributionId();\r
 }\r
index 88ae6d7b56d9260b1327cace39650073bb954ae0..494fc8a77fca54cd0463bab76d6477f6eb51fb2a 100644 (file)
@@ -2,6 +2,10 @@ package org.argeo.slc.core.deploy;
 \r
 import org.argeo.slc.core.build.DistributionId;\r
 \r
+/**\r
+ * A basic implementation of a deployed system id, based on a long value and a\r
+ * reference to a distribution id.\r
+ */\r
 public class NumericDSId implements DeployedSystemId {\r
 \r
        private Long value;\r
@@ -33,5 +37,4 @@ public class NumericDSId implements DeployedSystemId {
                return value.toString();\r
        }\r
 \r
-       \r
 }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/deploy/package.html
new file mode 100644 (file)
index 0000000..f3a4c5b
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+SLC Deploy: deployment of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/package.html
new file mode 100644 (file)
index 0000000..db808c8
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Common classes of teh SLC framework.\r
+</body>\r
+</html>
\ No newline at end of file
index ff797a939f41da04c17e8399c30ec4aa07ccce28..84814f3077cbe46bdcd8e2b78f805ebb08c1254e 100644 (file)
@@ -6,7 +6,7 @@ import java.util.Vector;
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
 \r
-/** Default implementation of a <code>StructureRegistry</code>.*/\r
+/** Default implementation of a <code>StructureRegistry</code>. */\r
 public class DefaultSRegistry implements StructureRegistry {\r
        private static Log log = LogFactory.getLog(DefaultSRegistry.class);\r
 \r
@@ -24,19 +24,19 @@ public class DefaultSRegistry implements StructureRegistry {
                return new Vector<StructurePath>(paths);\r
        }\r
 \r
-       public void register(StructurePath path,StructureElement element) {\r
+       public void register(StructurePath path, StructureElement element) {\r
                StructureElement treeSElement = element;\r
                elements.add(treeSElement);\r
-               paths.add( path);\r
+               paths.add(path);\r
                log.debug("Registered " + path + " (desc: '"\r
                                + treeSElement.getDescription() + "', position: "\r
                                + elements.size() + ")");\r
        }\r
 \r
-//     public void register(StructurePath path,StructureAware structureAware) {\r
-//             register(path,structureAware.getElement());\r
-//             structureAware.onRegister(this,path);\r
-//     }\r
+       // public void register(StructurePath path,StructureAware structureAware) {\r
+       // register(path,structureAware.getElement());\r
+       // structureAware.onRegister(this,path);\r
+       // }\r
 \r
        public StructureElement getElement(StructurePath path) {\r
                int index = paths.indexOf(path);\r
index 7e6023a3dc1174620b39b54bc597edc853ec6d9e..12c65d5500d6fc959a1bf3e11f894375dd4faa3f 100644 (file)
@@ -3,22 +3,21 @@ package org.argeo.slc.core.structure;
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 \r
 /**\r
- * Implementation of <code>StructureElement</code> for tree based registries,\r
- * using <code>TreeSPath</code>\r
+ * Basic implementation of <code>StructureElement</code>.\r
  * \r
  * @see TreeSPath\r
  */\r
 public class SimpleSElement implements StructureElement {\r
        private String description;\r
 \r
-       public SimpleSElement(String description){\r
+       public SimpleSElement(String description) {\r
                this.description = description;\r
        }\r
-       \r
-       public SimpleSElement(String description, String defaultDescription){\r
-               this(description!=null?description:defaultDescription);\r
+\r
+       public SimpleSElement(String description, String defaultDescription) {\r
+               this(description != null ? description : defaultDescription);\r
        }\r
-       \r
+\r
        public String getDescription() {\r
                return description;\r
        }\r
index 708fbc74ec526a9102a030e24df16be62d7c718b..d842839b2dcd809717357a97c7d4dee1fae01fc9 100644 (file)
@@ -1,6 +1,9 @@
 package org.argeo.slc.core.structure;\r
 \r
-/** Atomic element holding the reference to the element which is structured. */\r
+/**\r
+ * Atomic element holding metadata such as description about the element which\r
+ * registered.\r
+ */\r
 public interface StructureElement {\r
        /** Description of this element. */\r
        public String getDescription();\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/structure/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/structure/package.html
new file mode 100644 (file)
index 0000000..11138fd
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+SLC structure framework allowing to uniquely reference actions.\r
+</body>\r
+</html>
\ No newline at end of file
index daa160626c5ad73336429da3abe5ce5a35bf195f..37d615f9af9d7ea7387fad8138a737eea01cc8d1 100644 (file)
@@ -9,8 +9,6 @@ import org.argeo.slc.core.structure.StructureRegistry;
 \r
 /**\r
  * Path for tree based <code>StructureRegistry</code> implementations.\r
- * \r
- * @see TreeSRegistry\r
  */\r
 public class TreeSPath implements StructurePath, Comparable<StructurePath> {\r
        /** Default character to use a separator: #. */\r
@@ -24,8 +22,8 @@ public class TreeSPath implements StructurePath, Comparable<StructurePath> {
                String parentStr = parent != null ? parent.getAsUniqueString() : "";\r
                return parentStr + separator + name;\r
        }\r
-       \r
-       public void setAsUniqueString(String str){\r
+\r
+       public void setAsUniqueString(String str) {\r
                TreeSPath twin = parseToCreatePath(str, getSeparator());\r
                name = twin.name;\r
                parent = twin.parent;\r
@@ -78,10 +76,10 @@ public class TreeSPath implements StructurePath, Comparable<StructurePath> {
                return currPath;\r
        }\r
 \r
-       public List<TreeSPath> listChildren(StructureRegistry registry){\r
+       public List<TreeSPath> listChildren(StructureRegistry registry) {\r
                return listChildrenPaths(registry, this);\r
        }\r
-       \r
+\r
        public static List<TreeSPath> listChildrenPaths(StructureRegistry registry,\r
                        TreeSPath path) {\r
                List<TreeSPath> paths = new Vector<TreeSPath>();\r
@@ -113,5 +111,4 @@ public class TreeSPath implements StructurePath, Comparable<StructurePath> {
                return getAsUniqueString().compareTo(o.getAsUniqueString());\r
        }\r
 \r
-       \r
 }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/package.html
new file mode 100644 (file)
index 0000000..a2a51e4
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Tree-based implementation of the SLC structure framework.\r
+</body>\r
+</html>
\ No newline at end of file
index a964c836d4586512c95403dc617a9925463a56b0..db4184d05166a53ba355fe00d20d4570be23bb70 100644 (file)
@@ -3,7 +3,7 @@ package org.argeo.slc.core.test;
 import org.argeo.slc.core.SlcException;\r
 \r
 /**\r
- * Excception to throw when a test definition cannot interpret the provided tets\r
+ * Exception to throw when a test definition cannot interpret the provided test\r
  * data.\r
  */\r
 public class IncompatibleTestDataException extends SlcException {\r
index b3654dc0527f8758c6a2b7d77c80d8ec700fa0fe..185d200e3a77405f3bf832cd7188a241dfc4ced5 100644 (file)
@@ -2,20 +2,27 @@ package org.argeo.slc.core.test;
 \r
 import org.argeo.slc.core.deploy.DeployedSystemId;\r
 \r
+/**\r
+ * Basic implementation of test run id based on a long value and a reference to\r
+ * a deployed system id.\r
+ */\r
 public class NumericTRId implements TestResultId {\r
        /** For ORM */\r
        private Long tid;\r
 \r
        private Long value;\r
        private DeployedSystemId deployedSystemId;\r
-       \r
+\r
+       /**\r
+        * Initializes the long value with the current time (based on\r
+        * <code>java.lang.System.currentTimeMillis()</code>).\r
+        */\r
        public void init() {\r
                if (getValue() == null) {\r
                        setValue(System.currentTimeMillis());\r
                }\r
        }\r
 \r
-\r
        public Long getValue() {\r
                return value;\r
        }\r
@@ -49,7 +56,5 @@ public class NumericTRId implements TestResultId {
        void setTid(Long tid) {\r
                this.tid = tid;\r
        }\r
-       \r
-       \r
 \r
 }\r
index 62fd229fc112de6b9f23ce4ca7a87b15cf1e0f12..19fd2d5c275d280941a6290a79dcff9429bb41ec 100644 (file)
@@ -1,14 +1,32 @@
 package org.argeo.slc.core.test;\r
 \r
+/**\r
+ * <p>\r
+ * Basic implementation of a result part, implementing the standard three status\r
+ * approach for test results.\r
+ * </p>\r
+ * <p>\r
+ * <ul>\r
+ * <li>{@link #PASSED}: the test succeeded</li>\r
+ * <li>{@link #FAILED}: the test could run, but did not reach the expected\r
+ * result</li>\r
+ * <li>{@link #ERROR}: an error during the test run prevented to get a\r
+ * significant information on the tested system.</li>\r
+ * </ul>\r
+ * </p>\r
+ */\r
 public class SimpleResultPart implements TestResultPart {\r
 \r
+       /** The flag for a passed test: 1 */\r
        public final static int PASSED = 1;\r
+       /** The flag for a failed test: 2 */\r
        public final static int FAILED = 2;\r
+       /** The flag for a test which could not properly run because of an error: 3 */\r
        public final static int ERROR = 3;\r
 \r
        /** For ORM */\r
        private Long tid;\r
-       \r
+\r
        private Integer status;\r
        private String message;\r
        private Throwable exception;\r
index da6e945c49328774a3bcbec568b96743dab6e88d..9cb14ac04bda997be129ebecdd40309b8dc8598c 100644 (file)
@@ -2,16 +2,21 @@ package org.argeo.slc.core.test;
 \r
 import org.argeo.slc.core.deploy.DeployedSystem;\r
 \r
+/**\r
+ * A basic bean implementation of a <code>WritableTestRun</code>, holding\r
+ * references to the various parts of a test run.\r
+ */\r
 public class SimpleTestRun implements WritableTestRun {\r
        private DeployedSystem deployedSystem;\r
        private TestData testData;\r
        private TestDefinition testDefinition;\r
        private TestResult testResult;\r
 \r
-       public void execute(){\r
+       /** Executes the underlying test definition. */\r
+       public void execute() {\r
                testDefinition.execute(this);\r
        }\r
-       \r
+\r
        public DeployedSystem getDeployedSystem() {\r
                return deployedSystem;\r
        }\r
index 51a97c9d89674da2bf55a8a923dea0cef122d149..8256e8644dae3594aa2c8ed19fd8262f45fd5ff5 100644 (file)
@@ -1,5 +1,10 @@
 package org.argeo.slc.core.test;\r
 \r
+/**\r
+ * A report that can be generated based on a given test result. <b>This\r
+ * interface may change in the future.</b>\r
+ */\r
 public interface TestReport {\r
+       /** Performs the actions necessary to generate a report. */\r
        public void generateTestReport(TestResult result);\r
 }\r
index ec6b6babb27bbea118f74c1ada19fbcd6c5f834a..5d6e3421f075f99c937325c1b4daaaf28387ce65 100644 (file)
@@ -2,7 +2,15 @@ package org.argeo.slc.core.test;
 \r
 /** The result of a test */\r
 public interface TestResult {\r
+       /** Gets the id of the related test result. */\r
        public TestResultId getTestResultId();\r
+\r
+       /** Adds a part of the result. */\r
        public void addResultPart(TestResultPart part);\r
+\r
+       /**\r
+        * Marks that the collection of test results is completed and free the\r
+        * related resources (also closing listeners).\r
+        */\r
        public void close();\r
 }\r
index 8c9425399361a30b652e31d94fbd60b6e1e9a7e2..9440287a4144e7dd420be027e7f264134498a53f 100644 (file)
@@ -2,8 +2,9 @@ package org.argeo.slc.core.test;
 \r
 import org.argeo.slc.core.deploy.DeployedSystemId;\r
 \r
-/** The unique id referencing a test result.*/\r
+/** The unique id referencing a test result. */\r
 public interface TestResultId {\r
+       /** Gets the id of the related deployed system. */\r
        public DeployedSystemId getDeployedSystemId();\r
-       \r
+\r
 }\r
index adab823cf33a86bb99869802eea9865c3107847e..10b296448555f3b583477903613f4b89a863f2d7 100644 (file)
@@ -1,7 +1,11 @@
 package org.argeo.slc.core.test;\r
 \r
+/** Listener to the operations on a test result. */\r
 public interface TestResultListener {\r
+       /** Notified when a part was added to a test result. */\r
        public void resultPartAdded(TestResult testResult,\r
                        TestResultPart testResultPart);\r
+\r
+       /** Stops listening and release the related resources. */\r
        public void close();\r
 }\r
index ca2a2c739ae1c3f721b0d094ec81b76bdca5c677..ecac72f72a3e5a72bf7e4caa6fe312d4cf806c0f 100644 (file)
@@ -1,5 +1,10 @@
 package org.argeo.slc.core.test;\r
 \r
+/**\r
+ * Part of a test result.\r
+ * \r
+ * @see TestResult\r
+ */\r
 public interface TestResultPart {\r
 \r
 }\r
index 0135b5d84ac496ad2fe269593904ee00de8f5383..270785eb35cb7affed1e267e26797907c4e6feaa 100644 (file)
@@ -4,13 +4,18 @@ import org.argeo.slc.core.deploy.DeployedSystem;
 \r
 /** The actual run of a test */\r
 public interface TestRun {\r
+       /** Gets the related test definition. */\r
        public TestDefinition getTestDefinition();\r
 \r
+       /** Gets the related test data */\r
        public TestData getTestData();\r
 \r
+       /** Gets the related deployed system. */\r
        public DeployedSystem getDeployedSystem();\r
 \r
+       /** Gets the related result where to record results. */\r
        public TestResult getTestResult();\r
-       \r
+\r
+       /** Executes this test run. */\r
        public void execute();\r
 }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/test/TimeTestResultId.java b/org.argeo.slc/src/main/java/org/argeo/slc/core/test/TimeTestResultId.java
deleted file mode 100644 (file)
index 0dffd47..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.argeo.slc.core.test;\r
-\r
-import org.argeo.slc.core.deploy.DeployedSystemId;\r
-\r
-public class TimeTestResultId extends NumericTRId {\r
-       private DeployedSystemId deployedSystemId;\r
-\r
-       public void init() {\r
-               if (getValue() == null) {\r
-                       setValue(System.currentTimeMillis());\r
-               }\r
-       }\r
-\r
-       public void setDeployedSystemId(DeployedSystemId deployedSystemId) {\r
-               this.deployedSystemId = deployedSystemId;\r
-       }\r
-\r
-       public DeployedSystemId getDeployedSystemId() {\r
-               return deployedSystemId;\r
-       }\r
-}\r
index 40402df88a3087306be8f2cbf75b93ee94cf1b28..5b141676786d5a3379bbe8e83a62bacd22fecc24 100644 (file)
@@ -2,6 +2,7 @@ package org.argeo.slc.core.test;
 \r
 import org.argeo.slc.core.deploy.DeployedSystem;\r
 \r
+/** Test run whose various components can be externally set. */\r
 public interface WritableTestRun extends TestRun {\r
        public void setDeployedSystem(DeployedSystem deployedSystem);\r
 \r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/test/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/test/package.html
new file mode 100644 (file)
index 0000000..c70d2d1
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+SLC Test: test of software systems.\r
+</body>\r
+</html>
\ No newline at end of file
index 6440fd2d1b765f6eadf8e36a5914749a9040d67a..76a8bb05a08071e93b9f7bb3a41c84d1557530e6 100644 (file)
@@ -8,6 +8,12 @@ import org.argeo.slc.core.test.TestResult;
 import org.argeo.slc.core.test.TestResultListener;\r
 import org.argeo.slc.core.test.TestResultPart;\r
 \r
+/**\r
+ * Abstract asynchronous implementation of a listener listening to a\r
+ * <code>TreeTestResult</code>.\r
+ * \r
+ * @see TreeTestResult\r
+ */\r
 public abstract class AsynchronousTreeTestResultListener implements\r
                TestResultListener, Runnable {\r
        private Vector<PartStruct> partStructs = new Vector<PartStruct>();\r
@@ -45,6 +51,7 @@ public abstract class AsynchronousTreeTestResultListener implements
                }\r
        }\r
 \r
+       /** Called when a result part has been added. */\r
        protected abstract void resultPartAdded(PartStruct partStruct);\r
 \r
        public void run() {\r
@@ -67,10 +74,15 @@ public abstract class AsynchronousTreeTestResultListener implements
                }\r
        }\r
 \r
+       /** Structure used to pass tree specific information to subclasses. */\r
        protected static class PartStruct {\r
+               /** The tree path of this part. */\r
                public final TreeSPath path;\r
+               /** The test result id of the related test result */\r
                public final NumericTRId resultId;\r
+               /** The part itself */\r
                public final TestResultPart part;\r
+               /** The tree test result itself. */\r
                public final TreeTestResult result;\r
 \r
                public PartStruct(TreeSPath path, NumericTRId resultId,\r
index 1fc65ab57d9dff511b3eee670afa43680dc8b37c..d5fa0095e54945433a2c7cfb3343f35d191264fc 100644 (file)
@@ -16,6 +16,10 @@ import org.argeo.slc.core.test.TestDefinition;
 import org.argeo.slc.core.test.TestResult;\r
 import org.argeo.slc.core.test.TestRun;\r
 \r
+/**\r
+ * Collection of test definitions propagating tree structure information to its\r
+ * children.\r
+ */\r
 public class CompositeTreeTestDefinition implements TestDefinition,\r
                StructureAware {\r
        private Log log = LogFactory.getLog(CompositeTreeTestDefinition.class);\r
@@ -45,6 +49,7 @@ public class CompositeTreeTestDefinition implements TestDefinition,
                }\r
        }\r
 \r
+       /** Sets the list of children test definitions */\r
        public void setTasks(List<TestDefinition> tasks) {\r
                this.tasks = tasks;\r
                if (tasks != null) {\r
index 38345d7b6df862d31a69bd7aa5c6fb7b1813dbc7..fea9765daecc0a881292031f41356a491a900677 100644 (file)
@@ -16,6 +16,11 @@ import org.argeo.slc.core.test.TestResult;
 import org.argeo.slc.core.test.TestResultPart;\r
 import org.argeo.slc.dao.test.TestResultDao;\r
 \r
+/**\r
+ * Basic implementation of TestReport generating static HTML pages. If a\r
+ * <code>TestResultDao</code> is passed, all the datas are dumped, otherwise\r
+ * only the passed <code>TestResult</code>.\r
+ */\r
 public class FullHtmlTreeReport implements TestReport, StructureAware {\r
        private TestResultDao testResultDao;\r
        private File reportDir;\r
@@ -64,6 +69,14 @@ public class FullHtmlTreeReport implements TestReport, StructureAware {
                }\r
        }\r
 \r
+       /**\r
+        * Generates a result page for one test result\r
+        * \r
+        * @param file\r
+        *            file to which generate the HTML\r
+        * @param result\r
+        *            the result to dump\r
+        */\r
        protected void generateResultPage(File file, TreeTestResult result) {\r
                StringBuffer buf = new StringBuffer("");\r
                buf.append("<html>\n");\r
@@ -124,15 +137,21 @@ public class FullHtmlTreeReport implements TestReport, StructureAware {
                }\r
        }\r
 \r
+       /**\r
+        * Generates a result file location based on the report dir and the id of\r
+        * the test result.\r
+        */\r
        protected File getResultFile(TreeTestResult result) {\r
                return new File(reportDir.getPath() + File.separator\r
                                + result.getTestResultId() + ".html");\r
        }\r
 \r
+       /** Sets the dao to use to extract all data. */\r
        public void setTestResultDao(TestResultDao testResultDao) {\r
                this.testResultDao = testResultDao;\r
        }\r
 \r
+       /** Sets the directory where to generate all the data. */\r
        public void setReportDir(File reportDir) {\r
                this.reportDir = reportDir;\r
        }\r
index 34ef96a4ee6a6379e8ad21d372b9493573b8b143..d4d366f95521560fdeb921050db1f5ec86e2e9e3 100644 (file)
@@ -5,8 +5,16 @@ import java.util.Vector;
 \r
 import org.argeo.slc.core.test.TestResultPart;\r
 \r
+/**\r
+ * List of <code>TestResultPart</code>. It can be used to build complex\r
+ * <code>TestResult</code> affording the possibility to a\r
+ * <code>TestDefinition</code> to add a list of result part under the same\r
+ * <code>StructurePath</code>.\r
+ * \r
+ * @see TreeTestResult\r
+ */\r
 public class PartSubList {\r
-       \r
+\r
        /** For ORM */\r
        private Long tid;\r
 \r
@@ -28,5 +36,4 @@ public class PartSubList {
                this.tid = tid;\r
        }\r
 \r
-       \r
 }\r
index 3c5be7305e3547c33683abcf59bbfe59898b5662..75df94dacebb6cbba7848236f3dcd1ac51cdf566 100644 (file)
@@ -18,6 +18,10 @@ import org.argeo.slc.core.test.TestResultId;
 import org.argeo.slc.core.test.TestResultListener;\r
 import org.argeo.slc.core.test.TestResultPart;\r
 \r
+/**\r
+ * Complex implementation of a test result compatible with a tree based\r
+ * structure.\r
+ */\r
 public class TreeTestResult implements TestResult, StructureAware {\r
        private Log log = LogFactory.getLog(TreeTestResult.class);\r
        /** For ORM */\r
@@ -27,7 +31,7 @@ public class TreeTestResult implements TestResult, StructureAware {
        private List<TestResultListener> listeners;\r
 \r
        private TreeSPath currentPath;\r
-       \r
+\r
        private boolean isClosed = false;\r
 \r
        private SortedMap<TreeSPath, PartSubList> resultParts = new TreeMap<TreeSPath, PartSubList>();\r
@@ -36,6 +40,10 @@ public class TreeTestResult implements TestResult, StructureAware {
                return testResultId;\r
        }\r
 \r
+       /**\r
+        * Use of a <code>NumericTRId</code> is required by Hibernate. <b>It may\r
+        * change in the future.</b>\r
+        */\r
        public NumericTRId getNumericResultId() {\r
                return testResultId;\r
        }\r
@@ -75,19 +83,22 @@ public class TreeTestResult implements TestResult, StructureAware {
                return currentPath;\r
        }\r
 \r
+       /** Gets all the results structured as a map of <code>PartSubList<code>s. */\r
        public SortedMap<TreeSPath, PartSubList> getResultParts() {\r
                return resultParts;\r
        }\r
 \r
+       /** Used by ORM systems. */\r
        void setResultParts(SortedMap<TreeSPath, PartSubList> resultParts) {\r
                this.resultParts = resultParts;\r
        }\r
 \r
        public void close() {\r
-               if(isClosed){\r
-                       throw new SlcException("Test Result #"+getTestResultId()+" alredy closed.");\r
+               if (isClosed) {\r
+                       throw new SlcException("Test Result #" + getTestResultId()\r
+                                       + " alredy closed.");\r
                }\r
-               \r
+\r
                synchronized (listeners) {\r
                        for (TestResultListener listener : listeners) {\r
                                listener.close();\r
@@ -95,7 +106,7 @@ public class TreeTestResult implements TestResult, StructureAware {
                        listeners.clear();\r
                }\r
                isClosed = true;\r
-               log.info("Test Result #"+getTestResultId()+" closed.");\r
+               log.info("Test Result #" + getTestResultId() + " closed.");\r
        }\r
 \r
        Long getTid() {\r
index 7b5f8eda5bae25160631e1dc7a1a0340da1e03a3..0e2d28825c7e8ec12095220b94753f223af38066 100644 (file)
@@ -3,11 +3,15 @@ package org.argeo.slc.core.test.tree;
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
 \r
-public class TreeTestResultLogger extends\r
-               AsynchronousTreeTestResultListener {\r
+/**\r
+ * Listener logging tree-based test results to the underlying logging system.\r
+ * \r
+ * @see TreeTestResult\r
+ * \r
+ */\r
+public class TreeTestResultLogger extends AsynchronousTreeTestResultListener {\r
 \r
-       private static Log log = LogFactory\r
-                       .getLog(TreeTestResultLogger.class);\r
+       private static Log log = LogFactory.getLog(TreeTestResultLogger.class);\r
 \r
        @Override\r
        protected void resultPartAdded(PartStruct partStruct) {\r
index 17cf66499c463af4174eeb03ea748fec88f66b07..12c97fa4663d91ac388fb6bd38febc25494a5180 100644 (file)
@@ -5,6 +5,11 @@ import org.apache.commons.logging.LogFactory;
 \r
 import org.argeo.slc.dao.test.TestResultDao;\r
 \r
+/**\r
+ * Listener persisting tree-based results.\r
+ * \r
+ * @see TreeTestResult\r
+ */\r
 public class TreeTestResultPersister extends AsynchronousTreeTestResultListener {\r
        private static Log log = LogFactory.getLog(TreeTestResultPersister.class);\r
 \r
@@ -49,6 +54,7 @@ public class TreeTestResultPersister extends AsynchronousTreeTestResultListener
                }\r
        }\r
 \r
+       /** Sets the dao to use in order to persist the results. */\r
        public void setTestResultDao(TestResultDao testResultDao) {\r
                this.testResultDao = testResultDao;\r
        }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/package.html
new file mode 100644 (file)
index 0000000..8ad1203
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Extension of SLC Test integrating tree-based structure.\r
+</body>\r
+</html>
\ No newline at end of file
index b282cd485f6af697266831f917b2b5dbb7c8491b..f64cfe769aacaea56bee5ef601d56df7acb1a455 100644 (file)
@@ -5,9 +5,21 @@ import java.util.List;
 import org.argeo.slc.core.test.TestResult;\r
 import org.argeo.slc.core.test.TestResultId;\r
 \r
+/**\r
+ * The dao for <code>TestResult</code>.\r
+ * \r
+ * @see TestResult\r
+ */\r
 public interface TestResultDao {\r
+       /** Gets a test result based on its id. */\r
        public TestResult getTestResult(TestResultId id);\r
+\r
+       /** Persists a new test result. */\r
        public void create(TestResult testResult);\r
+\r
+       /** Updates an already persisted test result. */\r
        public void update(TestResult testResult);\r
+\r
+       /** Lists all test results. */\r
        public List<TestResult> listTestResults();\r
 }\r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/dao/test/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/dao/test/package.html
new file mode 100644 (file)
index 0000000..38ae2b5
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Data Access Objects for SLC Test.\r
+</body>\r
+</html>
\ No newline at end of file
index 7b91769aaf5a14c2277a673bb4b41e39c578e4ed..4c55a5385f8cda62c29681d5b0de9935fc8e0501 100644 (file)
@@ -7,8 +7,14 @@ import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
 import org.argeo.slc.core.test.NumericTRId;\r
 import org.argeo.slc.core.test.TestResult;\r
 import org.argeo.slc.core.test.TestResultId;\r
+import org.argeo.slc.core.test.tree.TreeTestResult;\r
 import org.argeo.slc.dao.test.TestResultDao;\r
 \r
+/**\r
+ * The Hibernate implementation for tree-based result of the test result dao.\r
+ * \r
+ * @see TreeTestResult\r
+ */\r
 public class TestResultDaoHibernate extends HibernateDaoSupport implements\r
                TestResultDao {\r
 \r
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/hibernate/test/tree/package.html b/org.argeo.slc/src/main/java/org/argeo/slc/hibernate/test/tree/package.html
new file mode 100644 (file)
index 0000000..df82762
--- /dev/null
@@ -0,0 +1,6 @@
+<html>\r
+<head></head>\r
+<body>\r
+Hibernate based dao implementation for tree-based SLC Test.\r
+</body>\r
+</html>
\ No newline at end of file
index 768076d3288cb40afcd39132a3c966c3a230ad30..6dcbb6e931285317dfc1d7c031e5d9859335e914 100644 (file)
@@ -35,14 +35,14 @@ public class SimpleExampleTestDef implements TestDefinition {
                try {\r
                        // execute\r
                        appli.filter(args);\r
-                       \r
+\r
                        executePart.setStatus(SimpleResultPart.PASSED);\r
                } catch (Exception e) {\r
                        executePart.setStatus(SimpleResultPart.ERROR);\r
                        executePart.setException(e);\r
                }\r
                result.addResultPart(executePart);\r
-               if(executePart.getStatus()==SimpleResultPart.ERROR){\r
+               if (executePart.getStatus() == SimpleResultPart.ERROR) {\r
                        return;\r
                }\r
 \r
index 0af5ddbdd2135d9266476816e1956fc0eb287faf..006369cbd6d1c1a1bc5517e33cf92215fb4dd02e 100644 (file)
@@ -15,7 +15,7 @@ public class ExampleAppli {
                }\r
                String input = args[0];\r
                String output = args[1];\r
-               if(args.length>2){\r
+               if (args.length > 2) {\r
                        skipFreq = Integer.parseInt(args[2]);\r
                }\r
 \r
index 1894b5a5a097d8b13c15dd775b162801802eecc7..70bad1191dbd0e0517752b710def5dd787edbb3f 100644 (file)
@@ -13,6 +13,6 @@ public class TestAntBuild extends TestCase {
                File antFile = new File(slcBaseDir.getPath()\r
                                + "/root/Category1/SubCategory2/build.xml");\r
                AntRegistryUtil.runAll(antFile);\r
-               \r
+\r
        }\r
 }\r
index 879c75a12a90cfc8a7397efcc9ed70e61da8162f..c520dc650de7ca5156b3838949c84134a1e9d994 100644 (file)
@@ -9,6 +9,12 @@
                <property name="deployedSystem" ref="exampleDeployedSystem" />\r
        </bean>\r
 \r
+       <bean id="otherTestRun"\r
+               class="org.argeo.slc.core.test.SimpleTestRun" scope="prototype">\r
+               <property name="testResult" ref="testResult2" />\r
+               <property name="deployedSystem" ref="exampleDeployedSystem" />\r
+       </bean>\r
+\r
        <bean id="testResult"\r
                class="org.argeo.slc.core.test.tree.TreeTestResult">\r
                <property name="numericResultId" ref="testResultId" />\r
index 734efcbe279274373c2a7e400326c26ef8438990..ca26ed6299e35728e7ba9feee29a8219a98149c0 100644 (file)
                        <testData bean="testData.un" />\r
                </slc.test>\r
 \r
-               <slc.test description="EU-reform">\r
+               <slc.test description="EU-reform" testRun="otherTestRun">\r
                        <testDefinition bean="simpleExampleTestDef" />\r
                        <testData bean="testData.eu-reform" />\r
                </slc.test>\r
-               \r
+\r
                <slc.test description="Distinct test">\r
                        <testDefinition bean="simpleExampleTestDef" />\r
                        <testData bean="testData.eu-reform" />\r
-                       <deployedSystem bean="exampleDeployedSystem2"/>\r
-                       <testResult bean="testResult2"/>\r
+                       <deployedSystem bean="exampleDeployedSystem2" />\r
+                       <testResult bean="testResult2" />\r
                </slc.test>\r
 \r
        </target>\r
                        <testDefinition bean="complexExampleTestDef" />\r
                        <testData bean="testData.un" />\r
                </slc.test>\r
+               <slc.test description="Complex overridden">\r
+                       <testDefinition bean="complexExampleTestDef">\r
+                               <override name="tasks">\r
+                                       <list>\r
+                                               <override bean="dummyTask" />\r
+                                       </list>\r
+                               </override>\r
+                       </testDefinition>\r
+                       <testData bean="testData.un" />\r
+               </slc.test>\r
        </target>\r
 \r
 </project>
\ No newline at end of file