Examples of ProcessInstanceQuery


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

      assertTextPresent("Set of process instance ids is null", re.getMessage());
    }
  }

  public void testQueryByActive() throws Exception {
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();

    assertEquals(5, processInstanceQuery.active().count());

    repositoryService.suspendProcessDefinitionByKey("oneTaskProcess");

    assertEquals(5, processInstanceQuery.active().count());

    repositoryService.suspendProcessDefinitionByKey("oneTaskProcess", true, null);

    assertEquals(1, processInstanceQuery.active().count());

    // db cleanup
    TestHelper.clearOpLog(processEngineConfiguration);
  }
View Full Code Here

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

    // db cleanup
    TestHelper.clearOpLog(processEngineConfiguration);
  }

  public void testQueryBySuspeded() throws Exception {
    ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();

    assertEquals(0, processInstanceQuery.suspended().count());

    repositoryService.suspendProcessDefinitionByKey("oneTaskProcess");

    assertEquals(0, processInstanceQuery.suspended().count());

    repositoryService.suspendProcessDefinitionByKey("oneTaskProcess", true, null);

    assertEquals(4, processInstanceQuery.suspended().count());

    // db cleanup
    TestHelper.clearOpLog(processEngineConfiguration);
}
View Full Code Here

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

    assertEquals(1, processInstanceList.size());
  }

  public void testQueryByInvalidIncidentId() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();

    assertEquals(0, query.incidentId("invalid").count());

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

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

    assertEquals(1, processInstanceList.size());
  }

  public void testQueryByInvalidIncidentType() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();

    assertEquals(0, query.incidentType("invalid").count());

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

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

    assertEquals(1, processInstanceList.size());
  }

  public void testQueryByInvalidIncidentMessage() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();

    assertEquals(0, query.incidentMessage("invalid").count());

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

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

    assertEquals(1, processInstanceList.size());
  }

  public void testQueryByInvalidIncidentMessageLike() {
    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();

    assertEquals(0, query.incidentMessageLike("invalid").count());

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

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

    caseService
      .withCaseExecution(processTaskId)
      .manualStart();

    ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery();

    query.caseInstanceId(caseInstanceId);

    assertEquals(1, query.count());

    List<ProcessInstance> result = query.list();
    assertEquals(1, result.size());

    ProcessInstance processInstance = result.get(0);
    assertEquals(caseInstanceId, processInstance.getCaseInstanceId());
  }
View Full Code Here

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

  }

  @Test
  public void testGetSingleInstance() {
    ProcessInstance mockInstance = MockProvider.createMockInstance();
    ProcessInstanceQuery sampleInstanceQuery = mock(ProcessInstanceQuery.class);
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
    when(sampleInstanceQuery.processInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)).thenReturn(sampleInstanceQuery);
    when(sampleInstanceQuery.singleResult()).thenReturn(mockInstance);

    given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
      .then().expect().statusCode(Status.OK.getStatusCode())
      .body("id", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID))
      .body("ended", equalTo(MockProvider.EXAMPLE_PROCESS_INSTANCE_IS_ENDED))
View Full Code Here

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

      .when().get(SINGLE_PROCESS_INSTANCE_URL);
  }

  @Test
  public void testGetNonExistingProcessInstance() {
    ProcessInstanceQuery sampleInstanceQuery = mock(ProcessInstanceQuery.class);
    when(runtimeServiceMock.createProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
    when(sampleInstanceQuery.processInstanceId(anyString())).thenReturn(sampleInstanceQuery);
    when(sampleInstanceQuery.singleResult()).thenReturn(null);

    given().pathParam("id", "aNonExistingInstanceId")
      .then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON)
      .body("type", equalTo(InvalidRequestException.class.getSimpleName()))
      .body("message", equalTo("Process instance with id aNonExistingInstanceId does not exist"))
View Full Code Here

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

  public void setUpRuntimeData() {
    mockedQuery = setUpMockInstanceQuery(createMockInstanceList());
  }

  private ProcessInstanceQuery setUpMockInstanceQuery(List<ProcessInstance> mockedInstances) {
    ProcessInstanceQuery sampleInstanceQuery = mock(ProcessInstanceQuery.class);
    when(sampleInstanceQuery.list()).thenReturn(mockedInstances);
    when(sampleInstanceQuery.count()).thenReturn((long) mockedInstances.size());
    when(processEngine.getRuntimeService().createProcessInstanceQuery()).thenReturn(sampleInstanceQuery);
    return sampleInstanceQuery;
  }
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.