use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class JobDefinitionCreationBothAsyncWithParseListenerTest method testCreateBothJobDefinitionWithParseListenerAndAsyncBeforeInXml.
@Test
public void testCreateBothJobDefinitionWithParseListenerAndAsyncBeforeInXml() {
// given the asyncBefore is set in the xml
String modelFileName = "jobAsyncBeforeCreationWithinParseListener.bpmn20.xml";
InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
// when the asyncBefore and asyncAfter is set to true in the parse listener
Deployment deployment = builder.deploy();
engineRule.manageDeployment(deployment);
// then there exists two job definitions
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
List<JobDefinition> definitions = query.orderByJobConfiguration().asc().list();
assertEquals(definitions.size(), 2);
// asyncAfter
JobDefinition asyncAfterAfter = definitions.get(0);
assertEquals(asyncAfterAfter.getProcessDefinitionKey(), "oneTaskProcess");
assertEquals(asyncAfterAfter.getActivityId(), "servicetask1");
assertEquals(asyncAfterAfter.getJobConfiguration(), MessageJobDeclaration.ASYNC_AFTER);
// asyncBefore
JobDefinition asyncAfterBefore = definitions.get(1);
assertEquals(asyncAfterBefore.getProcessDefinitionKey(), "oneTaskProcess");
assertEquals(asyncAfterBefore.getActivityId(), "servicetask1");
assertEquals(asyncAfterBefore.getJobConfiguration(), MessageJobDeclaration.ASYNC_BEFORE);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class JobDefinitionDeletionWithParseListenerTest method testDeleteJobDefinitionWithParseListenerAndAsyncInXml.
@Test
public void testDeleteJobDefinitionWithParseListenerAndAsyncInXml() {
// given the asyncBefore is set in the xml
String modelFileName = "jobAsyncBeforeCreationWithinParseListener.bpmn20.xml";
InputStream in = JobDefinitionCreationWithParseListenerTest.class.getResourceAsStream(modelFileName);
DeploymentBuilder builder = engineRule.getRepositoryService().createDeployment().addInputStream(modelFileName, in);
// when the asyncBefore is set to false in the parse listener
Deployment deployment = builder.deploy();
engineRule.manageDeployment(deployment);
// then there exists no job definition
JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery();
assertNull(query.singleResult());
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class ServiceTaskPerformanceTest method threeServiceTasksAndAGateway.
@Test
public void threeServiceTasksAndAGateway() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("approved", true);
BpmnModelInstance process = Bpmn.createExecutableProcess("process").startEvent().serviceTask().camundaClass(NoopDelegate.class.getName()).exclusiveGateway("decision").condition("approved", "${approved}").serviceTask().camundaClass(NoopDelegate.class.getName()).moveToLastGateway().condition("not approved", "${not approved}").serviceTask().camundaClass(NoopDelegate.class.getName()).endEvent().done();
Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", process).deploy();
performanceTest().step(new StartProcessInstanceStep(engine, "process", variables)).run();
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class SpinFunctionMapperTest method testSpinAvailableInBpmn.
public void testSpinAvailableInBpmn() {
BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("testProcess").startEvent().serviceTask().camundaExpression("${ execution.setVariable('customer', " + "S(xmlVar).xPath('/customers/customer').element().toString()" + ")}").receiveTask("wait").endEvent().done();
Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", bpmnModelInstance).deploy();
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("xmlVar", "<customers><customer /></customers>");
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess", variables);
String customerXml = (String) runtimeService.getVariable(pi.getId(), "customer");
assertNotNull(customerXml);
assertTrue(customerXml.contains("customer"));
assertFalse(customerXml.contains("customers"));
runtimeService.signal(pi.getId());
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.camunda.bpm.engine.repository.Deployment in project camunda-bpm-platform by camunda.
the class SpinScriptTaskSupportWithAutoStoreScriptVariablesTest method deployProcess.
protected void deployProcess(String scriptFormat, String scriptText) {
BpmnModelInstance process = createProcess(scriptFormat, scriptText);
Deployment deployment = repositoryService.createDeployment().addModelInstance("testProcess.bpmn", process).addString("testScript.txt", scriptText).deploy();
deploymentId = deployment.getId();
}
Aggregations