*/\r
public class SlcAntConfig {\r
// SLC ROOT PROPERTIES\r
+ /** Property for the root file (SLC root property file). */\r
public final static String ROOT_FILE_PROPERTY = "slc.rootFile";\r
+ /** Property for the root dir (SLC root property file). */\r
public final static String ROOT_DIR_PROPERTY = "slc.rootDir";\r
+ /** Property for the conf dir (SLC root property file). */\r
public final static String CONF_DIR_PROPERTY = "slc.confDir";\r
+ /** Property for the work dir (SLC root property file). */\r
public final static String WORK_DIR_PROPERTY = "slc.workDir";\r
/**\r
* Comma-separated list of property file names to load from the conf dir and\r
public static String DEFAULT_TEST_RUN_PROPERTY = "slc.defaultTestRun";\r
\r
// SLC LOCAL PROPERTIES\r
+ /** Property for the dir description (SLC local property file). */\r
public static String DIR_DESCRIPTION_PROPERTY = "slc.dirDescription";\r
\r
private String slcRootFileName = "slcRoot.properties";\r
if (slcRootFile == null) {\r
return false;\r
}\r
- \r
+\r
// pass the project properties through the System properties\r
System.getProperties().putAll((Map<?, ?>) project.getUserProperties());\r
Properties all = prepareAllProperties(slcRootFile);\r
public class SlcAntException extends SlcException {\r
static final long serialVersionUID = 1l;\r
\r
+ /** Constructor. */\r
public SlcAntException(String message) {\r
super(message);\r
}\r
\r
+ /** Constructor. */\r
public SlcAntException(String message, Throwable cause) {\r
super(message, cause);\r
}\r
this.deploymentBean = deploymentBean;\r
}\r
\r
+ /** Creates deployment data sub tag.*/\r
public DeploymentDataArg createDeploymentData() {\r
deploymentDataArg = new DeploymentDataArg();\r
return deploymentDataArg;\r
}\r
\r
+ /** Creates target data sub tag.*/\r
public TargetDataArg createTargetData() {\r
targetDataArg = new TargetDataArg();\r
return targetDataArg;\r
}\r
\r
class DeploymentDataArg extends AbstractSpringArg {\r
- public DeploymentData getDeploymentData() {\r
+ DeploymentData getDeploymentData() {\r
return (DeploymentData) getBeanInstance();\r
}\r
\r
}\r
\r
class TargetDataArg extends AbstractSpringArg {\r
- public TargetData getTargetData() {\r
+ TargetData getTargetData() {\r
return (TargetData) getBeanInstance();\r
}\r
\r
return name;\r
}\r
\r
+ /** Sets the name. */\r
public void setName(String name) {\r
this.name = name;\r
}\r
super.setBean(bean);\r
}\r
\r
+ /** Creates override list sub tag. */\r
public OverrideList createList() {\r
if (value != null || getBean() != null) {\r
throw new BuildException("Value already set.");\r
protected class OverrideList {\r
private List<OverrideArg> list = new Vector<OverrideArg>();\r
\r
+ /** Creates override sub tag. */\r
public OverrideArg createOverride() {\r
OverrideArg overrideArg = new OverrideArg();\r
list.add(overrideArg);\r
return overrideArg;\r
}\r
\r
+ /** Gets as list of objects. */\r
public List<Object> getAsObjectList() {\r
List<Object> objectList = new Vector<Object>();\r
for (OverrideArg arg : list) {\r
getPath());\r
}\r
\r
- ((ExecutableTestRun)testRun).execute();\r
+ ((ExecutableTestRun) testRun).execute();\r
}\r
\r
/**\r
this.testRunBean = testRunBean;\r
}\r
\r
+ /** Creates sub tag. */\r
public TestDefinitionArg createTestDefinition() {\r
testDefinitionArg = new TestDefinitionArg();\r
// only test definitions can add to path\r
return testDefinitionArg;\r
}\r
\r
+ /** Creates sub tag. */\r
public TestDataArg createTestData() {\r
testDataArg = new TestDataArg();\r
return testDataArg;\r
}\r
\r
+ /** Creates sub tag. */\r
public DeployedSystemArg createDeployedSystem() {\r
deployedSystemArg = new DeployedSystemArg();\r
return deployedSystemArg;\r
}\r
\r
+ /** Creates sub tag. */\r
public TestResultArg createTestResult() {\r
testResultArg = new TestResultArg();\r
return testResultArg;\r
}\r
\r
class TestDefinitionArg extends AbstractSpringArg {\r
- public TestDefinition getTestDefinition() {\r
+ TestDefinition getTestDefinition() {\r
return (TestDefinition) getBeanInstance();\r
}\r
}\r
\r
class TestDataArg extends AbstractSpringArg {\r
- public TestData getTestData() {\r
+ TestData getTestData() {\r
return (TestData) getBeanInstance();\r
}\r
\r
}\r
\r
class DeployedSystemArg extends AbstractSpringArg {\r
- public DeployedSystem getDeployedSystem() {\r
+ DeployedSystem getDeployedSystem() {\r
return (DeployedSystem) getBeanInstance();\r
}\r
\r
}\r
\r
class TestResultArg extends AbstractSpringArg {\r
- public TestResult getTestResult() {\r
+ TestResult getTestResult() {\r
return (TestResult) getBeanInstance();\r
}\r
\r
public class SlcException extends RuntimeException {\r
static final long serialVersionUID = 1l;\r
\r
+ /** Constructor. */\r
public SlcException(String message) {\r
super(message);\r
}\r
\r
+ /** Constructor. */\r
public SlcException(String message, Throwable cause) {\r
super(message, cause);\r
}\r
package org.argeo.slc.core;\r
\r
+/** Exception for unsupported features or actions. */\r
public class UnsupportedException extends SlcException {\r
static final long serialVersionUID = 1l;\r
\r
+ /** Action not supported. */\r
public UnsupportedException() {\r
this("Action not supported");\r
}\r
\r
+ /** Constructor with a message. */\r
public UnsupportedException(String message) {\r
super(message);\r
}\r
\r
+ /**\r
+ * Constructor generating a message.\r
+ * \r
+ * @param nature\r
+ * the nature of the unsupported object\r
+ * @param obj\r
+ * the object itself (its class name will be used in message)\r
+ */\r
public UnsupportedException(String nature, Object obj) {\r
super("Unsupported " + nature + ": " + obj.getClass());\r
}\r
\r
+ /**\r
+ * Constructor generating a message.\r
+ * \r
+ * @param nature\r
+ * the nature of the unsupported object\r
+ * @param value\r
+ * the problematic value itself\r
+ */\r
public UnsupportedException(String nature, String value) {\r
super("Unsupported " + nature + ": " + value);\r
}\r
public SimpleSElement() {\r
}\r
\r
+ /** Constructor */\r
public SimpleSElement(String description) {\r
this.description = description;\r
}\r
\r
+ /** Constructor */\r
public SimpleSElement(String description, String defaultDescription) {\r
this(description != null ? description : defaultDescription);\r
}\r
return description;\r
}\r
\r
+ /** Sets the description. */\r
public void setDescription(String description) {\r
this.description = description;\r
}\r
return parentStr + separator + name;\r
}\r
\r
+ /** Sets all the required data from a string. */\r
public void setAsUniqueString(String str) {\r
TreeSPath twin = parseToCreatePath(str, getSeparator());\r
name = twin.name;\r
return currPath;\r
}\r
\r
+ /** Lists the children from a registry. */\r
public List<TreeSPath> listChildren(StructureRegistry registry) {\r
return listChildrenPaths(registry, this);\r
}\r
\r
+ /** Lists the children from a given path from a registry. */\r
public static List<TreeSPath> listChildrenPaths(StructureRegistry registry,\r
TreeSPath path) {\r
List<TreeSPath> paths = new Vector<TreeSPath>();\r
return paths;\r
}\r
\r
- public TreeSPath getRoot(){\r
+ /** Gets the root tree path of this path. */\r
+ public TreeSPath getRoot() {\r
TreeSPath root = this;\r
- while(root.getParent()!=null){\r
+ while (root.getParent() != null) {\r
root = root.getParent();\r
}\r
return root;\r
}\r
- \r
+\r
@Override\r
public String toString() {\r
return getAsUniqueString();\r
this.tid = tid;\r
}\r
\r
+ /** Sets the separator character to use. */\r
public void setSeparator(Character separator) {\r
this.separator = separator;\r
}\r
\r
+ /** Sets the parent (for ORM). */\r
protected void setParent(TreeSPath parent) {\r
this.parent = parent;\r
}\r
\r
+ /** Sets the name (for ORM). */\r
protected void setName(String name) {\r
this.name = name;\r
}\r
import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
\r
+/** Tree based implementation of a structure registry. */\r
public class TreeSRegistry implements StructureRegistry {\r
/** For ORM */\r
private Long tid;\r
\r
public void register(StructurePath path, StructureElement element) {\r
final SimpleSElement simpleSElement;\r
- if (element instanceof SimpleSElement){\r
- simpleSElement = (SimpleSElement)element;\r
- }else{\r
+ if (element instanceof SimpleSElement) {\r
+ simpleSElement = (SimpleSElement) element;\r
+ } else {\r
simpleSElement = new SimpleSElement(element.getDescription());\r
}\r
- \r
+\r
if (!(path instanceof TreeSPath))\r
throw new UnsupportedException("path", path);\r
\r
this.activePaths = activePaths;\r
}\r
\r
+ /** Gets the related root path. */\r
public TreeSPath getRoot() {\r
return root;\r
}\r
\r
+ /** Sets the related root path. */\r
public void setRoot(TreeSPath root) {\r
this.root = root;\r
}\r
\r
+ /** Gets the elements. */\r
public Map<TreeSPath, SimpleSElement> getElements() {\r
return elements;\r
}\r
\r
+ /** Sets the elements (for ORM). */\r
public void setElements(Map<TreeSPath, SimpleSElement> elements) {\r
this.elements = elements;\r
}\r
private Vector<PartStruct> partStructs = new Vector<PartStruct>();\r
private Thread thread;\r
\r
+ /** Starts the underlying thread. */\r
public void init() {\r
thread = new Thread(this);\r
thread.start();\r
/** The tree test result itself. */\r
public final TreeTestResult result;\r
\r
+ /** Constructor */\r
public PartStruct(TreeSPath path, NumericTRId resultId,\r
TestResultPart part, TreeTestResult result) {\r
super();\r
import org.argeo.slc.core.structure.StructurePath;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
-import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
import org.argeo.slc.core.test.SimpleResultPart;\r
-import org.argeo.slc.core.test.SimpleTestResult;\r
-import org.argeo.slc.core.test.TestStatus;\r
import org.argeo.slc.core.test.TestReport;\r
import org.argeo.slc.core.test.TestResult;\r
import org.argeo.slc.core.test.TestResultPart;\r
+ result.getTestResultId() + ".html");\r
}\r
\r
- /** Sets the dao to use to extract all data. */\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 tree structure registry DAO.*/\r
public void setTreeSRegistryDao(TreeSRegistryDao treeSRegistryDao) {\r
this.treeSRegistryDao = treeSRegistryDao;\r
}\r
this.reportDir = reportDir;\r
}\r
\r
- protected void initRegistry(TreeSPath path){\r
+ private void initRegistry(TreeSPath path){\r
if(treeSRegistryDao != null){\r
registry = treeSRegistryDao.getTreeSRegistry(path);\r
}\r
\r
private List<TestResultPart> parts = new Vector<TestResultPart>();\r
\r
+ /** Gets the result parts.*/\r
public List<TestResultPart> getParts() {\r
return parts;\r
}\r
\r
+ /** Sets the result parts.*/\r
public void setParts(List<TestResultPart> parts) {\r
this.parts = parts;\r
}\r
return testResultId;\r
}\r
\r
+ /** Sets the test result id as a numeric test result id.*/\r
public void setNumericResultId(NumericTRId testResultId) {\r
this.testResultId = testResultId;\r
}\r
\r
+ /** Sets the list of listeners.*/\r
public void setListeners(List<TestResultListener> listeners) {\r
this.listeners = listeners;\r
}\r
this.registry = registry;\r
}\r
\r
+ /** Gets the current path.*/\r
public TreeSPath getCurrentPath() {\r
return currentPath;\r
}\r
this.tid = tid;\r
}\r
\r
+ /** Gets the related registry (can be null).*/\r
public StructureRegistry getRegistry() {\r
return registry;\r
}\r
\r
+ /** Sets the related registry.*/\r
public void setRegistry(StructureRegistry registry) {\r
this.registry = registry;\r
}\r
import org.apache.commons.logging.LogFactory;\r
\r
import org.argeo.slc.core.structure.SimpleSElement;\r
-import org.argeo.slc.core.structure.StructureElement;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
} else {\r
registry.register(path, new SimpleSElement(path.getName()));\r
}\r
+ treeSRegistryDao.update(registry);\r
}\r
\r
if (persistedResult == null) {\r
}\r
}\r
\r
- /** Sets the dao to use in order to persist the results. */\r
+ /** Sets the DAO to use in order to persist the results. */\r
public void setTestResultDao(TestResultDao testResultDao) {\r
this.testResultDao = testResultDao;\r
}\r
\r
+ /** Sets the tree structure path DAO. */\r
public void setTreeSPathDao(TreeSPathDao treeSPathDao) {\r
this.treeSPathDao = treeSPathDao;\r
}\r
\r
+ /** Sets the tree structure registry DAO. */\r
public void setTreeSRegistryDao(TreeSRegistryDao treeSRegistryDao) {\r
this.treeSRegistryDao = treeSRegistryDao;\r
}\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
\r
+/**\r
+ * DAO for tree-base structure registry.\r
+ * \r
+ * @see TreeSRegistry\r
+ */\r
public interface TreeSRegistryDao {\r
+ /** Gets the TreeSRegistry which has the same root path as the provided path. */\r
public TreeSRegistry getTreeSRegistry(TreeSPath treeSPath);\r
+\r
+ /** Creates a new registry. */\r
public void create(TreeSRegistry registry);\r
+\r
+ /** Updates an existing registry. */\r
+ public void update(TreeSRegistry registry);\r
}\r
\r
/** The root class for issues which happened during a diff. */\r
public abstract class DiffIssue implements Comparable<DiffIssue> {\r
+ /** The position of this issue.*/\r
protected final DiffPosition position;\r
\r
+ /** Constructor*/\r
public DiffIssue(DiffPosition position) {\r
super();\r
this.position = position;\r
}\r
\r
\r
- protected void createImpl(TreeSPath path) {\r
+ private void createImpl(TreeSPath path) {\r
if (path.getParent() != null) {\r
TreeSPath parent = getTreeSPath(path.getParent()\r
.getAsUniqueString());\r
\r
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;\r
\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.core.structure.tree.TreeSRegistry;\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
-import org.argeo.slc.dao.structure.tree.TreeSPathDao;\r
import org.argeo.slc.dao.structure.tree.TreeSRegistryDao;\r
\r
/**\r
- * The Hibernate implementation for tree-based result of the test result dao.\r
+ * The Hibernate implementation for tree-based structure registry.\r
* \r
- * @see TreeTestResult\r
+ * @see TreeSRegistry\r
*/\r
public class TreeSRegistryDaoHibernate extends HibernateDaoSupport implements\r
TreeSRegistryDao {\r
getHibernateTemplate().save(registry);\r
}\r
\r
+ public void update(TreeSRegistry registry) {\r
+ getHibernateTemplate().update(registry);\r
+ }\r
+\r
public TreeSRegistry getTreeSRegistry(TreeSPath treeSPath) {\r
List<?> list = getHibernateTemplate().find(\r
"from TreeSRegistry where root.asUniqueString=?",\r
private String dialect;\r
private List<String> mappings;\r
\r
+ /** Sets the Hibernate dialect to use. */\r
public void setDialect(String dialect) {\r
this.dialect = dialect;\r
}\r
\r
+ /** Sets the list of mappings to consider. */\r
public void setMappings(List<String> mappings) {\r
this.mappings = mappings;\r
}\r
\r
+ /**\r
+ * Creates an Hibernate schema export tool, in order to create the\r
+ * underlying datamodel.\r
+ */\r
public SchemaExport createSchemaExport(Connection connection) {\r
Configuration configuration = new Configuration();\r
Properties properties = new Properties();\r
import org.argeo.slc.core.deploy.DeployedSystemId;\r
import org.argeo.slc.example.appli.ExampleAppli;\r
\r
+/** Example deployed sytem. */\r
public class ExampleDeployedSystem implements DeployedSystem {\r
private DeployedSystemId deployedSystemId;\r
private int skipFreq = 2;\r
return deployedSystemId;\r
}\r
\r
+ /** Sets deployed system id. */\r
public void setDeployedSystemId(DeployedSystemId deployedSystemId) {\r
this.deployedSystemId = deployedSystemId;\r
}\r
\r
+ /** Creates an instance of the example appli. */\r
public ExampleAppli getExampleAppliInstance() {\r
ExampleAppli appli = new ExampleAppli();\r
appli.setSkipFreq(skipFreq);\r
return appli;\r
}\r
\r
+ /** Sets the frequency used to skip lines. */\r
public void setSkipFreq(int skipFreq) {\r
this.skipFreq = skipFreq;\r
}\r
import org.argeo.slc.core.test.TestResult;\r
import org.argeo.slc.core.test.TestRun;\r
\r
+/** Example task.*/\r
public class ExampleTask implements StructureAware, TestDefinition,\r
StructureElement {\r
private TreeSPath path;\r
return description;\r
}\r
\r
+ /** Sets the description.*/\r
public void setDescription(String description) {\r
this.description = description;\r
}\r
import java.io.FileWriter;\r
import java.io.IOException;\r
\r
+/** Example appli.*/\r
public class ExampleAppli {\r
private int skipFreq = 2;\r
\r
+ /** Filters.*/\r
public void filter(String[] args) {\r
if (args.length < 2) {\r
throw new RuntimeException(\r
}\r
}\r
\r
+ /** Sets the frequency of the lines to skip.*/\r
public void setSkipFreq(int skipFreq) {\r
this.skipFreq = skipFreq;\r
}\r
import org.argeo.slc.core.test.tree.TreeTestResult;\r
import org.argeo.slc.dao.test.TestResultDao;\r
\r
+/** High level tests for SLC Ant. */\r
public class TestAntBuild extends TestCase {\r
+ /** Tests an end-to-end Ant run. */\r
public void testAllRunSimple() {\r
- File[] reportFiles = new File("src/test/slc/work/results/report/").listFiles();\r
- for(File file: reportFiles){\r
+ File[] reportFiles = new File("src/test/slc/work/results/report/")\r
+ .listFiles();\r
+ for (File file : reportFiles) {\r
file.delete();\r
}\r
- \r
+\r
File slcBaseDir = new File("./src/test/slc").getAbsoluteFile();\r
\r
File antFile = new File(slcBaseDir.getPath()\r