use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method testCasePlanModel.
/**
* +-----------------+ +-----------------+
* | Case1 \ | aCaseDefinition |
* +-------------------+---+ +-----------------+
* | | |
* | | ==> +-----------------+
* | | | aCasePlanModel |
* | | +-----------------+
* | |
* +-----------------------+
*/
@Test
public void testCasePlanModel() {
// given
// when
List<CaseDefinitionEntity> caseDefinitions = transform();
// then
assertEquals(1, caseDefinitions.size());
CmmnCaseDefinition caseModel = caseDefinitions.get(0);
List<CmmnActivity> activities = caseModel.getActivities();
assertEquals(1, activities.size());
CmmnActivity casePlanModelActivity = activities.get(0);
assertEquals(casePlanModel.getId(), casePlanModelActivity.getId());
assertTrue(casePlanModelActivity.getActivities().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method testActivityTreeWithOneHumanTask.
/**
* +-----------------+ +-----------------+
* | Case1 \ | aCaseDefinition |
* +-------------------+---+ +-----------------+
* | | |
* | +-------+ | ==> +-----------------+
* | | A | | | aCasePlanModel |
* | +-------+ | +-----------------+
* | | |
* +-----------------------+ +-----------------+
* | A |
* +-----------------+
*/
@Test
public void testActivityTreeWithOneHumanTask() {
// given
HumanTask humanTask = createElement(casePlanModel, "A", HumanTask.class);
PlanItem planItem = createElement(casePlanModel, "PI_A", PlanItem.class);
planItem.setDefinition(humanTask);
// when
List<CaseDefinitionEntity> caseDefinitions = transform();
// then
assertEquals(1, caseDefinitions.size());
CaseDefinitionEntity caseDefinition = caseDefinitions.get(0);
List<CmmnActivity> activities = caseDefinition.getActivities();
CmmnActivity casePlanModelActivity = activities.get(0);
List<CmmnActivity> planItemActivities = casePlanModelActivity.getActivities();
assertEquals(1, planItemActivities.size());
CmmnActivity child = planItemActivities.get(0);
assertEquals(planItem.getId(), child.getId());
assertTrue(child.getActivities().isEmpty());
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CmmnTransformerTest method transform.
protected List<CaseDefinitionEntity> transform() {
// convert the model to the XML string representation
OutputStream outputStream = new ByteArrayOutputStream();
Cmmn.writeModelToStream(outputStream, modelInstance);
InputStream inputStream = IoUtil.convertOutputStreamToInputStream(outputStream);
byte[] model = org.camunda.bpm.engine.impl.util.IoUtil.readInputStream(inputStream, "model");
ResourceEntity resource = new ResourceEntity();
resource.setBytes(model);
resource.setName("test");
transformer.setResource(resource);
List<CaseDefinitionEntity> definitions = transformer.transform();
IoUtil.closeSilently(outputStream);
IoUtil.closeSilently(inputStream);
return definitions;
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initHistoricVariableUpdateEvt.
protected void initHistoricVariableUpdateEvt(HistoricVariableUpdateEventEntity evt, VariableInstanceEntity variableInstance, HistoryEventType eventType) {
// init properties
evt.setEventType(eventType.getEventName());
evt.setTimestamp(ClockUtil.getCurrentTime());
evt.setVariableInstanceId(variableInstance.getId());
evt.setProcessInstanceId(variableInstance.getProcessInstanceId());
evt.setExecutionId(variableInstance.getExecutionId());
evt.setCaseInstanceId(variableInstance.getCaseInstanceId());
evt.setCaseExecutionId(variableInstance.getCaseExecutionId());
evt.setTaskId(variableInstance.getTaskId());
evt.setRevision(variableInstance.getRevision());
evt.setVariableName(variableInstance.getName());
evt.setSerializerName(variableInstance.getSerializerName());
evt.setTenantId(variableInstance.getTenantId());
evt.setUserOperationId(Context.getCommandContext().getOperationId());
ExecutionEntity execution = variableInstance.getExecution();
if (execution != null) {
ProcessDefinitionEntity definition = execution.getProcessDefinition();
if (definition != null) {
evt.setProcessDefinitionId(definition.getId());
evt.setProcessDefinitionKey(definition.getKey());
}
}
CaseExecutionEntity caseExecution = variableInstance.getCaseExecution();
if (caseExecution != null) {
CaseDefinitionEntity definition = (CaseDefinitionEntity) caseExecution.getCaseDefinition();
if (definition != null) {
evt.setCaseDefinitionId(definition.getId());
evt.setCaseDefinitionKey(definition.getKey());
}
}
// copy value
evt.setTextValue(variableInstance.getTextValue());
evt.setTextValue2(variableInstance.getTextValue2());
evt.setDoubleValue(variableInstance.getDoubleValue());
evt.setLongValue(variableInstance.getLongValue());
if (variableInstance.getByteArrayValueId() != null) {
evt.setByteValue(variableInstance.getByteArrayValue());
}
}
use of org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity in project camunda-bpm-platform by camunda.
the class CaseHandlerTest method testHistoryTimeToLive.
@Test
public void testHistoryTimeToLive() {
// given: a caseDefinition
Integer historyTimeToLive = 6;
caseDefinition.setCamundaHistoryTimeToLive(historyTimeToLive);
// when
CaseDefinitionEntity activity = (CaseDefinitionEntity) handler.handleElement(caseDefinition, context);
// then
assertEquals(Integer.valueOf(historyTimeToLive), activity.getHistoryTimeToLive());
}
Aggregations