Search in sources :

Example 36 with AssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo in project kie-wb-common by kiegroup.

the class HashCodeAndEqualityTest method testStartMessageEventEquals.

@Test
public void testStartMessageEventEquals() {
    final String MESSAGE_REF = "message ref";
    final InterruptingMessageEventExecutionSet A_EXECUTION_SET = new InterruptingMessageEventExecutionSet(new IsInterrupting(true), new MessageRef(MESSAGE_REF));
    final InterruptingMessageEventExecutionSet B_EXECUTION_SET = new InterruptingMessageEventExecutionSet(new IsInterrupting(true), new MessageRef(MESSAGE_REF));
    final InterruptingMessageEventExecutionSet C_EXECUTION_SET = new InterruptingMessageEventExecutionSet(new IsInterrupting(true), new MessageRef("Other value"));
    final InterruptingMessageEventExecutionSet D_EXECUTION_SET = new InterruptingMessageEventExecutionSet(new IsInterrupting(true), new MessageRef(MESSAGE_REF));
    final String ASSIGNMENT_INFO = "some value";
    final DataIOSet A_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet B_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet C_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet D_DATA_SET = new DataIOSet(new AssignmentsInfo("Other value"));
    StartMessageEvent.StartMessageEventBuilder builder = new StartMessageEvent.StartMessageEventBuilder();
    StartMessageEvent a = builder.build();
    a.setExecutionSet(A_EXECUTION_SET);
    a.setDataIOSet(A_DATA_SET);
    builder = new StartMessageEvent.StartMessageEventBuilder();
    StartMessageEvent b = builder.build();
    b.setExecutionSet(B_EXECUTION_SET);
    b.setDataIOSet(B_DATA_SET);
    builder = new StartMessageEvent.StartMessageEventBuilder();
    StartMessageEvent c = builder.build();
    c.setExecutionSet(C_EXECUTION_SET);
    c.setDataIOSet(C_DATA_SET);
    builder = new StartMessageEvent.StartMessageEventBuilder();
    StartMessageEvent d = builder.build();
    d.setExecutionSet(D_EXECUTION_SET);
    d.setDataIOSet(D_DATA_SET);
    assertEquals(a, a);
    assertEquals(a, b);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    assertNotEquals(a, 19);
    assertNotEquals(a, null);
    a.setExecutionSet(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    a.setExecutionSet(A_EXECUTION_SET);
    assertEquals(a, b);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    a.setDataIOSet(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    EndSignalEvent.EndSignalEventBuilder builderSignal = new EndSignalEvent.EndSignalEventBuilder();
    EndSignalEvent e = builderSignal.build();
    assertNotEquals(a, e);
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) InterruptingMessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.InterruptingMessageEventExecutionSet) IsInterrupting(org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting) Test(org.junit.Test)

Example 37 with AssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo in project kie-wb-common by kiegroup.

the class HashCodeAndEqualityTest method IntermediateMessageEventThrowingEquals.

@Test
public void IntermediateMessageEventThrowingEquals() {
    final String MESSAGE_REF = "message ref";
    final MessageEventExecutionSet A_EXECUTION_SET = new MessageEventExecutionSet(new MessageRef(MESSAGE_REF));
    final MessageEventExecutionSet B_EXECUTION_SET = new MessageEventExecutionSet(new MessageRef(MESSAGE_REF));
    final MessageEventExecutionSet C_EXECUTION_SET = new MessageEventExecutionSet(new MessageRef("Other value"));
    final MessageEventExecutionSet D_EXECUTION_SET = new MessageEventExecutionSet(new MessageRef(MESSAGE_REF));
    final String ASSIGNMENT_INFO = "some value";
    final DataIOSet A_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet B_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet C_DATA_SET = new DataIOSet(new AssignmentsInfo(ASSIGNMENT_INFO));
    final DataIOSet D_DATA_SET = new DataIOSet(new AssignmentsInfo("Other value"));
    IntermediateMessageEventThrowing.IntermediateMessageEventThrowingBuilder builder = new IntermediateMessageEventThrowing.IntermediateMessageEventThrowingBuilder();
    IntermediateMessageEventThrowing a = builder.build();
    a.setExecutionSet(A_EXECUTION_SET);
    a.setDataIOSet(A_DATA_SET);
    builder = new IntermediateMessageEventThrowing.IntermediateMessageEventThrowingBuilder();
    IntermediateMessageEventThrowing b = builder.build();
    b.setExecutionSet(B_EXECUTION_SET);
    b.setDataIOSet(B_DATA_SET);
    builder = new IntermediateMessageEventThrowing.IntermediateMessageEventThrowingBuilder();
    IntermediateMessageEventThrowing c = builder.build();
    c.setExecutionSet(C_EXECUTION_SET);
    c.setDataIOSet(C_DATA_SET);
    builder = new IntermediateMessageEventThrowing.IntermediateMessageEventThrowingBuilder();
    IntermediateMessageEventThrowing d = builder.build();
    d.setExecutionSet(D_EXECUTION_SET);
    d.setDataIOSet(D_DATA_SET);
    assertEquals(a, a);
    assertEquals(a, b);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    assertNotEquals(a, 19);
    assertNotEquals(a, null);
    a.setExecutionSet(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    a.setExecutionSet(A_EXECUTION_SET);
    assertEquals(a, b);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    a.setDataIOSet(null);
    assertNotEquals(a, b);
    assertNotEquals(b, a);
    assertNotEquals(a, c);
    assertNotEquals(a, d);
    EndSignalEvent.EndSignalEventBuilder builderSignal = new EndSignalEvent.EndSignalEventBuilder();
    EndSignalEvent e = builderSignal.build();
    assertNotEquals(a, e);
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) CancellingMessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.CancellingMessageEventExecutionSet) MessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageEventExecutionSet) InterruptingMessageEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.InterruptingMessageEventExecutionSet) Test(org.junit.Test)

