use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method testDeployEmptyDecisionDefinition.
@Test
public void testDeployEmptyDecisionDefinition() throws Exception {
// given empty decision model
DmnModelInstance modelInstance = Dmn.createEmptyModel();
Definitions definitions = modelInstance.newInstance(Definitions.class);
definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
modelInstance.setDefinitions(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.getDeployedDecisionDefinitions());
assertNull(deployment.getDeployedDecisionRequirementsDefinitions());
// and there are no persisted definitions
assertNull(repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult());
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DecisionDefinitionDeployerTest method testDeployAndGetDecisionDefinition.
@Test
public void testDeployAndGetDecisionDefinition() throws Exception {
// 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
List<DecisionDefinition> deployedDecisionDefinitions = deployment.getDeployedDecisionDefinitions();
assertEquals(1, deployedDecisionDefinitions.size());
assertNull(deployment.getDeployedDecisionRequirementsDefinitions());
assertNull(deployment.getDeployedProcessDefinitions());
assertNull(deployment.getDeployedCaseDefinitions());
// and persisted definition are equal to deployed definition
DecisionDefinition persistedDecisionDef = repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult();
assertEquals(persistedDecisionDef.getId(), deployedDecisionDefinitions.get(0).getId());
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class DmnModelElementInstanceCmdTest method testRepositoryService.
@Deployment(resources = "org/camunda/bpm/engine/test/repository/one.dmn")
public void testRepositoryService() {
String decisionDefinitionId = repositoryService.createDecisionDefinitionQuery().decisionDefinitionKey(DECISION_KEY).singleResult().getId();
DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
assertNotNull(modelInstance);
Collection<Decision> decisions = modelInstance.getModelElementsByType(Decision.class);
assertEquals(1, decisions.size());
Collection<DecisionTable> decisionTables = modelInstance.getModelElementsByType(DecisionTable.class);
assertEquals(1, decisionTables.size());
Collection<Input> inputs = modelInstance.getModelElementsByType(Input.class);
assertEquals(1, inputs.size());
Collection<Output> outputs = modelInstance.getModelElementsByType(Output.class);
assertEquals(1, outputs.size());
Collection<Rule> rules = modelInstance.getModelElementsByType(Rule.class);
assertEquals(2, rules.size());
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method getDmnModelInstanceDisabledTenantCheck.
@Test
public void getDmnModelInstanceDisabledTenantCheck() {
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
assertThat(modelInstance, notNullValue());
}
use of org.camunda.bpm.model.dmn.DmnModelInstance in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionDefinitionCmdsTenantCheckTest method getDmnModelInstanceWithAuthenticatedTenant.
@Test
public void getDmnModelInstanceWithAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
DmnModelInstance modelInstance = repositoryService.getDmnModelInstance(decisionDefinitionId);
assertThat(modelInstance, notNullValue());
}
Aggregations