use of org.activiti.bpmn.model.FlowElement in project Activiti by Activiti.
the class SubProcessConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof StartEvent);
assertEquals("start1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertTrue(userTask.getCandidateUsers().size() == 1);
assertTrue(userTask.getCandidateGroups().size() == 1);
assertTrue(userTask.getFormProperties().size() == 2);
flowElement = model.getMainProcess().getFlowElement("subprocess1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess1", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
assertTrue(subProcess.getFlowElements().size() == 5);
flowElement = model.getMainProcess().getFlowElement("boundaryEvent1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof BoundaryEvent);
assertEquals("boundaryEvent1", flowElement.getId());
BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
assertNotNull(boundaryEvent.getAttachedToRef());
assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
assertEquals(1, boundaryEvent.getEventDefinitions().size());
assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
}
use of org.activiti.bpmn.model.FlowElement in project Activiti by Activiti.
the class UserTaskConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("usertask");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("usertask", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertEquals("usertask", userTask.getId());
assertEquals("User task", userTask.getName());
assertEquals("testKey", userTask.getFormKey());
assertEquals("40", userTask.getPriority());
assertEquals("2012-11-01", userTask.getDueDate());
assertEquals("defaultCategory", userTask.getCategory());
assertEquals("gonzo", userTask.getOwner());
assertEquals("kermit", userTask.getAssignee());
assertEquals(2, userTask.getCandidateUsers().size());
assertTrue(userTask.getCandidateUsers().contains("kermit"));
assertTrue(userTask.getCandidateUsers().contains("fozzie"));
assertEquals(2, userTask.getCandidateGroups().size());
assertTrue(userTask.getCandidateGroups().contains("management"));
assertTrue(userTask.getCandidateGroups().contains("sales"));
List<FormProperty> formProperties = userTask.getFormProperties();
assertEquals(2, formProperties.size());
FormProperty formProperty = formProperties.get(0);
assertEquals("formId", formProperty.getId());
assertEquals("formName", formProperty.getName());
assertEquals("string", formProperty.getType());
assertEquals("variable", formProperty.getVariable());
assertEquals("${expression}", formProperty.getExpression());
formProperty = formProperties.get(1);
assertEquals("formId2", formProperty.getId());
assertEquals("anotherName", formProperty.getName());
assertEquals("long", formProperty.getType());
assertTrue(StringUtils.isEmpty(formProperty.getVariable()));
assertTrue(StringUtils.isEmpty(formProperty.getExpression()));
List<ActivitiListener> listeners = userTask.getTaskListeners();
assertEquals(3, listeners.size());
ActivitiListener listener = (ActivitiListener) listeners.get(0);
assertTrue(ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(listener.getImplementationType()));
assertEquals("org.test.TestClass", listener.getImplementation());
assertEquals("create", listener.getEvent());
assertEquals(2, listener.getFieldExtensions().size());
assertEquals("testField", listener.getFieldExtensions().get(0).getFieldName());
assertEquals("test", listener.getFieldExtensions().get(0).getStringValue());
listener = (ActivitiListener) listeners.get(1);
assertTrue(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(listener.getImplementationType()));
assertEquals("${someExpression}", listener.getImplementation());
assertEquals("assignment", listener.getEvent());
listener = (ActivitiListener) listeners.get(2);
assertTrue(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(listener.getImplementationType()));
assertEquals("${someDelegateExpression}", listener.getImplementation());
assertEquals("complete", listener.getEvent());
flowElement = model.getMainProcess().getFlowElement("start");
assertTrue(flowElement instanceof StartEvent);
StartEvent startEvent = (StartEvent) flowElement;
assertTrue(startEvent.getOutgoingFlows().size() == 1);
flowElement = model.getMainProcess().getFlowElement("flow1");
assertTrue(flowElement instanceof SequenceFlow);
SequenceFlow flow = (SequenceFlow) flowElement;
assertEquals("flow1", flow.getId());
assertNotNull(flow.getSourceRef());
assertNotNull(flow.getTargetRef());
}
use of org.activiti.bpmn.model.FlowElement in project Activiti by Activiti.
the class FormPropertiesConverterTest method validateModel.
private void validateModel(BpmnModel model) {
assertEquals("formPropertiesProcess", model.getMainProcess().getId());
assertEquals("User registration", model.getMainProcess().getName());
assertEquals(true, model.getMainProcess().isExecutable());
FlowElement startFlowElement = model.getMainProcess().getFlowElement("startNode");
assertNotNull(startFlowElement);
assertTrue(startFlowElement instanceof StartEvent);
StartEvent startEvent = (StartEvent) startFlowElement;
List<FormProperty> formProperties = startEvent.getFormProperties();
assertNotNull(formProperties);
assertEquals("Invalid form properties list: ", 8, formProperties.size());
for (FormProperty formProperty : formProperties) {
if (formProperty.getId().equals("new_property_1")) {
checkFormProperty(formProperty, "v000", true, false, false);
} else if (formProperty.getId().equals("new_property_2")) {
checkFormProperty(formProperty, "v001", true, false, true);
} else if (formProperty.getId().equals("new_property_3")) {
checkFormProperty(formProperty, "v010", true, true, false);
} else if (formProperty.getId().equals("new_property_4")) {
checkFormProperty(formProperty, "v011", true, true, true);
} else if (formProperty.getId().equals("new_property_5")) {
checkFormProperty(formProperty, "v100", true, false, false);
List<Map<String, Object>> formValues = new ArrayList<Map<String, Object>>();
for (FormValue formValue : formProperty.getFormValues()) {
Map<String, Object> formValueMap = new HashMap<String, Object>();
formValueMap.put("id", formValue.getId());
formValueMap.put("name", formValue.getName());
formValues.add(formValueMap);
}
checkFormPropertyFormValues(formValues);
} else if (formProperty.getId().equals("new_property_6")) {
checkFormProperty(formProperty, "v101", true, false, true);
} else if (formProperty.getId().equals("new_property_7")) {
checkFormProperty(formProperty, "v110", true, true, false);
} else if (formProperty.getId().equals("new_property_8")) {
checkFormProperty(formProperty, "v111", true, true, true);
} else {
fail("unexpected form property id " + formProperty.getId());
}
}
FlowElement userFlowElement = model.getMainProcess().getFlowElement("userTask");
assertNotNull(userFlowElement);
assertTrue(userFlowElement instanceof UserTask);
UserTask userTask = (UserTask) userFlowElement;
formProperties = userTask.getFormProperties();
assertNotNull(formProperties);
assertEquals("Invalid form properties list: ", 8, formProperties.size());
for (FormProperty formProperty : formProperties) {
if (formProperty.getId().equals("new_property_1")) {
checkFormProperty(formProperty, "v000", false, false, false);
} else if (formProperty.getId().equals("new_property_2")) {
checkFormProperty(formProperty, "v001", false, false, true);
} else if (formProperty.getId().equals("new_property_3")) {
checkFormProperty(formProperty, "v010", false, true, false);
} else if (formProperty.getId().equals("new_property_4")) {
checkFormProperty(formProperty, "v011", false, true, true);
} else if (formProperty.getId().equals("new_property_5")) {
checkFormProperty(formProperty, "v100", true, false, false);
List<Map<String, Object>> formValues = new ArrayList<Map<String, Object>>();
for (FormValue formValue : formProperty.getFormValues()) {
Map<String, Object> formValueMap = new HashMap<String, Object>();
formValueMap.put("id", formValue.getId());
formValueMap.put("name", formValue.getName());
formValues.add(formValueMap);
}
checkFormPropertyFormValues(formValues);
} else if (formProperty.getId().equals("new_property_6")) {
checkFormProperty(formProperty, "v101", true, false, true);
} else if (formProperty.getId().equals("new_property_7")) {
checkFormProperty(formProperty, "v110", true, true, false);
} else if (formProperty.getId().equals("new_property_8")) {
checkFormProperty(formProperty, "v111", true, true, true);
} else {
fail("unexpected form property id " + formProperty.getId());
}
}
}
use of org.activiti.bpmn.model.FlowElement in project Activiti by Activiti.
the class CallActivityConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("callactivity");
assertNotNull(flowElement);
assertTrue(flowElement instanceof CallActivity);
CallActivity callActivity = (CallActivity) flowElement;
assertEquals("callactivity", callActivity.getId());
assertEquals("Call activity", callActivity.getName());
assertEquals("processId", callActivity.getCalledElement());
List<IOParameter> parameters = callActivity.getInParameters();
assertEquals(2, parameters.size());
IOParameter parameter = parameters.get(0);
assertEquals("test", parameter.getSource());
assertEquals("test", parameter.getTarget());
parameter = parameters.get(1);
assertEquals("${test}", parameter.getSourceExpression());
assertEquals("test", parameter.getTarget());
parameters = callActivity.getOutParameters();
assertEquals(1, parameters.size());
parameter = parameters.get(0);
assertEquals("test", parameter.getSource());
assertEquals("test", parameter.getTarget());
}
use of org.activiti.bpmn.model.FlowElement in project Activiti by Activiti.
the class CompleteConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("catchsignal");
assertNotNull(flowElement);
assertTrue(flowElement instanceof IntermediateCatchEvent);
assertEquals("catchsignal", flowElement.getId());
IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
assertEquals(1, catchEvent.getEventDefinitions().size());
assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
assertEquals("testSignal", signalEvent.getSignalRef());
flowElement = model.getMainProcess().getFlowElement("subprocess");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
flowElement = subProcess.getFlowElement("receiveTask");
assertNotNull(flowElement);
assertTrue(flowElement instanceof ReceiveTask);
assertEquals("receiveTask", flowElement.getId());
}
Aggregations