use of org.eclipse.bpmn2.DataInput in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallUserTaskAssignments.
@Test
public void testMarshallUserTaskAssignments() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
// JBPMBpmn2ResourceImpl resource = tested.marshallToBpmn2Resource(diagram);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
DefinitionsConverter definitionsConverter = new DefinitionsConverter(diagram.getGraph());
Definitions definitions = definitionsConverter.toDefinitions();
assertNotNull(definitions);
Process process = getProcess(definitions);
assertNotNull(process);
org.eclipse.bpmn2.UserTask userTask = (org.eclipse.bpmn2.UserTask) getNamedFlowElement(process, org.eclipse.bpmn2.UserTask.class, "Self Evaluation");
assertNotNull(userTask);
DataInput dataInput = getDataInput(userTask, "reason");
// this fails because of type
validateDataInputOrOutput(dataInput, "_reasonInputX", "com.test.Reason", "_reasonInputXItem");
DataOutput dataOutput = getDataOutput(userTask, "performance");
validateDataInputOrOutput(dataOutput, "_performanceOutputX", "Object", "_performanceOutputXItem");
ItemAwareElement sourceRef = getDataInputAssociationSourceRef(userTask, "reason");
assertNotNull(sourceRef);
ItemAwareElement targetRef = getDataInputAssociationTargetRef(userTask, "_reasonInputX");
assertNotNull(targetRef);
sourceRef = getDataOutputAssociationSourceRef(userTask, "_performanceOutputX");
assertNotNull(sourceRef);
targetRef = getDataOutputAssociationTargetRef(userTask, "performance");
assertNotNull(targetRef);
}
use of org.eclipse.bpmn2.DataInput in project kie-wb-common by kiegroup.
the class ParsedAssignmentsInfoTest method testCreateInitializedInputVariables.
@Test
public void testCreateInitializedInputVariables() {
final String DATA_INPUT_ID = "_Years-of-ServiceInputX";
final String DATA_INPUT_NAME = "Years of Service";
final String DATA_INPUT_ASSOCIATION_ID = "Years of Service";
final String DATA_INPUT_ASSOCIATION_VALUE = "<![CDATA[35]]>";
final String INIT_INPUT_VAR_ID = "Years-of-Service";
final String INIT_INPUT_VAR_TYPE = "Integer";
VariableScope variableScope = new FlatVariableScope();
List<InitializedVariable.InitializedInputVariable> initializedInputVariables = tested.createInitializedInputVariables("", variableScope, new HashSet<>());
assertEquals(1, initializedInputVariables.size());
InitializedVariable.InitializedInputVariable initializedInputVariable = initializedInputVariables.get(0);
DataInput dataInput = initializedInputVariable.getDataInput();
DataInputAssociation dataInputAssociation = initializedInputVariable.getDataInputAssociation();
DataInput target = (DataInput) dataInputAssociation.getTargetRef();
List<Assignment> assignments = dataInputAssociation.getAssignment();
Assignment assignment = assignments.get(0);
FormalExpression from = (FormalExpression) assignment.getFrom();
String dataInputID = dataInput.getId();
String dataInputName = dataInput.getName();
String dataInputAssociationID = target.getName();
String dataInputAssociationValue = from.getBody();
String initVarID = initializedInputVariable.getIdentifier();
String initVarType = initializedInputVariable.getType();
assertEquals(dataInputID, DATA_INPUT_ID);
assertEquals(dataInputName, DATA_INPUT_NAME);
assertEquals(dataInputAssociationID, DATA_INPUT_ASSOCIATION_ID);
assertEquals(dataInputAssociationValue, DATA_INPUT_ASSOCIATION_VALUE);
assertEquals(initVarID, INIT_INPUT_VAR_ID);
assertEquals(initVarType, INIT_INPUT_VAR_TYPE);
}
Aggregations