public virtual void testRepositoryService() { string decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_KEY).singleResult().Id; DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId); assertNotNull(modelInstance); ICollection <Decision> decisions = modelInstance.getModelElementsByType(typeof(Decision)); assertEquals(1, decisions.Count); ICollection <DecisionTable> decisionTables = modelInstance.getModelElementsByType(typeof(DecisionTable)); assertEquals(1, decisionTables.Count); ICollection <Input> inputs = modelInstance.getModelElementsByType(typeof(Input)); assertEquals(1, inputs.Count); ICollection <Output> outputs = modelInstance.getModelElementsByType(typeof(Output)); assertEquals(1, outputs.Count); ICollection <Rule> rules = modelInstance.getModelElementsByType(typeof(Rule)); assertEquals(2, rules.Count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getDmnModelInstanceWithAuthenticatedTenant() public virtual void getDmnModelInstanceWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId); assertThat(modelInstance, notNullValue()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void getDmnModelInstanceDisabledTenantCheck() public virtual void getDmnModelInstanceDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId); assertThat(modelInstance, notNullValue()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployDmnModelInstance() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployDmnModelInstance() { // given DmnModelInstance dmnModelInstance = createDmnModelInstance(); // when testRule.deploy(repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance)); // then assertNotNull(repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult()); }
public virtual DeploymentBuilder addModelInstance(string resourceName, DmnModelInstance modelInstance) { ensureNotNull("modelInstance", modelInstance); validateResouceName(resourceName, DecisionDefinitionDeployer.DMN_RESOURCE_SUFFIXES); MemoryStream outputStream = new MemoryStream(); Dmn.writeModelToStream(outputStream, modelInstance); return(addBytes(resourceName, outputStream.toByteArray())); }
public virtual void testGetDmnModelInstance() { // given string decisionDefinitionId = selectDecisionDefinitionByKey(DECISION_DEFINITION_KEY).Id; createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ); // when DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId); // then assertNotNull(modelInstance); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployDmnModelInstanceNegativeHistoryTimeToLive() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployDmnModelInstanceNegativeHistoryTimeToLive() { // given DmnModelInstance dmnModelInstance = createDmnModelInstanceNegativeHistoryTimeToLive(); try { testRule.deploy(repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance)); fail("Exception for negative time to live value is expected."); } catch (ProcessEngineException ex) { assertTrue(ex.InnerException.Message.contains("negative value is not allowed")); } }
protected internal static DmnModelInstance createDmnModelInstance() { DmnModelInstance modelInstance = Dmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); definitions.Id = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Name = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Namespace = DmnModelConstants.CAMUNDA_NS; modelInstance.Definitions = definitions; Decision decision = modelInstance.newInstance(typeof(Decision)); decision.Id = "Decision-1"; decision.Name = "foo"; decision.CamundaHistoryTimeToLive = 5; modelInstance.Definitions.addChildElement(decision); DecisionTable decisionTable = modelInstance.newInstance(typeof(DecisionTable)); decisionTable.Id = DmnModelConstants.DMN_ELEMENT_DECISION_TABLE; decisionTable.HitPolicy = HitPolicy.FIRST; decision.addChildElement(decisionTable); Input input = modelInstance.newInstance(typeof(Input)); input.Id = "Input-1"; input.Label = "Input"; decisionTable.addChildElement(input); InputExpression inputExpression = modelInstance.newInstance(typeof(InputExpression)); inputExpression.Id = "InputExpression-1"; Text inputExpressionText = modelInstance.newInstance(typeof(Text)); inputExpressionText.TextContent = "input"; inputExpression.Text = inputExpressionText; inputExpression.TypeRef = "string"; input.InputExpression = inputExpression; Output output = modelInstance.newInstance(typeof(Output)); output.Name = "output"; output.Label = "Output"; output.TypeRef = "string"; decisionTable.addChildElement(output); return(modelInstance); }
protected internal static DmnModelInstance createDmnModelInstanceNegativeHistoryTimeToLive() { DmnModelInstance modelInstance = Dmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); definitions.Id = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Name = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Namespace = DmnModelConstants.CAMUNDA_NS; modelInstance.Definitions = definitions; Decision decision = modelInstance.newInstance(typeof(Decision)); decision.Id = "Decision-1"; decision.Name = "foo"; decision.CamundaHistoryTimeToLive = -5; modelInstance.Definitions.addChildElement(decision); return(modelInstance); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployEmptyDecisionDefinition() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployEmptyDecisionDefinition() { // given empty decision model DmnModelInstance modelInstance = Dmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); definitions.Id = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Name = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Namespace = DmnModelConstants.CAMUNDA_NS; modelInstance.Definitions = definitions; // when decision model is deployed DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addModelInstance("foo.dmn", modelInstance); DeploymentWithDefinitions deployment = testRule.deploy(deploymentBuilder); // then deployment contains no definitions assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and there are no persisted definitions assertNull(repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployAndGetDecisionDefinition() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployAndGetDecisionDefinition() { // given decision model DmnModelInstance dmnModelInstance = createDmnModelInstance(); // when decision model is deployed DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance); DeploymentWithDefinitions deployment = testRule.deploy(deploymentBuilder); // then deployment contains definition IList <DecisionDefinition> deployedDecisionDefinitions = deployment.DeployedDecisionDefinitions; assertEquals(1, deployedDecisionDefinitions.Count); assertNull(deployment.DeployedDecisionRequirementsDefinitions); assertNull(deployment.DeployedProcessDefinitions); assertNull(deployment.DeployedCaseDefinitions); // and persisted definition are equal to deployed definition DecisionDefinition persistedDecisionDef = repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult(); assertEquals(persistedDecisionDef.Id, deployedDecisionDefinitions[0].Id); }