Search in sources :

Example 56 with Event

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

the class IntermediateThrowEventConverter method signalEvent.

protected PropertyWriter signalEvent(Node<View<IntermediateSignalEventThrowing>, ?> n) {
    IntermediateThrowEvent event = bpmn2.createIntermediateThrowEvent();
    event.setId(n.getUUID());
    ThrowEventPropertyWriter p = propertyWriterFactory.of(event);
    IntermediateSignalEventThrowing definition = n.getContent().getDefinition();
    p.setAbsoluteBounds(n);
    BPMNGeneralSet general = definition.getGeneral();
    p.setName(general.getName().getValue());
    p.setDocumentation(general.getDocumentation().getValue());
    p.setMetaData(definition.getAdvancedData().getMetaDataAttributes());
    p.setAssignmentsInfo(definition.getDataIOSet().getAssignmentsinfo());
    ScopedSignalEventExecutionSet executionSet = definition.getExecutionSet();
    p.addSignal(executionSet.getSignalRef());
    p.addSignalScope(executionSet.getSignalScope());
    return p;
}
Also used : ScopedSignalEventExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.ScopedSignalEventExecutionSet) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) IntermediateSignalEventThrowing(org.kie.workbench.common.stunner.bpmn.definition.IntermediateSignalEventThrowing) IntermediateThrowEvent(org.eclipse.bpmn2.IntermediateThrowEvent) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)

Example 57 with Event

use of org.eclipse.bpmn2.Event 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));
}
Also used : ThrowEvent(org.eclipse.bpmn2.ThrowEvent) SignalRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalRef) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) MessageRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) PropertyWriterFactory(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriterFactory) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) ThrowEvent(org.eclipse.bpmn2.ThrowEvent) BaseThrowingIntermediateEvent(org.kie.workbench.common.stunner.bpmn.definition.BaseThrowingIntermediateEvent) Event(org.eclipse.bpmn2.Event) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) SignalScope(org.kie.workbench.common.stunner.bpmn.definition.property.event.signal.SignalScope) EscalationRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.escalation.EscalationRef) ThrowEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter) LinkRef(org.kie.workbench.common.stunner.bpmn.definition.property.event.link.LinkRef) Before(org.junit.Before)

Example 58 with Event

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

the class BaseEventPropertyReaderTest method testGetLinkRef.

@Test
public void testGetLinkRef() {
    // Link Event can't be Boundary
    if (this instanceof BoundaryEventPropertyReaderTest) {
        return;
    }
    assertEquals("", propertyReader.getLinkRef());
    LinkEventDefinition eventDefinition = mock(LinkEventDefinition.class);
    setLinkEventDefinitionOnCurrentMock(eventDefinition);
    when(eventDefinition.getName()).thenReturn(null);
    assertEquals("", propertyReader.getLinkRef());
    when(eventDefinition.getName()).thenReturn(LINK_REF_ID);
    assertEquals(LINK_REF_ID, propertyReader.getLinkRef());
    EventDefinition differentType = mock(EventDefinition.class);
    setLinkEventDefinitionOnCurrentMock(differentType);
    assertEquals("", propertyReader.getLinkRef());
}
Also used : LinkEventDefinition(org.eclipse.bpmn2.LinkEventDefinition) EventDefinition(org.eclipse.bpmn2.EventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) LinkEventDefinition(org.eclipse.bpmn2.LinkEventDefinition) Test(org.junit.Test)

Example 59 with Event

use of org.eclipse.bpmn2.Event in project requery by requery.

the class TimeConversionsTest method testInsertReadDate.

@Test
public void testInsertReadDate() {
    Event event = new Event();
    UUID id = UUID.randomUUID();
    LocalDate localDateNow = LocalDate.now();
    event.setId(id);
    event.setLocalDate(localDateNow);
    data.insert(event);
    event = data.findByKey(Event.class, id);
    Assert.assertEquals(localDateNow, event.getLocalDate());
}
Also used : Event(io.requery.test.model2.Event) UUID(java.util.UUID) LocalDate(java.time.LocalDate) Test(org.junit.Test)

Example 60 with Event

use of org.eclipse.bpmn2.Event in project requery by requery.

the class UpsertTest method testInsertOneToManyInsert.

@Test
public void testInsertOneToManyInsert() {
    Event event = new Event();
    UUID id = UUID.randomUUID();
    event.setId(id);
    event.setName("test");
    Tag t1 = new Tag();
    t1.setId(UUID.randomUUID());
    Tag t2 = new Tag();
    t2.setId(UUID.randomUUID());
    event.getTags().add(t1);
    event.getTags().add(t2);
    data.insert(event);
    HashSet<Tag> set = new HashSet<>(event.getTags());
    assertEquals(2, set.size());
    assertTrue(set.containsAll(Arrays.asList(t1, t2)));
    assertSame(2, data.select(Tag.class).get().toList().size());
}
Also used : Event(io.requery.test.model3.Event) Tag(io.requery.test.model3.Tag) UUID(java.util.UUID) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)28 Test (org.junit.Test)18 EventDefinition (org.eclipse.bpmn2.EventDefinition)15 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)14 SignalEventDefinition (org.eclipse.bpmn2.SignalEventDefinition)14 ArrayList (java.util.ArrayList)13 List (java.util.List)13 ConditionalEventDefinition (org.eclipse.bpmn2.ConditionalEventDefinition)13 ErrorEventDefinition (org.eclipse.bpmn2.ErrorEventDefinition)13 EscalationEventDefinition (org.eclipse.bpmn2.EscalationEventDefinition)13 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)13 ThrowEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.ThrowEventPropertyWriter)13 TimerEventDefinition (org.eclipse.bpmn2.TimerEventDefinition)12 Event (io.requery.test.model3.Event)9 UUID (java.util.UUID)9 EndEvent (org.eclipse.bpmn2.EndEvent)9 CatchEventPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter)9 CatchEvent (org.eclipse.bpmn2.CatchEvent)8 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)8 MessageRef (org.kie.workbench.common.stunner.bpmn.definition.property.event.message.MessageRef)8