tests
This commit is contained in:
parent
4079bee3f4
commit
bdeaef3b8e
|
@ -12,6 +12,10 @@ import java.util.stream.Collectors;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public class WorkflowTemplate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5919290887480115842L;
|
||||
|
@ -42,6 +46,7 @@ public class WorkflowTemplate implements Serializable {
|
|||
BOOLEAN
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public static class WfParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5885589803738655166L;
|
||||
|
@ -115,6 +120,7 @@ public class WorkflowTemplate implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public static class Node implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3695762832959801906L;
|
||||
|
@ -233,6 +239,7 @@ public class WorkflowTemplate implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public static class Arc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7866138976929522262L;
|
||||
|
@ -268,6 +275,7 @@ public class WorkflowTemplate implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
@JsonInclude(Include.NON_NULL)
|
||||
public static class NodeParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7815785723401725707L;
|
||||
|
@ -278,6 +286,34 @@ public class WorkflowTemplate implements Serializable {
|
|||
private String property;
|
||||
private String env;
|
||||
|
||||
public static NodeParam newRefParam(final String name, final String ref) {
|
||||
final NodeParam np = new NodeParam();
|
||||
np.setName(name);
|
||||
np.setRef(ref);
|
||||
return np;
|
||||
}
|
||||
|
||||
public static NodeParam newSimpleParam(final String name, final String value) {
|
||||
final NodeParam np = new NodeParam();
|
||||
np.setName(name);
|
||||
np.setValue(value);
|
||||
return np;
|
||||
}
|
||||
|
||||
public static NodeParam newPropertyParam(final String name, final String property) {
|
||||
final NodeParam np = new NodeParam();
|
||||
np.setName(name);
|
||||
np.setProperty(property);
|
||||
return np;
|
||||
}
|
||||
|
||||
public static NodeParam newEnvParam(final String name, final String envProp) {
|
||||
final NodeParam np = new NodeParam();
|
||||
np.setName(name);
|
||||
np.setEnv(envProp);
|
||||
return np;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate.Arc;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate.Node;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate.NodeParam;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate.WfParam;
|
||||
import eu.dnetlib.manager.wf.model.WorkflowTemplate.WfParamType;
|
||||
|
||||
|
@ -29,12 +30,16 @@ class WorkflowTemplateTest {
|
|||
private Node n2;
|
||||
private Node n3;
|
||||
|
||||
private NodeParam np1;
|
||||
private NodeParam np2;
|
||||
|
||||
private Arc a12;
|
||||
private Arc a13;
|
||||
private Arc a23;
|
||||
private Arc a3succ;
|
||||
|
||||
private @BeforeEach void setUp() throws Exception {
|
||||
@BeforeEach
|
||||
private void setUp() throws Exception {
|
||||
|
||||
a12 = new Arc("N2");
|
||||
a13 = new Arc("N3");
|
||||
|
@ -45,11 +50,15 @@ class WorkflowTemplateTest {
|
|||
p2 = new WfParam("Age", WfParamType.NUMBER);
|
||||
p3 = new WfParam("Birthday", "Your Birthday", WfParamType.DATE, "1900-01-01", false);
|
||||
|
||||
np1 = NodeParam.newRefParam("Age", "Age");
|
||||
np1 = NodeParam.newSimpleParam("Test", "test");
|
||||
|
||||
n1 = new Node("N1", true);
|
||||
n1.setArcs(Arrays.asList(a12, a13));
|
||||
|
||||
n2 = new Node("N2", "T2");
|
||||
n2.setArcs(Arrays.asList(a23));
|
||||
n2.setInput(Arrays.asList(np1, np2));
|
||||
|
||||
n3 = new Node("N3");
|
||||
n2.setArcs(Arrays.asList(a3succ));
|
||||
|
|
Loading…
Reference in New Issue