use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration in project kie-wb-common by kiegroup.
the class InitializedVariableTest method testInputCustomVariable.
@Test
public void testInputCustomVariable() {
VariableDeclaration declaration = new VariableDeclaration("Identifier", "type");
InitializedVariable.InitializedInputVariable input = createCustomInput("parent", declaration, "#{expression}");
assertTrue(input instanceof InitializedVariable.InputExpression);
input = createCustomInput("parent", declaration, "constant");
assertTrue(input instanceof InitializedVariable.InputConstant);
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration in project kie-wb-common by kiegroup.
the class InitializedVariableTest method urlDecodeConstants.
@Test
public void urlDecodeConstants() throws UnsupportedEncodingException {
String expected = "<<<#!!!#>>>";
String encoded = URLEncoder.encode(expected, "UTF-8");
VariableDeclaration variable = new VariableDeclaration("PARENT_ID", "Object");
InputConstant c = (InputConstant) createCustomInput("PARENT", variable, encoded);
Assignment assignment = c.getDataInputAssociation().getAssignment().get(0);
FormalExpression to = (FormalExpression) assignment.getTo();
assertEquals(Ids.dataInput("PARENT", "PARENT_ID"), to.getBody());
FormalExpression from = (FormalExpression) assignment.getFrom();
assertEquals(asCData(expected), from.getBody());
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration in project kie-wb-common by kiegroup.
the class InitializedVariableTest method testGetDataOuput.
@Test
public void testGetDataOuput() {
final VariableDeclaration varDeclaration = new VariableDeclaration("Data Output Test", "Boolean");
final String TARGET_VAR = "BooleanTarget";
final String DATA_OUTPUT_ID = "_Data-Output-TestOutputX";
final String DATA_OUTPUT_NAME = "Data Output Test";
final String DATA_OUTPUT_ASSOCIATION_ID = "Data Output Test";
final String DATA_OUTPUT_ASSOCIATION_VALUE = "BooleanTarget";
final String INIT_OUTPUT_VAR_ID = "Data-Output-Test";
final String INIT_OUTPUT_VAR_TYPE = "Boolean";
InitializedVariable.InitializedOutputVariable initializedOutputVar = new InitializedVariable.OutputVariableReference("", varScope, varDeclaration, TARGET_VAR, new HashSet<>());
DataOutput dataOuput = initializedOutputVar.getDataOutput();
DataOutputAssociation dataOutputAssociation = initializedOutputVar.getDataOutputAssociation();
List<ItemAwareElement> sourceRef = dataOutputAssociation.getSourceRef();
DataOutput source = (DataOutput) sourceRef.get(0);
PropertyImpl target = (PropertyImpl) dataOutputAssociation.getTargetRef();
String dataOuputID = dataOuput.getId();
String dataOutputName = dataOuput.getName();
String dataOutputAssociationID = source.getName();
String dataOutputAssocationValue = target.getId();
String initVarID = initializedOutputVar.getIdentifier();
String initVarType = initializedOutputVar.getType();
assertEquals(dataOuputID, DATA_OUTPUT_ID);
assertEquals(dataOutputName, DATA_OUTPUT_NAME);
assertEquals(dataOutputAssociationID, DATA_OUTPUT_ASSOCIATION_ID);
assertEquals(dataOutputAssocationValue, DATA_OUTPUT_ASSOCIATION_VALUE);
assertEquals(initVarID, INIT_OUTPUT_VAR_ID);
assertEquals(initVarType, INIT_OUTPUT_VAR_TYPE);
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration in project kie-wb-common by kiegroup.
the class InitializedVariableTest method testGetDataInput.
@Test
public void testGetDataInput() {
final String SOURCE_VAR = "BooleanSource";
final String DATA_INPUT_ID = "_Data-Input-TestInputX";
final String DATA_INPUT_NAME = "Data Input Test";
final String DATA_INPUT_ASSOCIATION_ID = "Data Input Test";
final String DATA_INPUT_ASSOCIATION_VALUE = "BooleanSource";
final String INIT_INPUT_VAR_ID = "Data-Input-Test";
final String INIT_INPUT_VAR_TYPE = "Boolean";
final VariableDeclaration varDeclaration = new VariableDeclaration("Data Input Test", "Boolean");
InitializedVariable.InitializedInputVariable initializedInputVar = new InitializedVariable.InputVariableReference("", varScope, varDeclaration, SOURCE_VAR, new HashSet<>());
DataInput dataInput = initializedInputVar.getDataInput();
DataInputAssociation dataInputAssociation = initializedInputVar.getDataInputAssociation();
List<ItemAwareElement> sourceRef = dataInputAssociation.getSourceRef();
PropertyImpl source = (PropertyImpl) sourceRef.get(0);
DataInput target = (DataInput) dataInputAssociation.getTargetRef();
String dataInputId = dataInput.getId();
String dataInputName = dataInput.getName();
String dataInputAssociationID = target.getName();
String dataInputAssociationValue = source.getId();
String initVarID = initializedInputVar.getIdentifier();
String initVarType = initializedInputVar.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