public void testFailQueryByTenantIdNull() { try { historyService.createHistoricProcessInstanceQuery() .tenantIdIn((String) null); fail("expected exception"); } catch (NullValueException e) { } }
public void testQueryByNonExistingTenantId() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L)); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L)); }
public void testQueryByTenantIds() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(2L)); }
public void testQueryByTenantId() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE); assertThat(query.count(), is(1L)); query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_TWO); assertThat(query.count(), is(1L)); }
public void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); 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)); }
public void testQuerySortingAsc() { List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .asc() .list(); assertThat(historicProcessInstances.size(), is(2)); assertThat(historicProcessInstances.get(0).getTenantId(), is(TENANT_ONE)); assertThat(historicProcessInstances.get(1).getTenantId(), is(TENANT_TWO)); }
public void testQuerySortingDesc() { List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .desc() .list(); assertThat(historicProcessInstances.size(), is(2)); assertThat(historicProcessInstances.get(0).getTenantId(), is(TENANT_TWO)); assertThat(historicProcessInstances.get(1).getTenantId(), is(TENANT_ONE)); }
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
@Test public void testTenantIdListPostParameter() { mockedQuery = setUpMockHistoricProcessInstanceQuery(createMockHistoricProcessInstancesTwoTenants()); Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST.split(",")); Response response = given() .contentType(POST_JSON_CONTENT_TYPE) .body(queryParameters) .expect() .statusCode(Status.OK.getStatusCode()) .when() .post(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL); verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID); verify(mockedQuery).list(); String content = response.asString(); List<String> executions = from(content).getList(""); assertThat(executions).hasSize(2); String returnedTenantId1 = from(content).getString("[0].tenantId"); String returnedTenantId2 = from(content).getString("[1].tenantId"); assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID); assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID); }
@Test public void testTenantIdListParameter() { mockedQuery = setUpMockHistoricProcessInstanceQuery(createMockHistoricProcessInstancesTwoTenants()); Response response = given() .queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST) .then().expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_PROCESS_INSTANCE_RESOURCE_URL); verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID); verify(mockedQuery).list(); String content = response.asString(); List<String> executions = from(content).getList(""); assertThat(executions).hasSize(2); String returnedTenantId1 = from(content).getString("[0].tenantId"); String returnedTenantId2 = from(content).getString("[1].tenantId"); assertThat(returnedTenantId1).isEqualTo(MockProvider.EXAMPLE_TENANT_ID); assertThat(returnedTenantId2).isEqualTo(MockProvider.ANOTHER_EXAMPLE_TENANT_ID); }
public void testFailQueryByTenantIdNull() { try { historyService.createHistoricProcessInstanceQuery() .tenantIdIn((String) null); fail("expected exception"); } catch (NullValueException e) { } }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Collections.singletonList(TENANT_ONE)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); assertThat(query.count(), is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L)); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count(), is(1L)); }
public void testQueryByTenantId() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE); assertThat(query.count(), is(1L)); query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_TWO); assertThat(query.count(), is(1L)); }
public void testQueryByTenantIds() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(2L)); }
public void testQueryByNonExistingTenantId() { HistoricProcessInstanceQuery query = historyService .createHistoricProcessInstanceQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
public void testQuerySortingAsc() { List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .asc() .list(); assertThat(historicProcessInstances.size(), is(2)); assertThat(historicProcessInstances.get(0).getTenantId(), is(TENANT_ONE)); assertThat(historicProcessInstances.get(1).getTenantId(), is(TENANT_TWO)); }
public void testQuerySortingDesc() { List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .desc() .list(); assertThat(historicProcessInstances.size(), is(2)); assertThat(historicProcessInstances.get(0).getTenantId(), is(TENANT_TWO)); assertThat(historicProcessInstances.get(1).getTenantId(), is(TENANT_ONE)); }
public void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); 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)); }