Search in sources :

Example 1 with PropertyImpl

use of org.eclipse.bpmn2.impl.PropertyImpl in project kie-wb-common by kiegroup.

the class ParsedAssignmentsInfoTest method testCreateInitializedOutputVariablesDuplicates.

@Test
public void testCreateInitializedOutputVariablesDuplicates() {
    final String DATA_OUTPUT_ID = "_Data-TestOutputX";
    final String DATA_OUTPUT_NAME = "Data Test";
    final String DATA_OUTPUT_ASSOCIATION_ID = "Data Test";
    final String DATA_OUTPUT_ASSOCIATION_VALUE_1 = "BooleanTest";
    final String DATA_OUTPUT_ASSOCIATION_VALUE_2 = "BooleanTest2";
    final String INIT_OUTPUT_VAR_ID = "Data-Test";
    final String INIT_OUTPUT_VAR_TYPE = "Boolean";
    VariableScope variableScope = new FlatVariableScope();
    variableScope.declare("", "BooleanTest", "Boolean");
    variableScope.declare("", "BooleanTest2", "Boolean");
    List<InitializedVariable.InitializedOutputVariable> initializedOutputVariables = testedDuplicates.createInitializedOutputVariables("", variableScope, new HashSet<>());
    assertEquals(2, initializedOutputVariables.size());
    // Test first variable
    InitializedVariable.InitializedOutputVariable initializedOutputVariable1 = initializedOutputVariables.get(0);
    DataOutput dataOutput1 = initializedOutputVariable1.getDataOutput();
    DataOutputAssociation dataOutputAssociation1 = initializedOutputVariable1.getDataOutputAssociation();
    List<ItemAwareElement> sourceRef1 = dataOutputAssociation1.getSourceRef();
    DataOutput source1 = (DataOutput) sourceRef1.get(0);
    PropertyImpl target1 = (PropertyImpl) dataOutputAssociation1.getTargetRef();
    String dataOutputID1 = dataOutput1.getId();
    String dataOutputName1 = dataOutput1.getName();
    String dataOutputAssociationID1 = source1.getName();
    String dataOutputAssociationValue1 = target1.getId();
    String initVarID1 = initializedOutputVariable1.getIdentifier();
    String initVarType1 = initializedOutputVariable1.getType();
    assertEquals(dataOutputID1, DATA_OUTPUT_ID);
    assertEquals(dataOutputName1, DATA_OUTPUT_NAME);
    assertEquals(dataOutputAssociationID1, DATA_OUTPUT_ASSOCIATION_ID);
    assertEquals(dataOutputAssociationValue1, DATA_OUTPUT_ASSOCIATION_VALUE_1);
    assertEquals(initVarID1, INIT_OUTPUT_VAR_ID);
    assertEquals(initVarType1, INIT_OUTPUT_VAR_TYPE);
    // Test duplicate variable
    InitializedVariable.InitializedOutputVariable initializedOutputVariable2 = initializedOutputVariables.get(1);
    DataOutput dataOutput2 = initializedOutputVariable2.getDataOutput();
    DataOutputAssociation dataOutputAssociation2 = initializedOutputVariable2.getDataOutputAssociation();
    List<ItemAwareElement> sourceRef2 = dataOutputAssociation2.getSourceRef();
    DataOutput source2 = (DataOutput) sourceRef2.get(0);
    PropertyImpl target2 = (PropertyImpl) dataOutputAssociation2.getTargetRef();
    String dataOutputID2 = dataOutput2.getId();
    String dataOutputName2 = dataOutput2.getName();
    String dataOutputAssociationID2 = source2.getName();
    String dataOutputAssociationValue2 = target2.getId();
    String initVarID2 = initializedOutputVariable2.getIdentifier();
    String initVarType2 = initializedOutputVariable2.getType();
    assertEquals(dataOutputID2, DATA_OUTPUT_ID);
    assertEquals(dataOutputName2, DATA_OUTPUT_NAME);
    assertEquals(dataOutputAssociationID2, DATA_OUTPUT_ASSOCIATION_ID);
    assertEquals(dataOutputAssociationValue2, DATA_OUTPUT_ASSOCIATION_VALUE_2);
    assertEquals(initVarID2, INIT_OUTPUT_VAR_ID);
    assertEquals(initVarType2, INIT_OUTPUT_VAR_TYPE);
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) PropertyImpl(org.eclipse.bpmn2.impl.PropertyImpl) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) VariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.VariableScope) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) Test(org.junit.Test)

