Search in sources :

Example 6 with FlatVariableScope

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);
}
Also used : DataOutput(org.eclipse.bpmn2.DataOutput) 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 7 with FlatVariableScope

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);
}
Also used : FormalExpression(org.eclipse.bpmn2.FormalExpression) DataInput(org.eclipse.bpmn2.DataInput) Assignment(org.eclipse.bpmn2.Assignment) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) VariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.VariableScope) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test)

Aggregations

FlatVariableScope (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope)7 Test (org.junit.Test)5 InitializedVariable (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable)4 VariableScope (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.VariableScope)4 DataOutput (org.eclipse.bpmn2.DataOutput)3 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)3 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)3 Event (org.eclipse.bpmn2.Event)2 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)2 PropertyImpl (org.eclipse.bpmn2.impl.PropertyImpl)2 Before (org.junit.Before)2 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)2 PropertyWriterFactory (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 EscalationRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.escalation.EscalationRef)2 LinkRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.link.LinkRef)2 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)2 SignalRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalRef)2 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)2 AdvancedData (org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData)2