Search in sources :

Example 26 with BpmnModelInstance

use of io.camunda.zeebe.model.bpmn.BpmnModelInstance in project zeebe by camunda.

the class BusinessRuleTaskValidationTest method emptyResultVariable.

@Test
void emptyResultVariable() {
    // when
    final BpmnModelInstance process = process(task -> task.zeebeCalledDecisionId("decisionId").zeebeResultVariable(""));
    // then
    ProcessValidationUtil.assertThatProcessHasViolations(process, ExpectedValidationResult.expect(ZeebeCalledDecision.class, "Attribute 'resultVariable' must be present and not empty"));
}
Also used : ZeebeCalledDecision(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeCalledDecision) BpmnModelInstance(io.camunda.zeebe.model.bpmn.BpmnModelInstance) Test(org.junit.jupiter.api.Test)

Example 27 with BpmnModelInstance

use of io.camunda.zeebe.model.bpmn.BpmnModelInstance in project zeebe by camunda.

the class BusinessRuleTaskValidationTest method noCalledDecisionAndTaskDefinitionExtension.

@Test
void noCalledDecisionAndTaskDefinitionExtension() {
    // when
    final BpmnModelInstance process = process(task -> {
    });
    // then
    ProcessValidationUtil.assertThatProcessHasViolations(process, ExpectedValidationResult.expect(BusinessRuleTask.class, "Must have either one 'zeebe:calledDecision' or one 'zeebe:taskDefinition' extension element"));
}
Also used : BusinessRuleTask(io.camunda.zeebe.model.bpmn.instance.BusinessRuleTask) BpmnModelInstance(io.camunda.zeebe.model.bpmn.BpmnModelInstance) Test(org.junit.jupiter.api.Test)

Example 28 with BpmnModelInstance

use of io.camunda.zeebe.model.bpmn.BpmnModelInstance in project zeebe by camunda.

the class ModelWalkerTest method shouldVisitTypeHiearchyInOrder.

@Test
public void shouldVisitTypeHiearchyInOrder() {
    // given
    final BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent("start-1").userTask("user-1").endEvent("end-1").done();
    final ModelWalker walker = new ModelWalker(modelInstance);
    final List<Class<?>> visitedUserTaskTypes = new ArrayList<>();
    final TypeHierarchyVisitor visitor = new TypeHierarchyVisitor() {

        @Override
        protected void visit(final ModelElementType implementedType, final BpmnModelElementInstance instance) {
            if (instance instanceof UserTask) {
                visitedUserTaskTypes.add(implementedType.getInstanceType());
            }
        }
    };
    // when
    walker.walk(visitor);
    // then
    assertThat(visitedUserTaskTypes).containsExactly(BaseElement.class, FlowElement.class, FlowNode.class, Activity.class, Task.class, UserTask.class);
}
Also used : ModelElementType(org.camunda.bpm.model.xml.type.ModelElementType) BpmnModelElementInstance(io.camunda.zeebe.model.bpmn.instance.BpmnModelElementInstance) ArrayList(java.util.ArrayList) UserTask(io.camunda.zeebe.model.bpmn.instance.UserTask) BpmnModelInstance(io.camunda.zeebe.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 29 with BpmnModelInstance

use of io.camunda.zeebe.model.bpmn.BpmnModelInstance in project zeebe by camunda.

the class ZeebeJobWorkerElementValidationTest method validStaticJobTypeAndRetries.

@ParameterizedTest
@MethodSource("jobWorkerElementBuilderProvider")
@DisplayName("element with static job type and retries")
void validStaticJobTypeAndRetries(final JobWorkerElementBuilder elementBuilder) {
    final BpmnModelInstance process = processWithJobWorkerElement(elementBuilder, element -> element.zeebeJobType("service").zeebeJobRetries("5"));
    ProcessValidationUtil.assertThatProcessIsValid(process);
}
Also used : BpmnModelInstance(io.camunda.zeebe.model.bpmn.BpmnModelInstance) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) DisplayName(org.junit.jupiter.api.DisplayName)

Example 30 with BpmnModelInstance

use of io.camunda.zeebe.model.bpmn.BpmnModelInstance in project zeebe by camunda.

the class ZeebeJobWorkerElementValidationTest method validCustomHeader.

@ParameterizedTest
@MethodSource("jobWorkerElementBuilderProvider")
@DisplayName("element with custom header")
void validCustomHeader(final JobWorkerElementBuilder elementBuilder) {
    final BpmnModelInstance process = processWithJobWorkerElement(elementBuilder, element -> element.zeebeJobType("service").zeebeTaskHeader("priority", "high"));
    ProcessValidationUtil.assertThatProcessIsValid(process);
}
Also used : BpmnModelInstance(io.camunda.zeebe.model.bpmn.BpmnModelInstance) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)442 Test (org.junit.Test)336 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)204 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)184 RecordingExporter (io.camunda.zeebe.test.util.record.RecordingExporter)166 Rule (org.junit.Rule)163 EngineRule (io.camunda.zeebe.engine.util.EngineRule)157 Record (io.camunda.zeebe.protocol.record.Record)142 ProcessInstanceIntent (io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)139 BpmnElementType (io.camunda.zeebe.protocol.record.value.BpmnElementType)136 List (java.util.List)126 ClassRule (org.junit.ClassRule)124 ProcessInstanceRecordValue (io.camunda.zeebe.protocol.record.value.ProcessInstanceRecordValue)121 Assertions.tuple (org.assertj.core.api.Assertions.tuple)121 Map (java.util.Map)99 JobIntent (io.camunda.zeebe.protocol.record.intent.JobIntent)97 Duration (java.time.Duration)96 Collectors (java.util.stream.Collectors)90 ProcessBuilder (io.camunda.zeebe.model.bpmn.builder.ProcessBuilder)79 MessageSubscriptionIntent (io.camunda.zeebe.protocol.record.intent.MessageSubscriptionIntent)78