use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class CustomNamespaceAttributeConverterTest method validateModel.
private void validateModel(BpmnModel model) {
Process process = model.getMainProcess();
assertNotNull(process.getAttributes());
assertEquals(1, process.getAttributes().size());
List<ExtensionAttribute> attributes = process.getAttributes().get("version");
assertNotNull(attributes);
assertEquals(1, attributes.size());
ExtensionAttribute attribute = attributes.get(0);
//custom:version = "9"
assertNotNull(attribute);
assertEquals("http://custom.org/bpmn", attribute.getNamespace());
assertEquals("custom", attribute.getNamespacePrefix());
assertEquals("version", attribute.getName());
assertEquals("9", attribute.getValue());
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());
Map<String, List<ExtensionAttribute>> attributesMap = userTask.getAttributes();
assertNotNull(attributesMap);
assertEquals(2, attributesMap.size());
attributes = attributesMap.get("id");
assertNotNull(attributes);
assertEquals(1, attributes.size());
ExtensionAttribute a = attributes.get(0);
assertNotNull(a);
assertEquals("id", a.getName());
assertEquals("test", a.getValue());
assertEquals("custom2", a.getNamespacePrefix());
assertEquals("http://custom2.org/bpmn", a.getNamespace());
attributes = attributesMap.get("attr");
assertNotNull(attributes);
assertEquals(1, attributes.size());
a = attributes.get(0);
assertNotNull(a);
assertEquals("attr", a.getName());
assertEquals("attrValue", a.getValue());
assertEquals("custom2", a.getNamespacePrefix());
assertEquals("http://custom2.org/bpmn", a.getNamespace());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class DataObjectConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof StartEvent);
assertEquals("start1", flowElement.getId());
// verify the main process data objects
List<ValuedDataObject> dataObjects = model.getMainProcess().getDataObjects();
assertEquals(7, dataObjects.size());
Map<String, ValuedDataObject> objectMap = new HashMap<String, ValuedDataObject>();
for (ValuedDataObject valueObj : dataObjects) {
objectMap.put(valueObj.getId(), valueObj);
}
ValuedDataObject dataObj = objectMap.get("dObj1");
assertEquals("dObj1", dataObj.getId());
assertEquals("StringTest", dataObj.getName());
assertEquals("xsd:string", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj2");
assertEquals("BooleanTest", dataObj.getName());
assertEquals("xsd:boolean", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj3");
assertEquals("DateTest", dataObj.getName());
assertEquals("xsd:datetime", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj4");
assertEquals("DoubleTest", dataObj.getName());
assertEquals("xsd:double", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj5");
assertEquals("IntegerTest", dataObj.getName());
assertEquals("xsd:int", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj6");
assertEquals("LongTest", dataObj.getName());
assertEquals("xsd:long", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObjWithoutType");
assertEquals("UnknownTypeTest", dataObj.getName());
assertEquals("xsd:string", dataObj.getItemSubjectRef().getStructureRef());
flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertEquals("kermit", userTask.getAssignee());
flowElement = model.getMainProcess().getFlowElement("subprocess1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess1", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
assertEquals(11, subProcess.getFlowElements().size());
// verify the sub process data objects
dataObjects = subProcess.getDataObjects();
assertEquals(6, dataObjects.size());
objectMap = new HashMap<String, ValuedDataObject>();
for (ValuedDataObject valueObj : dataObjects) {
objectMap.put(valueObj.getId(), valueObj);
}
dataObj = objectMap.get("dObj7");
assertEquals("dObj7", dataObj.getId());
assertEquals("StringSubTest", dataObj.getName());
assertEquals("xsd:string", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj8");
assertEquals("dObj8", dataObj.getId());
assertEquals("BooleanSubTest", dataObj.getName());
assertEquals("xsd:boolean", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj9");
assertEquals("dObj9", dataObj.getId());
assertEquals("DateSubTest", dataObj.getName());
assertEquals("xsd:datetime", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj10");
assertEquals("dObj10", dataObj.getId());
assertEquals("DoubleSubTest", dataObj.getName());
assertEquals("xsd:double", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj11");
assertEquals("dObj11", dataObj.getId());
assertEquals("IntegerSubTest", dataObj.getName());
assertEquals("xsd:int", dataObj.getItemSubjectRef().getStructureRef());
dataObj = objectMap.get("dObj12");
assertEquals("dObj12", dataObj.getId());
assertEquals("LongSubTest", dataObj.getName());
assertEquals("xsd:long", dataObj.getItemSubjectRef().getStructureRef());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class InCompleteSignalConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("task");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("task", flowElement.getId());
ProcessValidator processValidator = new ProcessValidatorFactory().createDefaultProcessValidator();
List<ValidationError> errors = processValidator.validate(model);
assertNotNull(errors);
assertEquals(2, errors.size());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class ScopedConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("outerSubProcess");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("outerSubProcess", flowElement.getId());
SubProcess outerSubProcess = (SubProcess) flowElement;
List<BoundaryEvent> eventList = outerSubProcess.getBoundaryEvents();
assertEquals(1, eventList.size());
BoundaryEvent boundaryEvent = eventList.get(0);
assertEquals("outerBoundaryEvent", boundaryEvent.getId());
FlowElement subElement = outerSubProcess.getFlowElement("innerSubProcess");
assertNotNull(subElement);
assertTrue(subElement instanceof SubProcess);
assertEquals("innerSubProcess", subElement.getId());
SubProcess innerSubProcess = (SubProcess) subElement;
eventList = innerSubProcess.getBoundaryEvents();
assertEquals(1, eventList.size());
boundaryEvent = eventList.get(0);
assertEquals("innerBoundaryEvent", boundaryEvent.getId());
FlowElement taskElement = innerSubProcess.getFlowElement("usertask");
assertNotNull(taskElement);
assertTrue(taskElement instanceof UserTask);
UserTask userTask = (UserTask) taskElement;
assertEquals("usertask", userTask.getId());
eventList = userTask.getBoundaryEvents();
assertEquals(1, eventList.size());
boundaryEvent = eventList.get(0);
assertEquals("taskBoundaryEvent", boundaryEvent.getId());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class EventJavaTest method testStartEventWithExecutionListener.
public void testStartEventWithExecutionListener() throws Exception {
BpmnModel bpmnModel = new BpmnModel();
Process process = new Process();
process.setId("simpleProcess");
process.setName("Very simple process");
bpmnModel.getProcesses().add(process);
StartEvent startEvent = new StartEvent();
startEvent.setId("startEvent1");
TimerEventDefinition timerDef = new TimerEventDefinition();
timerDef.setTimeDuration("PT5M");
startEvent.getEventDefinitions().add(timerDef);
ActivitiListener listener = new ActivitiListener();
listener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
listener.setImplementation("${test}");
listener.setEvent("end");
startEvent.getExecutionListeners().add(listener);
process.addFlowElement(startEvent);
UserTask task = new UserTask();
task.setId("reviewTask");
task.setAssignee("kermit");
process.addFlowElement(task);
SequenceFlow flow1 = new SequenceFlow();
flow1.setId("flow1");
flow1.setSourceRef("startEvent1");
flow1.setTargetRef("reviewTask");
process.addFlowElement(flow1);
EndEvent endEvent = new EndEvent();
endEvent.setId("endEvent1");
process.addFlowElement(endEvent);
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
new BpmnXMLConverter().validateModel(new InputStreamSource(new ByteArrayInputStream(xml)));
Deployment deployment = repositoryService.createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
repositoryService.deleteDeployment(deployment.getId());
}
Aggregations