\r
import javax.xml.transform.stream.StreamResult;\r
\r
-import org.springframework.oxm.Marshaller;\r
-\r
import org.apache.commons.io.IOUtils;\r
-import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.SlcException;\r
+import org.springframework.oxm.Marshaller;\r
\r
public class FileSlcExecutionNotifier implements SlcExecutionNotifier {\r
private final static SimpleDateFormat sdf = new SimpleDateFormat(\r
+++ /dev/null
-package org.argeo.slc.core.structure;\r
-\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
-\r
-/** Default implementation of a <code>StructureRegistry</code>. */\r
-public class DefaultSRegistry implements StructureRegistry<StructurePath> {\r
- private static Log log = LogFactory.getLog(DefaultSRegistry.class);\r
-\r
- private List<StructureElement> elements = new Vector<StructureElement>();\r
- private List<StructurePath> paths = new Vector<StructurePath>();\r
- private String mode = StructureRegistry.ALL;\r
-\r
- private List<StructurePath> activePaths;\r
-\r
- public List<StructureElement> listElements() {\r
- return new Vector<StructureElement>(elements);\r
- }\r
-\r
- public List<StructurePath> listPaths() {\r
- return new Vector<StructurePath>(paths);\r
- }\r
-\r
- public void register(StructurePath path, StructureElement element) {\r
- StructureElement treeSElement = element;\r
- elements.add(treeSElement);\r
- paths.add(path);\r
-\r
- if (log.isTraceEnabled())\r
- log.trace("Registered " + path + " (label: '"\r
- + treeSElement.getLabel() + "', position: "\r
- + elements.size() + ")");\r
- }\r
-\r
- public StructureElement getElement(StructurePath path) {\r
- int index = paths.indexOf(path);\r
- if (index >= 0) {\r
- return elements.get(index);\r
- } else {// not found\r
- return null;\r
- }\r
- }\r
-\r
- public String getMode() {\r
- return mode;\r
- }\r
-\r
- public void setMode(String mode) {\r
- this.mode = mode;\r
- }\r
-\r
- public List<StructurePath> getActivePaths() {\r
- return activePaths;\r
- }\r
-\r
- public void setActivePaths(List<StructurePath> activePaths) {\r
- this.activePaths = activePaths;\r
- }\r
-\r
-}\r
/** All mode: everything is executed regardless of the active paths. */\r
public static String ALL = "ALL";\r
/** Active mode: only the active paths are executed. */\r
- public static String ACTIVE = "STATUS_ACTIVE";\r
+ public static String ACTIVE = "ACTIVE";\r
\r
/** Adds an element to the registry. */\r
public void register(P path, StructureElement element);\r
\r
/** Tree based implementation of a structure registry. */\r
public class TreeSRegistry implements StructureRegistry<TreeSPath> {\r
- public final static String STATUS_ACTIVE = "STATUS_ACTIVE";\r
-\r
/** For ORM */\r
private Long tid;\r
- private String status;\r
private Map<TreeSPath, SimpleSElement> elements = new TreeMap<TreeSPath, SimpleSElement>();\r
\r
private String mode = StructureRegistry.ALL;\r
}\r
\r
public void register(TreeSPath path, StructureElement element) {\r
+ if (path == null)\r
+ throw new UnsupportedException("Cannot register under a null path.");\r
+ if (element == null)\r
+ throw new UnsupportedException(\r
+ "Cannot register null element for path " + path);\r
+ if (element.getLabel() == null)\r
+ throw new UnsupportedException(\r
+ "Cannot register an element with null label for path "\r
+ + path);\r
+\r
final SimpleSElement simpleSElement;\r
if (element instanceof SimpleSElement) {\r
simpleSElement = (SimpleSElement) element;\r
simpleSElement = new SimpleSElement(element.getLabel());\r
}\r
\r
- if (path == null)\r
- throw new UnsupportedException("Path cannot be null.");\r
-\r
elements.put(path, simpleSElement);\r
-\r
}\r
\r
public String getMode() {\r
this.activePaths = activePaths;\r
}\r
\r
- public String getStatus() {\r
- return status;\r
- }\r
-\r
- public void setStatus(String status) {\r
- this.status = status;\r
- }\r
-\r
/** Gets the elements. */\r
public Map<TreeSPath, SimpleSElement> getElements() {\r
return elements;\r
\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.SlcException;\r
import org.argeo.slc.core.structure.SimpleSElement;\r
import org.argeo.slc.core.structure.StructureAware;\r
}\r
}\r
\r
- currentPath = (TreeSPath) path;\r
+ currentPath = path;\r
}\r
\r
/** Gets the current path. */\r
\r
public SortedMap<TreeSPath, StructureElement> getRelatedElements(\r
TreeSPath path) {\r
+ if (path == null)\r
+ throw new SlcException(\r
+ "Cannot retrieve element for a null path in result #"\r
+ + uuid);\r
+\r
SortedMap<TreeSPath, StructureElement> relatedElements = new TreeMap<TreeSPath, StructureElement>();\r
List<TreeSPath> hierarchy = path.getHierarchyAsList();\r
for (TreeSPath currPath : elements.keySet()) {\r
\r
import java.util.SortedSet;\r
\r
-import org.argeo.slc.core.test.tree.TreeTestResult;\r
import org.argeo.slc.core.test.tree.TreeTestResultCollection;\r
\r
public interface TreeTestResultCollectionDao {\r
this.steps = steps;\r
}\r
\r
+ public SlcExecutionStepsRequest(String slcExecutionUuid,\r
+ SlcExecutionStep step) {\r
+ this.slcExecutionUuid = slcExecutionUuid;\r
+ List<SlcExecutionStep> steps = new Vector<SlcExecutionStep>();\r
+ steps.add(step);\r
+ this.steps = steps;\r
+ }\r
+\r
public String getSlcExecutionUuid() {\r
return slcExecutionUuid;\r
}\r
public void setTreeTestResult(TreeTestResult treeTestResult) {\r
this.treeTestResult = treeTestResult;\r
}\r
- \r
+\r
@Override\r
public String toString() {\r
return getClass().getSimpleName() + "#" + treeTestResult.getUuid();\r
SimpleResultPart resultPart) {\r
resultUuid = ttr.getUuid();\r
this.resultPart = resultPart;\r
- this.path = path;\r
- relatedElements = ttr.getRelatedElements(path);\r
+ this.path = (path != null ? path : ttr.getCurrentPath());\r
+ relatedElements = ttr.getRelatedElements(this.path);\r
if (ttr.getCurrentTestRun() != null)\r
testRunDescriptor = new TestRunDescriptor(ttr.getCurrentTestRun());\r
}\r
package org.argeo.slc.runtime;
public interface SlcExecutionOutput<T extends SlcExecutionContext> {
- /** Called after the execution, before the resources are freed.*/
+ /** Called after the execution, before the resources are freed. */
public void postExecution(T executionContext);
}
\r
import java.io.IOException;\r
import java.net.URI;\r
-import java.net.URL;\r
import java.util.Map;\r
\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
import org.argeo.slc.core.SlcException;\r
-import org.springframework.beans.BeanUtils;\r
import org.springframework.beans.factory.BeanFactoryUtils;\r
import org.springframework.beans.factory.ListableBeanFactory;\r
import org.springframework.core.io.DefaultResourceLoader;\r
\r
import junit.framework.TestCase;\r
\r
-import org.springframework.context.ApplicationContext;\r
-import org.springframework.context.ConfigurableApplicationContext;\r
-import org.springframework.context.support.ClassPathXmlApplicationContext;\r
-\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
-\r
import org.argeo.slc.core.SlcException;\r
import org.argeo.slc.spring.SpringUtils;\r
+import org.springframework.context.ConfigurableApplicationContext;\r
+import org.springframework.context.support.ClassPathXmlApplicationContext;\r
\r
/** Helper for tests using a Spring application co,text. */\r
public abstract class AbstractSpringTestCase extends TestCase {\r
SlcExecutionStep step = new SlcExecutionStep("JUnit step");\r
slcExecution.getSteps().add(step);\r
\r
+ TreeTestResult ttr = createMinimalConsistentTreeTestResult(slcExecution);\r
+\r
+ ttr.addResultPart(createSimpleResultPartPassed());\r
+ ttr.addResultPart(createSimpleResultPartFailed());\r
+ ttr.addResultPart(createSimpleResultPartError());\r
+ return ttr;\r
+ }\r
+\r
+ public static TreeTestResult createMinimalConsistentTreeTestResult(\r
+ SlcExecution slcExecution) {\r
SimpleTestRun testRun = new SimpleTestRun();\r
testRun.setUuid(UUID.randomUUID().toString());\r
\r
\r
});\r
testRun.notifySlcExecution(slcExecution);\r
-\r
- ttr.addResultPart(createSimpleResultPartPassed());\r
- ttr.addResultPart(createSimpleResultPartFailed());\r
- ttr.addResultPart(createSimpleResultPartError());\r
return ttr;\r
}\r
\r