public void run() { try { FileInputStream fis = new FileInputStream(new File(filename)); processEngine.getRepositoryService() .createDeployment() .addInputStream(filename, fis) .deploy(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
public void run() { DeploymentBuilder deploymentbuilder = engine.getRepositoryService().createDeployment(); for(int i = 0; i < modelInstances.size(); i++) { deploymentbuilder.addModelInstance("process"+i+".bpmn", modelInstances.get(i)); } deploymentbuilder.deploy(); }
protected void deployProcess(BpmnModelInstance process) { Deployment deployment = repositoryService.createDeployment() .addModelInstance("testProcess.bpmn", process) .deploy(); deploymentIds.add(deployment.getId()); }
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 } }
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")); } }
protected ProcessInstance deployAndStartProcess(BpmnModelInstance bpmnModelInstance, Map<String, Object> variablesMap) { deploymentId = repositoryService.createDeployment() .addModelInstance("process.bpmn", bpmnModelInstance) .deploy().getId(); String processDefinitionKey = bpmnModelInstance.getDefinitions().getRootElements().iterator().next().getId(); return runtimeService.startProcessInstanceByKey(processDefinitionKey, variablesMap); }
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 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()); } }
@Test public void createDeploymentForAnotherTenant() { identityService.setAuthentication("user", null, null); repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess) .tenantId(TENANT_ONE).deploy(); identityService.clearAuthentication(); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), is(1L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L)); }
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 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 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); }