Search in sources :

Example 56 with Deployment

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);
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) JobDefinition(org.camunda.bpm.engine.management.JobDefinition) Test(org.junit.Test)

Example 57 with Deployment

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());
}
Also used : JobDefinitionQuery(org.camunda.bpm.engine.management.JobDefinitionQuery) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.repository.Deployment) DeploymentBuilder(org.camunda.bpm.engine.repository.DeploymentBuilder) Test(org.junit.Test)

Example 58 with Deployment

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();
}
Also used : StartProcessInstanceStep(org.camunda.bpm.qa.performance.engine.steps.StartProcessInstanceStep) HashMap(java.util.HashMap) NoopDelegate(org.camunda.bpm.qa.performance.engine.bpmn.delegate.NoopDelegate) Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 59 with Deployment

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);
}
Also used : HashMap(java.util.HashMap) Deployment(org.camunda.bpm.engine.repository.Deployment) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Example 60 with Deployment

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();
}
Also used : Deployment(org.camunda.bpm.engine.repository.Deployment) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance)

Aggregations

Deployment (org.camunda.bpm.engine.repository.Deployment)137 Test (org.junit.Test)62 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)39 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)36 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)19 Resource (org.camunda.bpm.engine.repository.Resource)19 InputStream (java.io.InputStream)14 DeploymentBuilder (org.camunda.bpm.engine.repository.DeploymentBuilder)11 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)11 ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)10 UserOperationLogQuery (org.camunda.bpm.engine.history.UserOperationLogQuery)10 JobDefinitionQuery (org.camunda.bpm.engine.management.JobDefinitionQuery)10 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)9 UserOperationLogEntry (org.camunda.bpm.engine.history.UserOperationLogEntry)8 JobDefinition (org.camunda.bpm.engine.management.JobDefinition)8 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Job (org.camunda.bpm.engine.runtime.Job)4 Response (com.jayway.restassured.response.Response)3 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2