@Test public void removeVariablesWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.removeVariable(caseExecutionId, VARIABLE_NAME); identityService.clearAuthentication(); Map<String, Object> variables = caseService.getVariables(caseExecutionId); assertThat(variables.isEmpty(), is(true)); }
@Test public void removeVariablesDisabledTenantCheck() { identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); caseService.removeVariable(caseExecutionId, VARIABLE_NAME); identityService.clearAuthentication(); Map<String, Object> variables = caseService.getVariables(caseExecutionId); assertThat(variables.isEmpty(), is(true)); }
@Test public void setVariableWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.setVariable(caseExecutionId, "newVar", "newValue"); identityService.clearAuthentication(); Map<String, Object> variables = caseService.getVariables(caseExecutionId); assertThat(variables, notNullValue()); assertThat(variables.keySet(), hasItems(VARIABLE_NAME, "newVar")); }
@Test public void manuallyStartCaseExecutionWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.manuallyStartCaseExecution(caseExecutionId); identityService.clearAuthentication(); CaseExecution caseExecution = getCaseExecution(); assertThat(caseExecution.isActive(), is(true)); }
@Test public void setVariableDisabledTenantCheck() { identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); caseService.setVariable(caseExecutionId, "newVar", "newValue"); identityService.clearAuthentication(); Map<String, Object> variables = caseService.getVariables(caseExecutionId); assertThat(variables, notNullValue()); assertThat(variables.keySet(), hasItems(VARIABLE_NAME, "newVar")); }
@Test public void disableCaseExecutionWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.disableCaseExecution(caseExecutionId); identityService.clearAuthentication(); HistoricCaseActivityInstance historicCaseActivityInstance = getHistoricCaseActivityInstance(); assertThat(historicCaseActivityInstance, notNullValue()); assertThat(historicCaseActivityInstance.isDisabled(), is(true)); }
@Test public void manuallyStartCaseExecutionDisabledTenantCheck() { identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); caseService.manuallyStartCaseExecution(caseExecutionId); identityService.clearAuthentication(); CaseExecution caseExecution = getCaseExecution(); assertThat(caseExecution.isActive(), is(true)); }
@Test public void reenableCaseExecutionWithAuthenticatedTenant() { caseService.disableCaseExecution(caseExecutionId); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.reenableCaseExecution(caseExecutionId); identityService.clearAuthentication(); CaseExecution caseExecution = getCaseExecution(); assertThat(caseExecution.isEnabled(), is(true)); }
@Test public void disableCaseExecutionDisabledTenantCheck() { identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); caseService.disableCaseExecution(caseExecutionId); identityService.clearAuthentication(); HistoricCaseActivityInstance historicCaseActivityInstance = getHistoricCaseActivityInstance(); assertThat(historicCaseActivityInstance, notNullValue()); assertThat(historicCaseActivityInstance.isDisabled(), is(true)); }
@Test public void closeCaseInstanceWithAuthenticatedTenant() { caseService.completeCaseExecution(caseInstanceId); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); caseService.closeCaseInstance(caseInstanceId); identityService.clearAuthentication(); HistoricCaseInstance historicCaseInstance = getHistoricCaseInstance(); assertThat(historicCaseInstance, notNullValue()); assertThat(historicCaseInstance.isClosed(), is(true)); }
@Test public void getVariableTypedWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); StringValue variable = caseService.getVariableTyped(caseExecutionId, VARIABLE_NAME); assertThat(variable.getValue(), is(VARIABLE_VALUE)); }
@Test public void removeVariablesNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot update the case execution"); caseService.removeVariable(caseExecutionId, VARIABLE_NAME); }
@Test public void getVariableTypedDisabledTenantCheck() { identityService.setAuthentication("user", null, null); processEngineConfiguration.setTenantCheckEnabled(false); StringValue variable = caseService.getVariableTyped(caseExecutionId, VARIABLE_NAME); assertThat(variable.getValue(), is(VARIABLE_VALUE)); }
@Test public void setVariableNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot update the case execution"); caseService.setVariable(caseExecutionId, "newVar", "newValue"); }
@Test public void getVariablesNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot get the case execution"); caseService.getVariables(caseExecutionId); }
@Test public void manuallyStartCaseExecutionNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot update the case execution"); caseService.manuallyStartCaseExecution(caseExecutionId); }
@Test public void closeCaseInstanceNoAuthenticatedTenants() { caseService.completeCaseExecution(caseInstanceId); identityService.setAuthentication("user", null, null); thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot update the case execution"); caseService.closeCaseInstance(caseInstanceId); }
@Test public void testQueryAuthenticatedTenant() { DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService .createDecisionRequirementsDefinitionQuery() .tenantIdIn(TENANT_ONE) .singleResult(); identityService.setAuthentication(USER_ID, null, Arrays.asList(TENANT_ONE)); HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery( decisionRequirementsDefinition.getId()); assertThat(query.count(), is(3L)); }
@Test public void testQueryDisabledTenantCheck() { DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService .createDecisionRequirementsDefinitionQuery() .tenantIdIn(TENANT_ONE) .singleResult(); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); identityService.setAuthentication(USER_ID, null, null); HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery( decisionRequirementsDefinition.getId()); assertThat(query.count(), is(3L)); }