use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope in project kie-wb-common by kiegroup.
the class ParsedAssignmentsInfoTest method testCreateInitializedOutputVariablesNoAssociation.
@Test
public void testCreateInitializedOutputVariablesNoAssociation() {
final String DATA_OUTPUT_ID = "_Data-TestOutputX";
final String DATA_OUTPUT_NAME = "Data Test";
final String INIT_OUTPUT_VAR_ID = "Data-Test";
VariableScope variableScope = new FlatVariableScope();
List<InitializedVariable.InitializedOutputVariable> initializedOutputVariables = testedNoAssociation.createInitializedOutputVariables("", variableScope, new HashSet<>());
assertEquals(1, initializedOutputVariables.size());
InitializedVariable.InitializedOutputVariable initializedOutputVariable = initializedOutputVariables.get(0);
DataOutput dataOutput = initializedOutputVariable.getDataOutput();
DataOutputAssociation dataOutputAssociation = initializedOutputVariable.getDataOutputAssociation();
String dataOutputID = dataOutput.getId();
String dataOutputName = dataOutput.getName();
String initVarID = initializedOutputVariable.getIdentifier();
assertNull(dataOutputAssociation);
assertEquals(dataOutputID, DATA_OUTPUT_ID);
assertEquals(dataOutputName, DATA_OUTPUT_NAME);
assertEquals(initVarID, INIT_OUTPUT_VAR_ID);
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope 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