Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("clientDeployment") public void shouldSwitchContextWhenUsingDecisionServiceAfterRedeployment()
        public virtual void shouldSwitchContextWhenUsingDecisionServiceAfterRedeployment()
        {
            // given
            IList <org.camunda.bpm.engine.repository.Deployment> deployments = repositoryService.createDeploymentQuery().list();

            // find dmn deployment
            org.camunda.bpm.engine.repository.Deployment dmnDeployment = null;
            foreach (org.camunda.bpm.engine.repository.Deployment deployment in deployments)
            {
                IList <string> resourceNames = repositoryService.getDeploymentResourceNames(deployment.Id);
                if (resourceNames.Contains(DMN_RESOURCE_NAME))
                {
                    dmnDeployment = deployment;
                }
            }

            if (dmnDeployment == null)
            {
                Assert.fail("Expected to find DMN deployment");
            }

            org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment().nameFromDeployment(dmnDeployment.Id).addDeploymentResources(dmnDeployment.Id).deploy();

            try
            {
                // when then
                DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables());
                assertEquals("ok", decisionResult.FirstResult.FirstEntry);
            }
            finally
            {
                repositoryService.deleteDeployment(deployment2.Id, true);
            }
        }
Пример #2
0
        public virtual bool evaluate(DelegateCaseExecution caseExecution)
        {
            DecisionService        decisionService = caseExecution.ProcessEngineServices.DecisionService;
            DmnDecisionTableResult result          = evaluateDecision(decisionService, caseExecution);
            DmnDecisionRuleResult  singleResult    = result.SingleResult;

            return((bool?)singleResult.SingleEntry.Value);
        }
Пример #3
0
        protected internal virtual void assertThatDecisionHasExpectedResult(DmnDecisionTableResult decisionResult)
        {
            assertThat(decisionResult, @is(notNullValue()));
            assertThat(decisionResult.size(), @is(1));
            string value = decisionResult.SingleResult.FirstEntry;

            assertThat(value, @is("ok"));
        }
Пример #4
0
        public virtual void evaluateDecisionByKeyAndVersion()
        {
            // given
            DecisionDefinition decisionDefinition = engineRule.RepositoryService.createDecisionDefinitionQuery().singleResult();

            // when
            authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();

            DmnDecisionTableResult decisionResult = engineRule.DecisionService.evaluateDecisionTableByKeyAndVersion(decisionDefinition.Key, decisionDefinition.Version, createVariables());

            // then
            if (authRule.assertScenario(scenario))
            {
                assertThatDecisionHasExpectedResult(decisionResult);
            }
        }
Пример #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @OperateOnDeployment("clientDeployment") public void shouldSwitchContextWhenUsingDecisionService()
        public virtual void shouldSwitchContextWhenUsingDecisionService()
        {
            DmnDecisionTableResult decisionResult = decisionService.evaluateDecisionTableByKey("decision", Variables.createVariables());

            assertEquals("ok", decisionResult.FirstResult.FirstEntry);
        }