@Override protected void applyFilters(CleanableHistoricDecisionInstanceReport query) { if (decisionDefinitionIdIn != null && decisionDefinitionIdIn.length > 0) { query.decisionDefinitionIdIn(decisionDefinitionIdIn); } if (decisionDefinitionKeyIn != null && decisionDefinitionKeyIn.length > 0) { query.decisionDefinitionKeyIn(decisionDefinitionKeyIn); } if (Boolean.TRUE.equals(withoutTenantId)) { query.withoutTenantId(); } if (tenantIdIn != null && tenantIdIn.length > 0) { query.tenantIdIn(tenantIdIn); } if (Boolean.TRUE.equals(compact)) { query.compact(); } }
@Override protected void applyFilters(CleanableHistoricDecisionInstanceReport query) { if (decisionDefinitionIdIn != null && decisionDefinitionIdIn.length > 0) { query.decisionDefinitionIdIn(decisionDefinitionIdIn); } if (decisionDefinitionKeyIn != null && decisionDefinitionKeyIn.length > 0) { query.decisionDefinitionKeyIn(decisionDefinitionKeyIn); } if (Boolean.TRUE.equals(withoutTenantId)) { query.withoutTenantId(); } if (tenantIdIn != null && tenantIdIn.length > 0) { query.tenantIdIn(tenantIdIn); } if (Boolean.TRUE.equals(compact)) { query.compact(); } }
protected void verifyQueryParameterInvocations() { verify(historicDecisionInstanceReport).decisionDefinitionIdIn(EXAMPLE_DD_ID, ANOTHER_EXAMPLE_DD_ID); verify(historicDecisionInstanceReport).decisionDefinitionKeyIn(EXAMPLE_DD_KEY, ANOTHER_EXAMPLE_DD_KEY); verify(historicDecisionInstanceReport).tenantIdIn(EXAMPLE_TENANT_ID, ANOTHER_EXAMPLE_TENANT_ID); verify(historicDecisionInstanceReport).withoutTenantId(); verify(historicDecisionInstanceReport).compact(); } }
@Test public void testQueryByTenantId() { given() .queryParam("tenantIdIn", EXAMPLE_TENANT_ID + "," + ANOTHER_EXAMPLE_TENANT_ID) .then() .expect() .statusCode(Status.OK.getStatusCode()) .contentType(ContentType.JSON) .when() .get(HISTORIC_REPORT_URL); verify(historicDecisionInstanceReport).tenantIdIn(EXAMPLE_TENANT_ID, ANOTHER_EXAMPLE_TENANT_ID); verify(historicDecisionInstanceReport).list(); verifyNoMoreInteractions(historicDecisionInstanceReport); }
@Test public void testReportTenantIdInWithAuthenticatedTenants() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); assertEquals(0, reportResultsTwo.size()); }
@Test public void testReportTenantIdInNoAuthenticatedTenants() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, null); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(0, reportResultsOne.size()); assertEquals(0, reportResultsTwo.size()); }
@Test public void testReportTenantIdInDisabledTenantCheck() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); assertEquals(1, reportResultsTwo.size()); assertEquals(TENANT_TWO, reportResultsTwo.get(0).getTenantId()); }
@Test public void testReportTenantIdInWithoutTenantId() { // given testRule.deploy(DMN_MODEL); testRule.deployForTenant(TENANT_ONE, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, null); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); // when List<CleanableHistoricDecisionInstanceReportResult> reportResults = historyService.createCleanableHistoricDecisionInstanceReport().withoutTenantId().list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); // then assertEquals(1, reportResults.size()); assertEquals(null, reportResults.get(0).getTenantId()); assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); }
@Override protected void applyFilters(CleanableHistoricDecisionInstanceReport query) { if (decisionDefinitionIdIn != null && decisionDefinitionIdIn.length > 0) { query.decisionDefinitionIdIn(decisionDefinitionIdIn); } if (decisionDefinitionKeyIn != null && decisionDefinitionKeyIn.length > 0) { query.decisionDefinitionKeyIn(decisionDefinitionKeyIn); } if (Boolean.TRUE.equals(withoutTenantId)) { query.withoutTenantId(); } if (tenantIdIn != null && tenantIdIn.length > 0) { query.tenantIdIn(tenantIdIn); } if (Boolean.TRUE.equals(compact)) { query.compact(); } }
@Test public void testReportTenantIdInWithAuthenticatedTenants() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); assertEquals(0, reportResultsTwo.size()); }
@Test public void testReportTenantIdInNoAuthenticatedTenants() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, null); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(0, reportResultsOne.size()); assertEquals(0, reportResultsTwo.size()); }
@Test public void testReportTenantIdInDisabledTenantCheck() { // given testRule.deployForTenant(TENANT_ONE, DMN_MODEL); testRule.deployForTenant(TENANT_TWO, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_TWO); identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); // when List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsTwo = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_TWO).list(); // then assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); assertEquals(1, reportResultsTwo.size()); assertEquals(TENANT_TWO, reportResultsTwo.get(0).getTenantId()); }
@Test public void testReportTenantIdInWithoutTenantId() { // given testRule.deploy(DMN_MODEL); testRule.deployForTenant(TENANT_ONE, DMN_MODEL); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, null); prepareDecisionInstances(DECISION_DEFINITION_KEY, -6, 5, 10, TENANT_ONE); // when List<CleanableHistoricDecisionInstanceReportResult> reportResults = historyService.createCleanableHistoricDecisionInstanceReport().withoutTenantId().list(); List<CleanableHistoricDecisionInstanceReportResult> reportResultsOne = historyService.createCleanableHistoricDecisionInstanceReport().tenantIdIn(TENANT_ONE).list(); // then assertEquals(1, reportResults.size()); assertEquals(null, reportResults.get(0).getTenantId()); assertEquals(1, reportResultsOne.size()); assertEquals(TENANT_ONE, reportResultsOne.get(0).getTenantId()); }