use of org.kie.kogito.serverless.workflow.parser.ServerlessWorkflowParser in project kogito-runtimes by kiegroup.
the class ServerlessWorkflowParsingTest method testMinimumWorkflow.
@Test
public void testMinimumWorkflow() {
Workflow workflow = new Workflow();
workflow.setId("javierito");
Start start = new Start();
start.setStateName("javierito");
End end = new End();
end.setTerminate(true);
SleepState startState = new SleepState();
startState.setType(Type.SLEEP);
startState.setDuration("1s");
startState.setName("javierito");
startState.setEnd(end);
workflow.setStates(Collections.singletonList(startState));
workflow.setStart(start);
ServerlessWorkflowParser parser = ServerlessWorkflowParser.of(workflow, JavaKogitoBuildContext.builder().build());
Process process = parser.getProcessInfo().info();
assertSame(process, parser.getProcessInfo().info());
assertEquals(ServerlessWorkflowParser.DEFAULT_NAME, process.getName());
assertEquals(ServerlessWorkflowParser.DEFAULT_VERSION, process.getVersion());
assertEquals(ServerlessWorkflowParser.DEFAULT_PACKAGE, process.getPackageName());
}
use of org.kie.kogito.serverless.workflow.parser.ServerlessWorkflowParser in project kogito-runtimes by kiegroup.
the class AbstractServerlessWorkflowParsingTest method getWorkflowParser.
protected Process getWorkflowParser(String workflowLocation) throws IOException {
String format = workflowLocation.endsWith(".sw.json") ? "json" : "yml";
ServerlessWorkflowParser parser = ServerlessWorkflowParser.of(new InputStreamReader(Objects.requireNonNull(this.getClass().getResourceAsStream(workflowLocation), "Required resource was no found: " + workflowLocation)), format, JavaKogitoBuildContext.builder().build());
return parser.getProcessInfo().info();
}
Aggregations