public void testQueryByTenantIdsIncludeDeploymentsWithoutTenantId() { DeploymentQuery query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_ONE) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(2L)); query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_TWO) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(2L)); query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(3L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); DeploymentQuery query = repositoryService.createDeploymentQuery(); 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).includeDeploymentsWithoutTenantId().count(), is(2L)); }
@Test public void testDeploymentTenantIdIncludeDefinitionsWithoutTenantid() { List<Deployment> mockDeployments = Arrays.asList( MockProvider.createMockDeployment(null), MockProvider.createMockDeployment(MockProvider.EXAMPLE_TENANT_ID)); mockedQuery = setUpMockDeploymentQuery(mockDeployments); Response response = given() .queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID) .queryParam("includeDeploymentsWithoutTenantId", true) .then().expect() .statusCode(Status.OK.getStatusCode()) .when() .get(DEPLOYMENT_QUERY_URL); verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID); verify(mockedQuery).includeDeploymentsWithoutTenantId(); verify(mockedQuery).list(); String content = response.asString(); List<String> definitions = from(content).getList(""); assertThat(definitions).hasSize(2); String returnedTenantId1 = from(content).getString("[0].tenantId"); String returnedTenantId2 = from(content).getString("[1].tenantId"); assertThat(returnedTenantId1).isEqualTo(null); assertThat(returnedTenantId2).isEqualTo(MockProvider.EXAMPLE_TENANT_ID); }
public void testQueryByTenantIdsIncludeDeploymentsWithoutTenantId() { DeploymentQuery query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_ONE) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(2L)); query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_TWO) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(2L)); query = repositoryService .createDeploymentQuery() .tenantIdIn(TENANT_ONE, TENANT_TWO) .includeDeploymentsWithoutTenantId(); assertThat(query.count(), is(3L)); }
public void testQueryAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); DeploymentQuery query = repositoryService.createDeploymentQuery(); 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).includeDeploymentsWithoutTenantId().count(), is(2L)); }