Package org.camunda.bpm.engine.runtime

Examples of org.camunda.bpm.engine.runtime.ExecutionQuery


  @Deployment
  public void FAILING_testNonInterruptingWithParallelForkInsideEmbeddedSubProcess() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
    runtimeService.messageEventReceived("newMessage", runtimeService.createEventSubscriptionQuery().singleResult().getExecutionId());

    ExecutionQuery executionQuery = runtimeService.createExecutionQuery();

    String forkId = executionQuery
        .activityId("fork")
        .singleResult()
        .getId();

    Execution eventSubProcessTaskExecution = executionQuery
        .activityId("eventSubProcessTask")
        .singleResult();

    ExecutionEntity executionEntity = (ExecutionEntity) eventSubProcessTaskExecution;
    assertEquals(forkId, executionEntity.getParentId());
View Full Code Here


    Map<String, Object> params = Collections.<String, Object>singletonMap("aStartVariableName", "aStartVariableValue");
    ProcessInstance pi = runtimeService
        .startProcessInstanceByKey("TestFixture70.testVariableMigration", params);

    ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(pi.getId());
    JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());
    TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(pi.getId());

    Execution execution = executionQuery.singleResult();
    Job job = jobQuery.singleResult();

    // add a variable
    runtimeService.setVariableLocal(execution.getId(), "aVariableName", "aVariableValue");

    // execute available job
    managementService.executeJob(job.getId());

    // update execution reference
    execution = executionQuery.singleResult();

    // update variable
    runtimeService.setVariableLocal(execution.getId(), "aVariableName", "newVariableValue");

    // add another new variable
View Full Code Here

    // get process instance
    ProcessInstance pi = processInstanceQuery.processDefinitionKey(key).singleResult();

    VariableInstanceQuery variableInstanceQuery = getClearVariableInstanceQuery(pi.getId());
    ExecutionQuery executionQuery = runtimeService.createExecutionQuery().processInstanceId(pi.getId());
    TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(pi.getId());
    JobQuery jobQuery = managementService.createJobQuery().processInstanceId(pi.getId());

    Task task = taskQuery.singleResult();

    // there should be five variable instance (3 process instance variables) and...
    Assert.assertEquals(5, variableInstanceQuery.count());

    // ...2 task variable
    Assert.assertEquals(2, variableInstanceQuery.taskIdIn(task.getId()).count());

    // add a new task variable
    taskService.setVariableLocal(task.getId(), "aNewLocalTaskVariableName", "aNewLockTaskVariableValue");

    // change task variable value
    taskService.setVariableLocal(task.getId(), "aLocalTaskVariableName", "aNewValue");

    Assert.assertEquals(3, variableInstanceQuery.taskIdIn(task.getId()).count());

    // complete task
    taskService.complete(task.getId());

    variableInstanceQuery = getClearVariableInstanceQuery(pi.getId());

    // there should be three variables...
    Assert.assertEquals(3, variableInstanceQuery.count());

    Execution execution = executionQuery.singleResult();

    // update existing variable
    runtimeService.setVariableLocal(execution.getId(), "anotherVariableName", "aNewFinalValue");

    Job job = jobQuery.singleResult();
View Full Code Here

    assertEquals(0, query.count());
  }

  public void testQueryByProcessInstanceId() {
    for (String processInstanceId : concurrentProcessInstanceIds) {
      ExecutionQuery query =  runtimeService.createExecutionQuery().processInstanceId(processInstanceId);
      assertEquals(3, query.list().size());
      assertEquals(3, query.count());
    }
    assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(sequentialProcessInstanceIds.get(0)).list().size());
  }
View Full Code Here

    }
    assertEquals(1, runtimeService.createExecutionQuery().processInstanceId(sequentialProcessInstanceIds.get(0)).list().size());
  }

  public void testQueryByInvalidProcessInstanceId() {
    ExecutionQuery query = runtimeService.createExecutionQuery().processInstanceId("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

    Execution execution = runtimeService.createExecutionQuery().processDefinitionKey(SEQUENTIAL_PROCESS_KEY).singleResult();
    assertNotNull(runtimeService.createExecutionQuery().executionId(execution.getId()));
  }

  public void testQueryByInvalidExecutionId() {
    ExecutionQuery query = runtimeService.createExecutionQuery().executionId("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }

  public void testQueryByActivityId() {
    ExecutionQuery query = runtimeService.createExecutionQuery().activityId("receivePayment");
    assertEquals(4, query.list().size());
    assertEquals(4, query.count());

    try {
      assertNull(query.singleResult());
      fail();
    } catch (ProcessEngineException e) { }
  }
View Full Code Here

      fail();
    } catch (ProcessEngineException e) { }
  }

  public void testQueryByInvalidActivityId() {
    ExecutionQuery query = runtimeService.createExecutionQuery().activityId("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

    vars = new HashMap<String, Object>();
    vars.put("stringVar", "azerty");
    ProcessInstance processInstance3 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);

    // Test EQUAL on single string variable, should result in 2 matches
    ExecutionQuery query = runtimeService.createExecutionQuery().variableValueEquals("stringVar", "abcdef");
    List<Execution> executions = query.list();
    Assert.assertNotNull(executions);
    Assert.assertEquals(2, executions.size());

    // Test EQUAL on two string variables, should result in single match
    query = runtimeService.createExecutionQuery().variableValueEquals("stringVar", "abcdef").variableValueEquals("stringVar2", "ghijkl");
    Execution execution = query.singleResult();
    Assert.assertNotNull(execution);
    Assert.assertEquals(processInstance2.getId(), execution.getId());

    // Test NOT_EQUAL, should return only 1 execution
    execution = runtimeService.createExecutionQuery().variableValueNotEquals("stringVar", "abcdef").singleResult();
View Full Code Here

    vars = new HashMap<String, Object>();
    vars.put("longVar", 55555L);
    ProcessInstance processInstance3 = runtimeService.startProcessInstanceByKey("oneTaskProcess", vars);

    // Query on single long variable, should result in 2 matches
    ExecutionQuery query = runtimeService.createExecutionQuery().variableValueEquals("longVar", 12345L);
    List<Execution> executions = query.list();
    Assert.assertNotNull(executions);
    Assert.assertEquals(2, executions.size());

    // Query on two long variables, should result in single match
    query = runtimeService.createExecutionQuery().variableValueEquals("longVar", 12345L).variableValueEquals("longVar2", 67890L);
    Execution execution = query.singleResult();
    Assert.assertNotNull(execution);
    Assert.assertEquals(processInstance2.getId(), execution.getId());

    // Query with unexisting variable value
    execution = runtimeService.createExecutionQuery().variableValueEquals("longVar", 999L).singleResult();
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.runtime.ExecutionQuery

Copyright © 2018 www.massapicom. 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.