Example 38 with AssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo in project kie-wb-common by kiegroup.

the class ActivityPropertyWriter method setAssignmentsInfo.

public void setAssignmentsInfo(AssignmentsInfo info) {
    final ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    final InputOutputSpecification ioSpec = getIoSpecification();
    assignmentsInfo.getAssociations().getInputs().stream().map(declaration -> new InputAssignmentWriter(flowElement.getId(), // source is a variable
    variableScope.lookup(declaration.getLeft()), // target is an input
    assignmentsInfo.getInputs().lookup(declaration.getRight()))).forEach(dia -> {
        this.addItemDefinition(dia.getItemDefinition());
        this.addDataInput(dia.getDataInput());
        ioSpec.getInputSets().add(dia.getInputSet());
        ioSpec.getDataInputs().add(dia.getDataInput());
        activity.getDataInputAssociations().add(dia.getAssociation());
    });
    assignmentsInfo.getAssociations().getOutputs().stream().map(declaration -> new OutputAssignmentWriter(flowElement.getId(), // source is an output
    assignmentsInfo.getOutputs().lookup(declaration.getLeft()), // target is a variable
    variableScope.lookup(declaration.getRight()))).forEach(doa -> {
        this.addItemDefinition(doa.getItemDefinition());
        this.addDataOutput(doa.getDataOutput());
        ioSpec.getOutputSets().add(doa.getOutputSet());
        ioSpec.getDataOutputs().add(doa.getDataOutput());
        activity.getDataOutputAssociations().add(doa.getAssociation());
    });
}
Also used : AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) SimulationSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationSet) ElementParameters(bpsim.ElementParameters) Activity(org.eclipse.bpmn2.Activity) SimulationSets(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SimulationSets) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo)

Example 39 with AssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo in project kie-wb-common by kiegroup.

the class CatchEventPropertyWriter method setAssignmentsInfo.

public void setAssignmentsInfo(AssignmentsInfo info) {
    ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    assignmentsInfo.getAssociations().getOutputs().stream().map(declaration -> new OutputAssignmentWriter(flowElement.getId(), assignmentsInfo.getOutputs().lookup(declaration.getLeft()), variableScope.lookup(declaration.getRight()))).forEach(doa -> {
        this.addItemDefinition(doa.getItemDefinition());
        this.addDataOutput(doa.getDataOutput());
        event.setOutputSet(doa.getOutputSet());
        event.getDataOutputAssociation().add(doa.getAssociation());
    });
}
Also used : EventDefinition(org.eclipse.bpmn2.EventDefinition) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) SimulationAttributeSets(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.SimulationAttributeSets) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) ElementParameters(bpsim.ElementParameters) CatchEvent(org.eclipse.bpmn2.CatchEvent) SimulationAttributeSet(org.kie.workbench.common.stunner.bpmn.definition.property.simulation.SimulationAttributeSet) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo)

Aggregations

AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)39 Test (org.junit.Test)32 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)31 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)28 Graph (org.kie.workbench.common.stunner.core.graph.Graph)28 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)12 ParsedAssignmentsInfo (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo)4 StartErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.StartErrorEvent)4 InterruptingMessageEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.InterruptingMessageEventExecutionSet)4 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)4 StartMessageEvent (org.kie.workbench.common.stunner.bpmn.definition.StartMessageEvent)3 IsInterrupting (org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting)3 CancellingMessageEventExecutionSet (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.CancellingMessageEventExecutionSet)3 ElementParameters (bpsim.ElementParameters)2 EventDefinition (org.eclipse.bpmn2.EventDefinition)2 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)2 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)2 EndErrorEvent (org.kie.workbench.common.stunner.bpmn.definition.EndErrorEvent)2 EndMessageEvent (org.kie.workbench.common.stunner.bpmn.definition.EndMessageEvent)2 EndSignalEvent (org.kie.workbench.common.stunner.bpmn.definition.EndSignalEvent)2