Example 2 with PropertyImpl

use of org.eclipse.bpmn2.impl.PropertyImpl 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);
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) VariableDeclaration(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) PropertyImpl(org.eclipse.bpmn2.impl.PropertyImpl) Test(org.junit.Test)

Example 3 with PropertyImpl

use of org.eclipse.bpmn2.impl.PropertyImpl 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);
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) VariableDeclaration(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration) PropertyImpl(org.eclipse.bpmn2.impl.PropertyImpl) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test)

Example 4 with PropertyImpl

use of org.eclipse.bpmn2.impl.PropertyImpl in project kie-wb-common by kiegroup.

the class ParsedAssignmentsInfoTest method testCreateInitializedOutputVariables.

@Test
public void testCreateInitializedOutputVariables() {
    final String DATA_OUTPUT_ID = "_Data-TestOutputX";
    final String DATA_OUTPUT_NAME = "Data Test";
    final String DATA_OUTPUT_ASSOCIATION_ID = "Data Test";
    final String DATA_OUTPUT_ASSOCIATION_VALUE = "BooleanTest";
    final String INIT_OUTPUT_VAR_ID = "Data-Test";
    final String INIT_OUTPUT_VAR_TYPE = "Boolean";
    VariableScope variableScope = new FlatVariableScope();
    variableScope.declare("", "BooleanTest", "Boolean");
    List<InitializedVariable.InitializedOutputVariable> initializedOutputVariables = tested.createInitializedOutputVariables("", variableScope, new HashSet<>());
    assertEquals(1, initializedOutputVariables.size());
    InitializedVariable.InitializedOutputVariable initializedOutputVariable = initializedOutputVariables.get(0);
    DataOutput dataOutput = initializedOutputVariable.getDataOutput();
    DataOutputAssociation dataOutputAssociation = initializedOutputVariable.getDataOutputAssociation();
    List<ItemAwareElement> sourceRef = dataOutputAssociation.getSourceRef();
    DataOutput source = (DataOutput) sourceRef.get(0);
    PropertyImpl target = (PropertyImpl) dataOutputAssociation.getTargetRef();
    String dataOutputID = dataOutput.getId();
    String dataOutputName = dataOutput.getName();
    String dataOutputAssociationID = source.getName();
    String dataOutputAssociationValue = target.getId();
    String initVarID = initializedOutputVariable.getIdentifier();
    String initVarType = initializedOutputVariable.getType();
    assertEquals(dataOutputID, DATA_OUTPUT_ID);
    assertEquals(dataOutputName, DATA_OUTPUT_NAME);
    assertEquals(dataOutputAssociationID, DATA_OUTPUT_ASSOCIATION_ID);
    assertEquals(dataOutputAssociationValue, DATA_OUTPUT_ASSOCIATION_VALUE);
    assertEquals(initVarID, INIT_OUTPUT_VAR_ID);
    assertEquals(initVarType, INIT_OUTPUT_VAR_TYPE);
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) PropertyImpl(org.eclipse.bpmn2.impl.PropertyImpl) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) VariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.VariableScope) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) Test(org.junit.Test)

Aggregations

ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)4 PropertyImpl (org.eclipse.bpmn2.impl.PropertyImpl)4 Test (org.junit.Test)4 InitializedVariable (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable)4 DataOutput (org.eclipse.bpmn2.DataOutput)3 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)3 VariableDeclaration (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration)2 FlatVariableScope (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope)2 VariableScope (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.VariableScope)2 DataInput (org.eclipse.bpmn2.DataInput)1 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)1