public void testFailQueryByTenantIdNull() { try { historyService.createHistoricCaseInstanceQuery() .tenantIdIn((String) null); fail("expected exception"); } catch (NullValueException e) { } }
public void testQueryByNonExistingTenantId() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery(); 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() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE); assertThat(query.count(), is(1L)); query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_TWO); assertThat(query.count(), is(1L)); }
public void testQueryByTenantIds() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(2L)); }
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)); }
public void testQuerySortingDesc() { // exclude historic case instances without tenant id because of database-specific ordering List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .desc() .list(); assertThat(historicCaseInstances.size(), is(2)); assertThat(historicCaseInstances.get(0).getTenantId(), is(TENANT_TWO)); assertThat(historicCaseInstances.get(1).getTenantId(), is(TENANT_ONE)); }
public void testQuerySortingAsc() { // exclude historic case instances without tenant id because of database-specific ordering List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .asc() .list(); assertThat(historicCaseInstances.size(), is(2)); assertThat(historicCaseInstances.get(0).getTenantId(), is(TENANT_ONE)); assertThat(historicCaseInstances.get(1).getTenantId(), is(TENANT_TWO)); }
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
@Test public void testTenantIdListPostParameter() { mockedQuery = setUpMockHistoricCaseInstanceQuery(createMockHistoricCaseInstancesTwoTenants()); 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_CASE_INSTANCE_RESOURCE_URL); verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID); verify(mockedQuery).list(); String content = response.asString(); List<String> historicCaseInstances = from(content).getList(""); assertThat(historicCaseInstances).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 = setUpMockHistoricCaseInstanceQuery(createMockHistoricCaseInstancesTwoTenants()); Response response = given() .queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID_LIST) .then().expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_CASE_INSTANCE_RESOURCE_URL); verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID, MockProvider.ANOTHER_EXAMPLE_TENANT_ID); verify(mockedQuery).list(); String content = response.asString(); List<String> historicCaseInstances = from(content).getList(""); assertThat(historicCaseInstances).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.createHistoricCaseInstanceQuery() .tenantIdIn((String) null); fail("expected exception"); } catch (NullValueException e) { } }
public void testQueryByTenantId() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE); assertThat(query.count(), is(1L)); query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_TWO); assertThat(query.count(), is(1L)); }
public void testQueryByTenantIds() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO); assertThat(query.count(), is(2L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery(); 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 testQueryByNonExistingTenantId() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .tenantIdIn("nonExisting"); assertThat(query.count(), is(0L)); }
public void testQuerySortingAsc() { // exclude historic case instances without tenant id because of database-specific ordering List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .asc() .list(); assertThat(historicCaseInstances.size(), is(2)); assertThat(historicCaseInstances.get(0).getTenantId(), is(TENANT_ONE)); assertThat(historicCaseInstances.get(1).getTenantId(), is(TENANT_TWO)); }
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)); }
public void testQuerySortingDesc() { // exclude historic case instances without tenant id because of database-specific ordering List<HistoricCaseInstance> historicCaseInstances = historyService.createHistoricCaseInstanceQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .orderByTenantId() .desc() .list(); assertThat(historicCaseInstances.size(), is(2)); assertThat(historicCaseInstances.get(0).getTenantId(), is(TENANT_TWO)); assertThat(historicCaseInstances.get(1).getTenantId(), is(TENANT_ONE)); }