]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/test/java/org/argeo/slc/core/process/SlcExecutionTestUtils.java
Create separate Hibernate project
[gpl/argeo-slc.git] / org.argeo.slc.core / src / test / java / org / argeo / slc / core / process / SlcExecutionTestUtils.java
index ac32189bc77ef3b770b85dafc585fc0045ac6031..c3c880366a7d2a6d26eaa94ad973acb241e91910 100644 (file)
@@ -2,26 +2,38 @@ package org.argeo.slc.core.process;
 \r
 import java.util.UUID;\r
 \r
-import junit.framework.TestCase;\r
+import static junit.framework.Assert.assertEquals;\r
+import static junit.framework.Assert.assertNotNull;\r
+import static org.argeo.slc.unit.UnitUtils.assertDateSec;\r
 \r
-public abstract class SlcExecutionTestUtils extends TestCase{\r
+public abstract class SlcExecutionTestUtils {\r
 \r
        public static SlcExecution createSimpleSlcExecution() {\r
                SlcExecution slcExec = new SlcExecution();\r
                slcExec.setUuid(UUID.randomUUID().toString());\r
                slcExec.setHost("localhost");\r
-               slcExec.setPath("/test");\r
+               slcExec.setUser("user");\r
                slcExec.setType("slcAnt");\r
                slcExec.setStatus("STARTED");\r
+               slcExec.getAttributes().put("ant.file", "/test");\r
                return slcExec;\r
        }\r
 \r
-       public static void assertSlcExecution(SlcExecution expected, SlcExecution reached) {\r
+       public static void assertSlcExecution(SlcExecution expected,\r
+                       SlcExecution reached) {\r
                assertNotNull(reached);\r
                assertEquals(expected.getHost(), reached.getHost());\r
-               assertEquals(expected.getPath(), reached.getPath());\r
+               assertEquals(expected.getUser(), reached.getUser());\r
                assertEquals(expected.getType(), reached.getType());\r
                assertEquals(expected.getStatus(), reached.getStatus());\r
+               assertEquals(expected.getAttributes().size(), reached.getAttributes()\r
+                               .size());\r
+               for (String key : expected.getAttributes().keySet()) {\r
+                       String expectedValue = expected.getAttributes().get(key);\r
+                       String reachedValue = reached.getAttributes().get(key);\r
+                       assertNotNull(reachedValue);\r
+                       assertEquals(expectedValue, reachedValue);\r
+               }\r
        }\r
 \r
        public static void assertSlcExecutionStep(SlcExecutionStep expected,\r
@@ -30,10 +42,10 @@ public abstract class SlcExecutionTestUtils extends TestCase{
                assertEquals(expected.getUuid(), reached.getUuid());\r
                assertEquals(expected.getType(), reached.getType());\r
                assertEquals(expected.logAsString(), reached.logAsString());\r
-               //assertEquals(expected.getBegin(), reached.getBegin());\r
+               assertDateSec(expected.getBegin(), reached.getBegin());\r
        }\r
 \r
-       private SlcExecutionTestUtils(){\r
-               \r
+       private SlcExecutionTestUtils() {\r
+\r
        }\r
 }\r