public void testQueryByInstancesWithoutTenantId() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .withoutTenantId(); assertThat(query.count(), is(1L)); }
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)); }
@Test public void testWithoutTenantIdPostParameter() { mockedQuery = setUpMockHistoricCaseInstanceQuery(Arrays.asList(MockProvider.createMockHistoricCaseInstance(null))); Map<String, Object> queryParameters = new HashMap<String, Object>(); queryParameters.put("withoutTenantId", true); Response response = given() .contentType(POST_JSON_CONTENT_TYPE) .body(queryParameters) .expect() .statusCode(Status.OK.getStatusCode()) .when() .post(HISTORIC_CASE_INSTANCE_RESOURCE_URL); verify(mockedQuery).withoutTenantId(); verify(mockedQuery).list(); String content = response.asString(); List<String> definitions = from(content).getList(""); assertThat(definitions).hasSize(1); String returnedTenantId1 = from(content).getString("[0].tenantId"); assertThat(returnedTenantId1).isEqualTo(null); }
@Test public void testWithoutTenantIdParameter() { mockedQuery = setUpMockHistoricCaseInstanceQuery(Arrays.asList(MockProvider.createMockHistoricCaseInstance(null))); Response response = given() .queryParam("withoutTenantId", true) .then().expect() .statusCode(Status.OK.getStatusCode()) .when() .get(HISTORIC_CASE_INSTANCE_RESOURCE_URL); verify(mockedQuery).withoutTenantId(); verify(mockedQuery).list(); String content = response.asString(); List<String> definitions = from(content).getList(""); assertThat(definitions).hasSize(1); String returnedTenantId1 = from(content).getString("[0].tenantId"); assertThat(returnedTenantId1).isEqualTo(null); }
public void testQueryByInstancesWithoutTenantId() { HistoricCaseInstanceQuery query = historyService .createHistoricCaseInstanceQuery() .withoutTenantId(); assertThat(query.count(), is(1L)); }
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)); }