]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.core/src/test/java/org/argeo/slc/core/process/SlcExecutionTestUtils.java
INtroduce tree test result web service (not working yet)
[gpl/argeo-slc.git] / org.argeo.slc.core / src / test / java / org / argeo / slc / core / process / SlcExecutionTestUtils.java
1 package org.argeo.slc.core.process;
2
3 import java.util.UUID;
4
5 import static junit.framework.Assert.assertEquals;
6 import static junit.framework.Assert.assertNotNull;
7 import static org.argeo.slc.unit.UnitUtils.assertDateSec;
8
9 public abstract class SlcExecutionTestUtils {
10
11 public static SlcExecution createSimpleSlcExecution() {
12 SlcExecution slcExec = new SlcExecution();
13 slcExec.setUuid(UUID.randomUUID().toString());
14 slcExec.setHost("localhost");
15 slcExec.setUser("user");
16 slcExec.setType("slcAnt");
17 slcExec.setStatus("STARTED");
18 slcExec.getAttributes().put("ant.file", "/test");
19 return slcExec;
20 }
21
22 public static void assertSlcExecution(SlcExecution expected,
23 SlcExecution reached) {
24 assertNotNull(reached);
25 assertEquals(expected.getHost(), reached.getHost());
26 assertEquals(expected.getUser(), reached.getUser());
27 assertEquals(expected.getType(), reached.getType());
28 assertEquals(expected.getStatus(), reached.getStatus());
29 assertEquals(expected.getAttributes().size(), reached.getAttributes()
30 .size());
31 for (String key : expected.getAttributes().keySet()) {
32 String expectedValue = expected.getAttributes().get(key);
33 String reachedValue = reached.getAttributes().get(key);
34 assertNotNull(reachedValue);
35 assertEquals(expectedValue, reachedValue);
36 }
37 }
38
39 public static void assertSlcExecutionStep(SlcExecutionStep expected,
40 SlcExecutionStep reached) {
41 assertNotNull(reached);
42 assertEquals(expected.getUuid(), reached.getUuid());
43 assertEquals(expected.getType(), reached.getType());
44 assertEquals(expected.logAsString(), reached.logAsString());
45 assertDateSec(expected.getBegin(), reached.getBegin());
46 }
47
48 private SlcExecutionTestUtils() {
49
50 }
51 }