Search in sources :

Example 6 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElement.

@Test
public void testToFlowElement() {
    final ReusableSubprocess definition = new ReusableSubprocess();
    definition.getExecutionSet().setSlaDueDate(new SLADueDate(SLA_DUE_DATE));
    definition.getExecutionSet().setIsAsync(new IsAsync(Boolean.TRUE));
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertTrue(CustomElement.async.of(propertyWriter.getFlowElement()).get());
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertTrue(CustomElement.slaDueDate.of(propertyWriter.getFlowElement()).get().contains(SLA_DUE_DATE));
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) View(org.kie.workbench.common.stunner.core.graph.content.view.View) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) Test(org.junit.Test)

Example 7 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method testToFlowElement_process.

@Test
public void testToFlowElement_process() {
    final BaseReusableSubprocess definition = new ReusableSubprocess();
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
    final Node<View<BaseReusableSubprocess>, ?> node = new NodeImpl<>(java.util.UUID.randomUUID().toString());
    node.setContent(view);
    final PropertyWriter propertyWriter = tested.toFlowElement(node);
    assertTrue(CallActivityPropertyWriter.class.isInstance(propertyWriter));
    assertFalse(CustomElement.isCase.of(propertyWriter.getFlowElement()).get());
}
Also used : CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) CallActivityPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter) PropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter) Test(org.junit.Test)

Example 8 with BaseReusableSubprocess

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

the class ReusableSubprocessConverterTest method setUp.

@Before
public void setUp() {
    when(propertyWriterFactory.of(any(CallActivity.class))).thenReturn(propertyWriter);
    DataIOSet ioSet = mock(DataIOSet.class);
    when(ioSet.getAssignmentsinfo()).thenReturn(ASSIGNMENTS_INFO);
    final ReusableSubprocess definition = new ReusableSubprocess(new BPMNGeneralSet(NAME, DOCUMENTATION), new ReusableSubprocessTaskExecutionSet(new CalledElement(CALLED_ELEMENT), new IsCase(IS_CASE), new Independent(INDEPENDENT), new AbortParent(ABORT_PARENT), new WaitForCompletion(WAIT_FOR_COMPLETION), new IsAsync(IS_ASYNC), new AdHocAutostart(IS_ADHOC_AUTOSTART), new IsMultipleInstance(IS_MULTIPLE_INSTANCE), new MultipleInstanceExecutionMode(SEQUENTIAL), new MultipleInstanceCollectionInput(COLLECTION_INPUT), new MultipleInstanceDataInput(DATA_INPUT), new MultipleInstanceCollectionOutput(COLLECTION_OUTPUT), new MultipleInstanceDataOutput(DATA_OUTPUT), new MultipleInstanceCompletionCondition(COMPLETION_CONDITION), ON_ENTRY_ACTION, ON_EXIT_ACTION, new SLADueDate(SLA_DUE_DATE)), ioSet, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet(), SIMULATION_SET, new AdvancedData());
    final View<BaseReusableSubprocess> view = new ViewImpl<>(definition, BOUNDS);
    node = new NodeImpl<>(UUID);
    node.setContent(view);
    converter = new ReusableSubprocessConverter(propertyWriterFactory);
}
Also used : BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) MultipleInstanceCollectionOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput) CallActivity(org.eclipse.bpmn2.CallActivity) AdHocAutostart(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart) WaitForCompletion(org.kie.workbench.common.stunner.bpmn.definition.property.task.WaitForCompletion) DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) SLADueDate(org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate) FontSet(org.kie.workbench.common.stunner.bpmn.definition.property.font.FontSet) AbortParent(org.kie.workbench.common.stunner.bpmn.definition.property.task.AbortParent) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) MultipleInstanceExecutionMode(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceExecutionMode) IsCase(org.kie.workbench.common.stunner.bpmn.definition.property.subProcess.IsCase) ReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ReusableSubprocessTaskExecutionSet) MultipleInstanceDataOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataOutput) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) RectangleDimensionsSet(org.kie.workbench.common.stunner.bpmn.definition.property.dimensions.RectangleDimensionsSet) Independent(org.kie.workbench.common.stunner.bpmn.definition.property.task.Independent) AdvancedData(org.kie.workbench.common.stunner.bpmn.definition.property.variables.AdvancedData) MultipleInstanceCompletionCondition(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCompletionCondition) BackgroundSet(org.kie.workbench.common.stunner.bpmn.definition.property.background.BackgroundSet) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) IsMultipleInstance(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance) MultipleInstanceCollectionInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput) MultipleInstanceDataInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataInput) IsAsync(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync) CalledElement(org.kie.workbench.common.stunner.bpmn.definition.property.task.CalledElement) Before(org.junit.Before)

