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