Search in sources :

Example 6 with DecisionRequirementsDefinitionQuery

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery in project camunda-bpm-platform by camunda.

the class DecisionRequirementsDefinitionQueryAuthorizationTest method queryDecisionRequirementsDefinitions.

@Test
@Deployment(resources = { DMN_FILE, ANOTHER_DMN })
public void queryDecisionRequirementsDefinitions() {
    // when
    authRule.init(scenario).withUser("userId").bindResource("decisionRequirementsDefinitionKey", DEFINITION_KEY).start();
    DecisionRequirementsDefinitionQuery query = engineRule.getRepositoryService().createDecisionRequirementsDefinitionQuery();
    long count = query.count();
    // then
    if (authRule.assertScenario(scenario)) {
        assertThat(count, is((long) expectedDefinitionKeys.length));
        List<String> definitionKeys = getDefinitionKeys(query.list());
        assertThat(definitionKeys, hasItems(expectedDefinitionKeys));
    }
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 7 with DecisionRequirementsDefinitionQuery

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery in project camunda-bpm-platform by camunda.

the class RepositoryServiceTest method testGetDecisionRequirementsModel.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/drg.dmn" })
public void testGetDecisionRequirementsModel() throws Exception {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    DecisionRequirementsDefinition decisionRequirementsDefinition = query.singleResult();
    String decisionRequirementsDefinitionId = decisionRequirementsDefinition.getId();
    InputStream decisionRequirementsModel = repositoryService.getDecisionRequirementsModel(decisionRequirementsDefinitionId);
    assertNotNull(decisionRequirementsModel);
    byte[] readInputStream = IoUtil.readInputStream(decisionRequirementsModel, "decisionRequirementsModel");
    String model = new String(readInputStream, "UTF-8");
    assertTrue(model.contains("<definitions id=\"dish\" name=\"Dish\" namespace=\"test-drg\""));
    IoUtil.closeSilently(decisionRequirementsModel);
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 8 with DecisionRequirementsDefinitionQuery

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery in project camunda-bpm-platform by camunda.

the class RepositoryServiceTest method testGetDecisionRequirementsDiagram.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/drg.dmn", "org/camunda/bpm/engine/test/repository/drg.png" })
public void testGetDecisionRequirementsDiagram() throws Exception {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    DecisionRequirementsDefinition decisionRequirementsDefinition = query.singleResult();
    String decisionRequirementsDefinitionId = decisionRequirementsDefinition.getId();
    InputStream actualDrd = repositoryService.getDecisionRequirementsDiagram(decisionRequirementsDefinitionId);
    assertNotNull(actualDrd);
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) InputStream(java.io.InputStream) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 9 with DecisionRequirementsDefinitionQuery

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery in project camunda-bpm-platform by camunda.

the class RepositoryServiceTest method testGetDecisionRequirementsDefinition.

@Deployment(resources = { "org/camunda/bpm/engine/test/repository/drg.dmn" })
public void testGetDecisionRequirementsDefinition() {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    DecisionRequirementsDefinition decisionRequirementsDefinition = query.singleResult();
    String decisionRequirementsDefinitionId = decisionRequirementsDefinition.getId();
    DecisionRequirementsDefinition definition = repositoryService.getDecisionRequirementsDefinition(decisionRequirementsDefinitionId);
    assertNotNull(definition);
    assertEquals(decisionRequirementsDefinitionId, definition.getId());
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with DecisionRequirementsDefinitionQuery

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery in project camunda-bpm-platform by camunda.

the class DecisionRequirementsDefinitionQueryTest method queryByDecisionRequirementsDefinitionCategoryLike.

@Test
public void queryByDecisionRequirementsDefinitionCategoryLike() {
    DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery();
    assertThat(query.decisionRequirementsDefinitionCategoryLike("%notExisting%").count(), is(0L));
    assertThat(query.decisionRequirementsDefinitionCategoryLike("%test%").count(), is(3L));
    assertThat(query.decisionRequirementsDefinitionCategoryLike("%z\\_").count(), is(1L));
}
Also used : DecisionRequirementsDefinitionQuery(org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery) Test(org.junit.Test)

Aggregations

DecisionRequirementsDefinitionQuery (org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)37 Test (org.junit.Test)31 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)9 Deployment (org.camunda.bpm.engine.test.Deployment)4 InputStream (java.io.InputStream)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 DecisionRequirementsDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionQueryDto)2 ArrayList (java.util.ArrayList)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 DecisionRequirementsDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.DecisionRequirementsDefinitionDto)1