Examples of BpmnModelInstance


Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

  public void testStartProcessInstanceFails() {

    // given
    createAndDeployModelForClass(getStartProcessInstanceClass());

    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CALLED_PROCESS_DEF_ID)
        .startEvent()
        .scriptTask("scriptTask")
          .scriptFormat("groovy")
          .scriptText("throw new RuntimeException(\"BOOOM!\")")
        .endEvent()
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

  protected abstract Task createModelAccessTask(BpmnModelInstance modelInstance, Class<?> delegateClass);

  // Helper methods //////////////////////////////////////////////

  private void createAndDeployModelForClass(Class<?> delegateClass) {
    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_DEF_KEY)
      .startEvent()
      .manualTask("templateTask")
      .endEvent()
    .done();

    // replace the template task with the actual task provided by the subtask
    modelInstance.getModelElementById("templateTask")
      .replaceWithElement(createModelAccessTask(modelInstance, delegateClass));

    deployModel(modelInstance);
  }
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    assertEquals("bar", property);
  }

  public void testSpinAvailableInBpmn() {

    BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("testProcess")
      .startEvent()
      .serviceTask()
        .camundaExpression("${ execution.setVariable('customer', "
                                + "S(xmlVar).xPath('/customers/customer').element().toString()"
                             +")}")
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    String var = (String) runtimeService.getVariable(pi.getId(), "name");
    assertEquals("test", var);
  }

  protected void deployProcess(String scriptFormat, String scriptText) {
    BpmnModelInstance process = createProcess(scriptFormat, scriptText);
    Deployment deployment = repositoryService.createDeployment()
      .addModelInstance("testProcess.bpmn", process)
      .deploy();
    deploymentId = deployment.getId();
  }
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    repositoryService.deleteDeployment(deployment.getId(), true);
  }

  public void testPartialChangesDeployAll() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();

    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference())
      .name("deployment")
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", model2)
      .deploy();

    BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();

    // second deployment with partial changes:
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference())
      .name("deployment")
      .enableDuplicateFiltering()
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

  /**
   * Test re-deployment of only those resources that have actually changed
   */
  public void testPartialChangesDeployChangedOnly() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();

    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference())
      .name("deployment")
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", model2)
      .deploy();

    BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();

    // second deployment with partial changes:
    ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.getReference())
      .name("deployment")
      .enableDuplicateFiltering(true)
      .resumePreviousVersions()
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", changedModel2)
      .deploy();

    assertEquals(3, repositoryService.createProcessDefinitionQuery().count());

    // there is one version of process1 deployed
    ProcessDefinition processDefinitionModel1 =
        repositoryService
          .createProcessDefinitionQuery()
          .processDefinitionKey("process1")
          .singleResult();

    assertNotNull(processDefinitionModel1);
    assertEquals(1, processDefinitionModel1.getVersion());
    assertEquals(deployment1.getId(), processDefinitionModel1.getDeploymentId());

    // there are two versions of process2 deployed
    List<ProcessDefinition> processDefinitionsModel2 =
        repositoryService
          .createProcessDefinitionQuery()
          .processDefinitionKey("process2")
          .orderByProcessDefinitionVersion().asc().list();

    assertEquals(2, processDefinitionsModel2.size());
    assertEquals(1, processDefinitionsModel2.get(0).getVersion());
    assertEquals(2, processDefinitionsModel2.get(1).getVersion());

    // old deployment was resumed
    ProcessApplicationRegistration registration = deployment2.getProcessApplicationRegistration();
    Set<String> deploymentIds = registration.getDeploymentIds();
    assertEquals(2, deploymentIds.size());

    BpmnModelInstance anotherChangedModel2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done();

    // testing with a third deployment to ensure the change check is not only performed against
    // the last version of the deployment
    ProcessApplicationDeployment deployment3 = repositoryService.createDeployment(processApplication.getReference())
        .enableDuplicateFiltering(true)
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    repositoryService.deleteDeployment(deployment2.getId(), true);
    repositoryService.deleteDeployment(deployment3.getId(), true);
  }

  public void testPartialChangesResumePreviousVersion() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();

    // create initial deployment
    ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.getReference())
      .name("deployment")
      .addModelInstance("process1.bpmn20.xml", model1)
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    repositoryService.deleteDeployment(deploymentId);
  }

  public void testPartialChangesDeployAll() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
    org.camunda.bpm.engine.repository.Deployment deployment1 = repositoryService.createDeployment()
      .enableDuplicateFiltering()
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", model2)
      .name("twice")
      .deploy();

    List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId());
    assertEquals(2, deploymentResources.size());

    BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();

    org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment()
      .enableDuplicateFiltering()
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", changedModel2)
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

    repositoryService.deleteDeployment(deployment1.getId());
    repositoryService.deleteDeployment(deployment2.getId());
  }

  public void testPartialChangesDeployChangedOnly() {
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
    org.camunda.bpm.engine.repository.Deployment deployment1 = repositoryService.createDeployment()
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", model2)
      .name("thrice")
      .deploy();

    List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId());
    assertEquals(2, deploymentResources.size());

    BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();

    org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment()
      .enableDuplicateFiltering(true)
      .addModelInstance("process1.bpmn20.xml", model1)
      .addModelInstance("process2.bpmn20.xml", changedModel2)
      .name("thrice")
      .deploy();

    List<org.camunda.bpm.engine.repository.Deployment> deploymentList = repositoryService.createDeploymentQuery().list();
    assertEquals(2, deploymentList.size());

    // there should be only one version of process 1
    ProcessDefinition process1Definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").singleResult();
    assertNotNull(process1Definition);
    assertEquals(1, process1Definition.getVersion());
    assertEquals(deployment1.getId(), process1Definition.getDeploymentId());

    // there should be two versions of process 2
    assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process2").count());

    BpmnModelInstance anotherChangedModel2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done();

    // testing with a third deployment to ensure the change check is not only performed against
    // the last version of the deployment
    org.camunda.bpm.engine.repository.Deployment deployment3 = repositoryService.createDeployment()
        .enableDuplicateFiltering(true)
View Full Code Here

Examples of org.camunda.bpm.model.bpmn.BpmnModelInstance

  }


  public void testPartialChangesRedeployOldVersion() {
    // deployment 1 deploys process version 1
    BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
    org.camunda.bpm.engine.repository.Deployment deployment1 = repositoryService.createDeployment()
      .addModelInstance("process1.bpmn20.xml", model1)
      .name("deployment")
      .deploy();

    // deployment 2 deploys process version 2
    BpmnModelInstance changedModel1 = Bpmn.createExecutableProcess("process1").startEvent().done();
    org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment()
      .enableDuplicateFiltering(true)
      .addModelInstance("process1.bpmn20.xml", changedModel1)
      .name("deployment")
      .deploy();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.