protected String deployment(DeploymentBuilder deploymentBuilder, String... resources) { for (int i = 0; i < resources.length; i++) { deploymentBuilder.addClasspathResource(resources[i]); } return deploymentWithBuilder(deploymentBuilder); }
public void testDuplicateAssigneeDeclaration() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testDuplicateAssigneeDeclaration"); repositoryService.createDeployment().addClasspathResource(resource).deploy(); fail("Invalid BPMN 2.0 process should not parse, but it gets parsed sucessfully"); } catch (ProcessEngineException e) { // Exception is to be expected } }
@Test public void duplicateIdInDeployment() { String resourceName1 = "org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDuplicateIdInDeployment.dmn11.xml"; String resourceName2 = "org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDuplicateIdInDeployment2.dmn11.xml"; thrown.expect(ProcessEngineException.class); thrown.expectMessage("duplicateDecision"); repositoryService.createDeployment() .addClasspathResource(resourceName1) .addClasspathResource(resourceName2) .name("duplicateIds") .deploy(); }
@Before public void setup() { repositoryService = activitiRule.getRepositoryService(); deploymentId = repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/api/repository/diagram/" + xmlFileName) .addClasspathResource("org/camunda/bpm/engine/test/api/repository/diagram/" + imageFileName) .deploy() .getId(); processDefinitionQuery = repositoryService.createProcessDefinitionQuery(); }
public void testIllegalUseOfResultVariableName() { try { repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/bpmn/servicetask/JavaServiceTaskTest.testIllegalUseOfResultVariableName.bpmn20.xml").deploy(); fail(); } catch (ProcessEngineException e) { assertTrue(e.getMessage().contains("resultVariable")); } }
public void testInvalidSubProcessWithSignalStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidSubProcessWithSignalStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a signal start event."); } catch (ProcessEngineException e) { assertTextPresent("signalEventDefintion only allowed on start event if subprocess is an event subprocess", e.getMessage()); } }
public void testInvalidSubProcessWithErrorStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidSubProcessWithErrorStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a error start event."); } catch (ProcessEngineException e) { assertTextPresent("errorEventDefinition only allowed on start event if subprocess is an event subprocess", e.getMessage()); } }
public void testInvalidSubProcessWithEscalationStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidSubProcessWithEscalationStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a escalation start event."); } catch (ProcessEngineException e) { assertTextPresent("escalationEventDefinition is not allowed on start event within a subprocess", e.getMessage()); } }
public void testInvalidSubProcessWithCompensationStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidSubProcessWithCompensationStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a compensation start event."); } catch (ProcessEngineException e) { assertTextPresent("compensateEventDefinition is not allowed on start event within a subprocess", e.getMessage()); } }
public void parseInvalidConditionalEvent(String processDefinitionResource) { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), processDefinitionResource); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, conditional event definition contains no condition."); } catch (ProcessEngineException e) { assertTextPresent("Conditional event must contain an expression for evaluation.", e.getMessage()); } }
public void testParseProcessDefinitionNegativTtl() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testParseProcessDefinitionNegativeTtl"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition historyTimeToLive value can not be parsed."); } catch (ProcessEngineException e) { assertTextPresent("Cannot parse historyTimeToLive", e.getMessage()); } }
public void testMIOutputMappingDisallowed() { try { repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/iomapping/InputOutputTest.testMIOutputMappingDisallowed.bpmn20.xml") .deploy(); fail("Exception expected"); } catch (ProcessEngineException e) { assertTextPresent("camunda:outputParameter not allowed for multi-instance constructs", e.getMessage()); } }
public void testInvalidTransactionWithConditionalStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidTransactionWithConditionalStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a conditional start event."); } catch (ProcessEngineException e) { assertTextPresent("conditionalEventDefinition is not allowed on start event within a subprocess", e.getMessage()); } }
public void testInvalidTransactionWithCompensationStartEvent() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidTransactionWithCompensationStartEvent"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail("Exception expected: Process definition could be parsed, although the sub process contains a compensation start event."); } catch (ProcessEngineException e) { assertTextPresent("compensateEventDefinition is not allowed on start event within a subprocess", e.getMessage()); } }
public void testInvalidMapping() { try { deploymentId = repositoryService .createDeployment() .addClasspathResource(INVALID_MAPPING_BPMN) .deploy() .getId(); fail("expect parse exception"); } catch (ProcessEngineException e) { assertTextPresent("No decision result mapper found for name 'invalid'", e.getMessage()); } }
public void testEmptyCamundaOutSourceWithoutValidation() { try { processEngineConfiguration.setDisableStrictCallActivityValidation(true); String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testEmptyCamundaOutSourceThrowsError"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); } finally { processEngineConfiguration.setDisableStrictCallActivityValidation(false); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); } }
@Test public void testDeleteProcessDefinition() { // given deployment with two process definitions in one xml model file deployment = repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/repository/twoProcesses.bpmn20.xml") .deploy(); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().list(); //when a process definition is been deleted repositoryService.deleteProcessDefinition(processDefinitions.get(0).getId()); //then only one process definition should remain assertEquals(1, repositoryService.createProcessDefinitionQuery().count()); }
public void testInvalidProcessDefinition() { try { String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testInvalidProcessDefinition"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); fail(); } catch (ProcessEngineException e) { assertTextPresent("cvc-complex-type.3.2.2:", e.getMessage()); assertTextPresent("invalidAttribute", e.getMessage()); assertTextPresent("process", e.getMessage()); } }
public void testTimerStartEventPriorityOnActivity() { // given a timer start job org.camunda.bpm.engine.repository.Deployment deployment = repositoryService .createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/job/JobPrioritizationBpmnConstantValueTest.testTimerStartEventPriorityOnActivity.bpmn20.xml") .deploy(); Job job = managementService.createJobQuery().singleResult(); // then the timer start job has the priority defined in the process definition assertEquals(1515, job.getPriority()); // cleanup repositoryService.deleteDeployment(deployment.getId(), true); }
public void testParseSwitchedSourceAndTargetRefsForAssociations() { repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/parse/BpmnParseTest.testParseSwitchedSourceAndTargetRefsForAssociations.bpmn20.xml").deploy(); assertEquals(1, repositoryService.createProcessDefinitionQuery().count()); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); }