Search in sources :

Example 21 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition 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 22 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition 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 23 with DecisionRequirementsDefinition

use of org.camunda.bpm.engine.repository.DecisionRequirementsDefinition 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 24 with DecisionRequirementsDefinition

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

the class HistoricDecisionInstanceQueryTest method testQueryByDecisionRequirementsDefinitionId.

@Deployment(resources = { DRG_DMN })
public void testQueryByDecisionRequirementsDefinitionId() {
    decisionService.evaluateDecisionTableByKey(DISH_DECISION).variables(Variables.createVariables().putValue("temperature", 21).putValue("dayType", "Weekend")).evaluate();
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
    HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
    assertThat(query.decisionRequirementsDefinitionId("notExisting").count(), is(0L));
    assertThat(query.decisionRequirementsDefinitionId(decisionRequirementsDefinition.getId()).count(), is(3L));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) NativeHistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with DecisionRequirementsDefinition

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

the class MockDecisionRequirementsDefinitionBuilder method build.

public DecisionRequirementsDefinition build() {
    DecisionRequirementsDefinition mockDefinition = mock(DecisionRequirementsDefinition.class);
    when(mockDefinition.getId()).thenReturn(id);
    when(mockDefinition.getCategory()).thenReturn(category);
    when(mockDefinition.getName()).thenReturn(name);
    when(mockDefinition.getKey()).thenReturn(key);
    when(mockDefinition.getVersion()).thenReturn(version);
    when(mockDefinition.getResourceName()).thenReturn(resource);
    when(mockDefinition.getDiagramResourceName()).thenReturn(diagramResource);
    when(mockDefinition.getDeploymentId()).thenReturn(deploymentId);
    when(mockDefinition.getTenantId()).thenReturn(tenantId);
    return mockDefinition;
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)

Aggregations

DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)40 Test (org.junit.Test)25 HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)13 DecisionRequirementsDefinitionQuery (org.camunda.bpm.engine.repository.DecisionRequirementsDefinitionQuery)9 Deployment (org.camunda.bpm.engine.test.Deployment)6 InputStream (java.io.InputStream)5 Response (com.jayway.restassured.response.Response)2 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)2 GetDeploymentResourceCmd (org.camunda.bpm.engine.impl.cmd.GetDeploymentResourceCmd)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 DecisionService (org.camunda.bpm.engine.DecisionService)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1 RepositoryService (org.camunda.bpm.engine.RepositoryService)1 NotFoundException (org.camunda.bpm.engine.exception.NotFoundException)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 NullValueException (org.camunda.bpm.engine.exception.NullValueException)1 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)1 NativeHistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.NativeHistoricDecisionInstanceQuery)1