use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope in project kie-wb-common by kiegroup.
the class AssociationsTest method marshallUnassignedDeclaration.
@Test
public void marshallUnassignedDeclaration() {
String id = "PARENT";
String decl = "||Foo:String||";
StartEvent startEvent = bpmn2.createStartEvent();
startEvent.setId(id);
CatchEventPropertyWriter p = new CatchEventPropertyWriter(startEvent, new FlatVariableScope(), new HashSet<>());
p.setAssignmentsInfo(new AssignmentsInfo(decl));
assertEquals(1, p.getItemDefinitions().size());
assertEquals(Ids.dataOutputItem(id, "Foo"), p.getItemDefinitions().get(0).getId());
assertEquals("String", p.getItemDefinitions().get(0).getStructureRef());
assertEquals(1, startEvent.getDataOutputs().size());
assertEquals("Foo", startEvent.getDataOutputs().get(0).getName());
assertEquals(0, startEvent.getDataOutputAssociation().size());
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope in project kie-wb-common by kiegroup.
the class IntermediateCatchEventConverterTest method setUp.
@Before
public void setUp() {
Event boundaryEvent = bpmn2.createBoundaryEvent();
boundaryEventPropertyWriter = spy(new BoundaryEventPropertyWriter((BoundaryEvent) spy(boundaryEvent), new FlatVariableScope(), new HashSet<>()));
// when(boundaryEventPropertyWriter.getFlowElement()).thenReturn(spy(FlowElement.class));
Event catchEvent = bpmn2.createIntermediateCatchEvent();
catchEventPropertyWriter = spy(new CatchEventPropertyWriter((CatchEvent) spy(catchEvent), new FlatVariableScope(), new HashSet<>()));
propertyWriterFactory = spy(PropertyWriterFactory.class);
when(propertyWriterFactory.of(any(BoundaryEvent.class))).thenReturn(boundaryEventPropertyWriter);
when(propertyWriterFactory.of(any(CatchEvent.class))).thenReturn(catchEventPropertyWriter);
generalSet = new BPMNGeneralSet(NAME, DOCUMENTATION);
assignmentsInfo = new AssignmentsInfo(ASSIGNMENTS_INFO);
dataIOSet = new DataIOSet(assignmentsInfo);
advancedData = new AdvancedData();
slaDueDate = mock(SLADueDate.class);
errorRef = mock(ErrorRef.class);
signalRef = mock(SignalRef.class);
linkRef = mock(LinkRef.class);
timerSettingsValue = mock(TimerSettingsValue.class);
timerSettings = new TimerSettings(timerSettingsValue);
messageRef = mock(MessageRef.class);
scriptTypeValue = mock(ScriptTypeValue.class);
conditionExpression = new ConditionExpression(scriptTypeValue);
escalationRef = mock(EscalationRef.class);
tested = spy(new IntermediateCatchEventConverter(propertyWriterFactory));
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope 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);
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope in project kie-wb-common by kiegroup.
the class IntermediateThrowEventConverterTest method setUp.
@Before
public void setUp() {
Event throwEvent = bpmn2.createIntermediateThrowEvent();
throwEvent.setId("throwEventID");
throwEventPropertyWriter = spy(new ThrowEventPropertyWriter((ThrowEvent) throwEvent, new FlatVariableScope(), new HashSet<>()));
propertyWriterFactory = spy(PropertyWriterFactory.class);
when(propertyWriterFactory.of(any(ThrowEvent.class))).thenReturn(throwEventPropertyWriter);
generalSet = new BPMNGeneralSet(NAME, DOCUMENTATION);
assignmentsInfo = new AssignmentsInfo(ASSIGNMENTS_INFO);
dataIOSet = new DataIOSet(assignmentsInfo);
advancedData = new AdvancedData();
signalRef = mock(SignalRef.class);
signalScope = mock(SignalScope.class);
linkRef = mock(LinkRef.class);
messageRef = mock(MessageRef.class);
escalationRef = mock(EscalationRef.class);
tested = spy(new IntermediateThrowEventConverter(propertyWriterFactory));
}
use of org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope 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);
}
Aggregations