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