Examples of BpmnModelInstance


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

    assertNull(ModelExecutionContextExecutionListener.modelInstance);
    assertNull(ModelExecutionContextExecutionListener.flowElement);
  }

  private void assertFlowElementIs(Class<? extends FlowElement> elementClass) {
    BpmnModelInstance modelInstance = ModelExecutionContextExecutionListener.modelInstance;
    assertNotNull(modelInstance);

    Model model = modelInstance.getModel();
    Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
    assertEquals(3, events.size());
    Collection<ModelElementInstance> gateways = modelInstance.getModelElementsByType(model.getType(Gateway.class));
    assertEquals(1, gateways.size());
    Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
    assertEquals(1, tasks.size());

    FlowElement flowElement = ModelExecutionContextExecutionListener.flowElement;
    assertNotNull(flowElement);
    assertTrue(elementClass.isAssignableFrom(flowElement.getClass()));
View Full Code Here

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

    String taskId = taskService.createTaskQuery().singleResult().getId();
    taskService.complete(taskId);
  }

  private void deployAndStartTestProcess(String elementId, String eventName) {
    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
      .startEvent(START_ID)
        .sequenceFlowId(SEQUENCE_FLOW_ID)
      .intermediateCatchEvent(CATCH_EVENT_ID)
      .parallelGateway(GATEWAY_ID)
      .userTask(USER_TASK_ID)
      .endEvent(END_ID)
      .done();

    addMessageEventDefinition((CatchEvent) modelInstance.getModelElementById(CATCH_EVENT_ID));
    addExecutionListener((BaseElement) modelInstance.getModelElementById(elementId), eventName);
    deployAndStartProcess(modelInstance);
  }
View Full Code Here

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

    addExecutionListener((BaseElement) modelInstance.getModelElementById(elementId), eventName);
    deployAndStartProcess(modelInstance);
  }

  private void addMessageEventDefinition(CatchEvent catchEvent) {
    BpmnModelInstance modelInstance = (BpmnModelInstance) catchEvent.getModelInstance();
    Message message = modelInstance.newInstance(Message.class);
    message.setId(MESSAGE_ID);
    message.setName(MESSAGE_NAME);
    modelInstance.getDefinitions().addChildElement(message);
    MessageEventDefinition messageEventDefinition = modelInstance.newInstance(MessageEventDefinition.class);
    messageEventDefinition.setMessage(message);
    catchEvent.getEventDefinitions().add(messageEventDefinition);
  }
View Full Code Here

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

  public void testJavaDelegateModelExecutionContext() {
    deploy();

    runtimeService.startProcessInstanceByKey(PROCESS_ID);

    BpmnModelInstance modelInstance = ModelExecutionContextServiceTask.modelInstance;
    assertNotNull(modelInstance);

    Model model = modelInstance.getModel();
    Collection<ModelElementInstance> events = modelInstance.getModelElementsByType(model.getType(Event.class));
    assertEquals(2, events.size());
    Collection<ModelElementInstance> tasks = modelInstance.getModelElementsByType(model.getType(Task.class));
    assertEquals(1, tasks.size());

    Process process = (Process) modelInstance.getDefinitions().getRootElements().iterator().next();
    assertEquals(PROCESS_ID, process.getId());
    assertTrue(process.isExecutable());

    ServiceTask serviceTask = ModelExecutionContextServiceTask.serviceTask;
    assertNotNull(serviceTask);
View Full Code Here

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

    assertNotNull(serviceTask);
    assertEquals(ModelExecutionContextServiceTask.class.getName(), serviceTask.getCamundaClass());
  }

  private void deploy() {
    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
      .startEvent()
      .serviceTask()
        .camundaClass(ModelExecutionContextServiceTask.class.getName())
      .endEvent()
      .done();
View Full Code Here

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

      processEngineConfiguration.setEnableScriptCompilation(true);
    }
  }

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

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

  public static final String EXAMPLE_SCRIPT = "execution.setVariable('foo', S('<bar/>').name())";

  public String processInstanceId;

  protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) {
    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
      .startEvent()
      .scriptTask()
        .scriptFormat(scriptFormat)
        .scriptText(scriptText)
        .userTask()
View Full Code Here

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

  public static final String EXPECTED_RESULT = "Hello world!";

  public String processInstanceId;

  protected static StringAsset createScriptTaskProcess(String scriptFormat, String scriptText) {
    BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(PROCESS_ID)
      .startEvent()
      .scriptTask()
        .scriptFormat(scriptFormat)
        .scriptText(scriptText)
        .camundaResultVariable(RESULT_VARIABLE)
View Full Code Here

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

    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
      .processDefinitionKey(TEST_PROCESS)
      .singleResult();

    BpmnModelInstance bpmnModelInstance = repositoryService.getBpmnModelInstance(processDefinition.getId());
    Assert.assertNotNull(bpmnModelInstance);

  }
View Full Code Here

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

  private static final String TEST_PROCESS = "testProcess";

  @Deployment
  public static WebArchive createProcessApplication() {
    BpmnModelInstance process = Bpmn.createExecutableProcess(TEST_PROCESS)
        .startEvent()
        .serviceTask()
          .camundaDelegateExpression("${bpmnElementRetrievalDelegate}")
      .done();
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.