]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/main/java/org/argeo/slc/unit/test/tree/TreeTestResultTestUtils.java
Introduce test result attributes instead of root tags
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / unit / test / tree / TreeTestResultTestUtils.java
index 944fe2e6439c39ed8059c9d84dd3b80a3981c826..fedaa266a89975fa3af7b725f12e00b2249fc97e 100644 (file)
@@ -4,6 +4,8 @@ import java.util.UUID;
 \r
 import org.argeo.slc.core.build.Distribution;\r
 import org.argeo.slc.core.deploy.DeployedSystem;\r
+import org.argeo.slc.core.deploy.DeploymentData;\r
+import org.argeo.slc.core.deploy.TargetData;\r
 import org.argeo.slc.core.process.SlcExecution;\r
 import org.argeo.slc.core.process.SlcExecutionStep;\r
 import org.argeo.slc.core.structure.SimpleSElement;\r
@@ -28,9 +30,19 @@ public abstract class TreeTestResultTestUtils {
        public static TreeTestResult createCompleteTreeTestResult() {\r
                SlcExecution slcExecution = SlcExecutionTestUtils\r
                                .createSimpleSlcExecution();\r
-               SlcExecutionStep step = new SlcExecutionStep("LOG", "JUnit step");\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
@@ -43,6 +55,9 @@ public abstract class TreeTestResultTestUtils {
                registry.register(path, elem);\r
 \r
                TreeTestResult ttr = createSimpleTreeTestResult();\r
+               ttr.getAttributes().put("testCase", "UNIT");\r
+\r
+               // Simulate test run\r
                ttr.notifyCurrentPath(registry, path);\r
                ttr.notifyTestRun(testRun);\r
                testRun.setTestResult(ttr);\r
@@ -56,12 +71,19 @@ public abstract class TreeTestResultTestUtils {
                        public Distribution getDistribution() {\r
                                return null;\r
                        }\r
+\r
+                       public DeploymentData getDeploymentData() {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\r
+                       }\r
+\r
+                       public TargetData getTargetData() {\r
+                               // TODO Auto-generated method stub\r
+                               return null;\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
@@ -90,7 +112,8 @@ public abstract class TreeTestResultTestUtils {
                return partFailed;\r
        }\r
 \r
-       public static ResultPartRequest createSimpleResultPartRequest(TreeTestResult ttr) {\r
+       public static ResultPartRequest createSimpleResultPartRequest(\r
+                       TreeTestResult ttr) {\r
                TreeSPath path = ttr.getCurrentPath();\r
                PartSubList lst = ttr.getResultParts().get(path);\r
                SimpleResultPart part = (SimpleResultPart) lst.getParts().get(2);\r