Example 9 with BaseReusableSubprocess

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

the class VariableUtilsTest method mockReusableSubprocess.

private BaseReusableSubprocess mockReusableSubprocess(String name, String assignmentsInfoValue, String inputCollection, String outputCollection) {
    ReusableSubprocess result = mock(ReusableSubprocess.class);
    BPMNGeneralSet generalSet = mockGeneralSet(name);
    when(result.getGeneral()).thenReturn(generalSet);
    AssignmentsInfo assignmentsInfo = mockAssignmentsInfo(assignmentsInfoValue);
    DataIOSet dataIOSet = mockIOSet(assignmentsInfo);
    when(result.getDataIOSet()).thenReturn(dataIOSet);
    ReusableSubprocessTaskExecutionSet executionSet = mock(ReusableSubprocessTaskExecutionSet.class);
    when(result.getExecutionSet()).thenReturn(executionSet);
    IsMultipleInstance isMultipleInstance = mock(IsMultipleInstance.class);
    when(isMultipleInstance.getValue()).thenReturn(true);
    MultipleInstanceCollectionInput miInputCollection = mock(MultipleInstanceCollectionInput.class);
    when(miInputCollection.getValue()).thenReturn(inputCollection);
    MultipleInstanceDataInput miDataInput = mock(MultipleInstanceDataInput.class);
    MultipleInstanceCollectionOutput miOutputCollection = mock(MultipleInstanceCollectionOutput.class);
    MultipleInstanceDataOutput miDataOutput = mock(MultipleInstanceDataOutput.class);
    when(miOutputCollection.getValue()).thenReturn(outputCollection);
    when(executionSet.getIsMultipleInstance()).thenReturn(isMultipleInstance);
    when(executionSet.getMultipleInstanceCollectionInput()).thenReturn(miInputCollection);
    when(executionSet.getMultipleInstanceDataInput()).thenReturn(miDataInput);
    when(executionSet.getMultipleInstanceCollectionOutput()).thenReturn(miOutputCollection);
    when(executionSet.getMultipleInstanceDataOutput()).thenReturn(miDataOutput);
    return result;
}
Also used : DataIOSet(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet) ReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess) BaseReusableSubprocess(org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) IsMultipleInstance(org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance) MultipleInstanceCollectionOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput) MultipleInstanceCollectionInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput) BPMNGeneralSet(org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet) MultipleInstanceDataInput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataInput) ReusableSubprocessTaskExecutionSet(org.kie.workbench.common.stunner.bpmn.definition.property.task.ReusableSubprocessTaskExecutionSet) MultipleInstanceDataOutput(org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceDataOutput)

Aggregations

BaseReusableSubprocess (org.kie.workbench.common.stunner.bpmn.definition.BaseReusableSubprocess)9 ReusableSubprocess (org.kie.workbench.common.stunner.bpmn.definition.ReusableSubprocess)8 CallActivityPropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CallActivityPropertyWriter)7 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)7 PropertyWriter (org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.PropertyWriter)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)6 Test (org.junit.Test)5 BPMNGeneralSet (org.kie.workbench.common.stunner.bpmn.definition.property.general.BPMNGeneralSet)3 AdHocAutostart (org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocAutostart)3 CallActivity (org.eclipse.bpmn2.CallActivity)2 DataIOSet (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.DataIOSet)2 SLADueDate (org.kie.workbench.common.stunner.bpmn.definition.property.general.SLADueDate)2 IsCase (org.kie.workbench.common.stunner.bpmn.definition.property.subProcess.IsCase)2 AbortParent (org.kie.workbench.common.stunner.bpmn.definition.property.task.AbortParent)2 Independent (org.kie.workbench.common.stunner.bpmn.definition.property.task.Independent)2 IsAsync (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsAsync)2 IsMultipleInstance (org.kie.workbench.common.stunner.bpmn.definition.property.task.IsMultipleInstance)2 MultipleInstanceCollectionInput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionInput)2 MultipleInstanceCollectionOutput (org.kie.workbench.common.stunner.bpmn.definition.property.task.MultipleInstanceCollectionOutput)2