use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricCaseInstanceTest method testQueryByInvalidSuperProcessInstanceId.
public void testQueryByInvalidSuperProcessInstanceId() {
HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
query.superProcessInstanceId("invalid");
assertEquals(0, query.count());
assertEquals(0, query.list().size());
query.caseInstanceId(null);
assertEquals(0, query.count());
assertEquals(0, query.list().size());
}
use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricCaseInstanceRestServiceQueryTest method testCaseQueryNotClosedAsPost.
@Test
public void testCaseQueryNotClosedAsPost() {
List<HistoricCaseInstance> mockedHistoricCaseInstances = MockProvider.createMockRunningHistoricCaseInstances();
HistoricCaseInstanceQuery mockedHistoricCaseInstanceQuery = mock(HistoricCaseInstanceQuery.class);
when(mockedHistoricCaseInstanceQuery.list()).thenReturn(mockedHistoricCaseInstances);
when(processEngine.getHistoryService().createHistoricCaseInstanceQuery()).thenReturn(mockedHistoricCaseInstanceQuery);
Map<String, Boolean> body = new HashMap<String, Boolean>();
body.put("notClosed", true);
Response response = given().contentType(POST_JSON_CONTENT_TYPE).body(body).then().expect().statusCode(Status.OK.getStatusCode()).when().post(HISTORIC_CASE_INSTANCE_RESOURCE_URL);
InOrder inOrder = inOrder(mockedHistoricCaseInstanceQuery);
inOrder.verify(mockedHistoricCaseInstanceQuery).notClosed();
inOrder.verify(mockedHistoricCaseInstanceQuery).list();
String content = response.asString();
List<String> instances = from(content).getList("");
Assert.assertEquals(1, instances.size());
Assert.assertNotNull(instances.get(0));
String returnedCaseInstanceId = from(content).getString("[0].id");
String returnedCloseTime = from(content).getString("[0].closeTime");
Assert.assertEquals(MockProvider.EXAMPLE_CASE_INSTANCE_ID, returnedCaseInstanceId);
Assert.assertEquals(null, returnedCloseTime);
}
use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricCaseInstanceQueryTest method testQueryAuthenticatedTenants.
public void testQueryAuthenticatedTenants() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO));
HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
assertThat(query.count(), is(3L));
assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
assertThat(query.tenantIdIn(TENANT_TWO).count(), is(1L));
assertThat(query.withoutTenantId().count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricCaseInstanceQueryTest method testQueryNoTenantIdSet.
public void testQueryNoTenantIdSet() {
HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
assertThat(query.count(), is(3L));
}
use of org.camunda.bpm.engine.history.HistoricCaseInstanceQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyHistoricCaseInstanceQueryTest method testQueryNoAuthenticatedTenants.
public void testQueryNoAuthenticatedTenants() {
identityService.setAuthentication("user", null, null);
HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery();
assertThat(query.count(), is(1L));
}
Aggregations