use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldRejectDeploymentIfOneResourceIsNotValid.
@Test
public void shouldRejectDeploymentIfOneResourceIsNotValid() {
// given
final WorkflowDefinition invalidDefinition = Bpmn.createExecutableWorkflow("process").done();
final List<Map<String, Object>> resources = Arrays.asList(deploymentResource(bpmnXml(WORKFLOW), "process1.bpmn"), deploymentResource(bpmnXml(invalidDefinition), "process2.bpmn"));
// when
final ExecuteCommandResponse resp = apiRule.createCmdRequest().partitionId(Protocol.SYSTEM_PARTITION).eventType(EventType.DEPLOYMENT_EVENT).command().put(PROP_STATE, "CREATE").put("topicName", ClientApiRule.DEFAULT_TOPIC_NAME).put("resources", resources).done().sendAndAwait();
// then
assertThat(resp.key()).isGreaterThanOrEqualTo(0L);
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "REJECTED");
assertThat((String) resp.getEvent().get("errorMessage")).contains("Resource 'process2.bpmn':").contains("The process must contain at least one none start event.");
}
use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldRejectDeploymentIfConditionIsInvalid.
@Test
public void shouldRejectDeploymentIfConditionIsInvalid() {
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway().sequenceFlow(s -> s.condition("foobar")).endEvent().sequenceFlow(s -> s.defaultFlow()).endEvent().done();
// when
final ExecuteCommandResponse resp = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, definition);
// then
assertThat(resp.key()).isGreaterThanOrEqualTo(0L);
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "REJECTED");
assertThat((String) resp.getEvent().get("errorMessage")).contains("The condition 'foobar' is not valid");
}
use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class WorkflowTaskIOMappingTest method shouldNotDeployIfOutputMappingIsNotValid.
@Test
public void shouldNotDeployIfOutputMappingIsNotValid() throws Throwable {
// given
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("process").startEvent().serviceTask("service", t -> t.taskType("external").output(NODE_STRING_KEY, "")).endEvent().done();
final ExecuteCommandResponse response = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, definition);
assertThat(response.getEvent().get(PROP_STATE)).isEqualTo("REJECTED");
}
use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class WorkflowTaskIOMappingTest method shouldNotMapPayloadToWorkflowIfOutMappingMapsRootAndOtherPath.
@Test
public void shouldNotMapPayloadToWorkflowIfOutMappingMapsRootAndOtherPath() throws Throwable {
// given
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("process").startEvent().serviceTask("service", t -> t.taskType("external").output(NODE_STRING_PATH, NODE_ROOT_PATH).output(NODE_JSON_OBJECT_PATH, NODE_JSON_OBJECT_PATH)).endEvent().done();
// when
final ExecuteCommandResponse response = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, definition);
// then
assertThat(response.getEvent().get(PROP_STATE)).isEqualTo("REJECTED");
assertThat(response.getEvent().get(PROP_ERRO_MSG).toString()).contains("Target mapping: root mapping is not allowed because it would override other mapping.");
}
use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class WorkflowTaskIOMappingTest method shouldNotDeployIfInputMappingIsNotValid.
@Test
public void shouldNotDeployIfInputMappingIsNotValid() throws Throwable {
// given
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("process").startEvent().serviceTask("service", t -> t.taskType("external").input("$.*", NODE_ROOT_PATH)).endEvent().done();
// when
final ExecuteCommandResponse response = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, definition);
// then
assertThat(response.getEvent().get(PROP_STATE)).isEqualTo("REJECTED");
assertThat(response.getEvent().get(PROP_ERRO_MSG).toString()).contains("Source mapping: JSON path '$.*' contains prohibited expression");
}
Aggregations