use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class GraphUtilsTest method testNonReusableSubprocess.
@Test
public void testNonReusableSubprocess() {
Element<View<UserTask>> element = new NodeImpl<>("UUID");
View<UserTask> userTaskView = new ViewImpl<>(new UserTask(), Bounds.create());
element.setContent(userTaskView);
assertFalse(GraphUtils.isReusableSubProcess(element));
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class CallActivityConverterTest method setUp.
@Before
public void setUp() {
final ReusableSubprocess definition = new ReusableSubprocess(new BPMNGeneralSet(), new ReusableSubprocessTaskExecutionSet(), new DataIOSet(), new BackgroundSet(), new FontSet(), new RectangleDimensionsSet(), new SimulationSet(), new AdvancedData());
final View<ReusableSubprocess> view = new ViewImpl<>(definition, Bounds.create());
Node<View<ReusableSubprocess>, Edge> node = new NodeImpl<>(UUID);
node.setContent(view);
when(callActivity.getId()).thenReturn(UUID);
when(callActivity.getCalledElement()).thenReturn(CALLED_ELEMENT);
when(factoryManager.newNode(eq(UUID), eq(ReusableSubprocess.class))).thenReturn(node);
when(propertyReaderFactory.of(callActivity)).thenReturn(propertyReader);
when(propertyReader.getName()).thenReturn(NAME);
when(propertyReader.getDocumentation()).thenReturn(DOCUMENTATION);
when(propertyReader.getAssignmentsInfo()).thenReturn(ASSIGNMENTS_INFO);
when(propertyReader.getBounds()).thenReturn(BOUNDS);
when(propertyReader.getSimulationSet()).thenReturn(SIMULATION_SET);
when(propertyReader.getRectangleDimensionsSet()).thenReturn(RECTANGLE_DIMENSIONS_SET);
when(propertyReader.getFontSet()).thenReturn(FONT_SET);
when(propertyReader.getBackgroundSet()).thenReturn(BACKGROUND_SET);
when(propertyReader.isIndependent()).thenReturn(INDEPENDENT);
when(propertyReader.isAbortParent()).thenReturn(ABORT_PARENT);
when(propertyReader.isWaitForCompletion()).thenReturn(WAIT_FOR_COMPLETION);
when(propertyReader.isAsync()).thenReturn(IS_ASYNC);
when(propertyReader.isSequential()).thenReturn(SEQUENTIAL);
when(propertyReader.getCollectionOutput()).thenReturn(COLLECTION_OUTPUT);
when(propertyReader.getCollectionInput()).thenReturn(COLLECTION_INPUT);
when(propertyReader.getDataInput()).thenReturn(DATA_INPUT);
when(propertyReader.getDataOutput()).thenReturn(DATA_OUTPUT);
when(propertyReader.getCompletionCondition()).thenReturn(COMPLETION_CONDITION);
when(propertyReader.getOnEntryAction()).thenReturn(ON_ENTRY_ACTION);
when(propertyReader.getOnExitAction()).thenReturn(ON_EXIT_ACTION);
when(propertyReader.getSlaDueDate()).thenReturn(SLA_DUE_DATE);
converter = new CallActivityConverter(factoryManager, propertyReaderFactory);
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class MapSelectionControlTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
ShapeViewExtStub shapeView = new ShapeViewExtStub(shapeEventHandler, hasControlPoints);
when(rootElement.getUUID()).thenReturn(ROOT_UUID);
when(rootElement.getContent()).thenReturn(new ViewImpl<>(rootDefinition, Bounds.create(0, 0, 10, 10)));
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(element.getContent()).thenReturn(new ViewImpl<>(definition, Bounds.create(0, 0, 10, 10)));
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvasHandler.getAbstractCanvas()).thenReturn(canvas);
when(canvasHandler.getGraphIndex()).thenReturn(index);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(eq(ViewEventType.MOUSE_CLICK))).thenReturn(true);
this.tested = new MapSelectionControl(e -> elementSelectedEvent.fire((CanvasSelectionEvent) e), e -> clearSelectionEvent.fire((CanvasClearSelectionEvent) e));
this.tested.setReadonly(false);
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class ReusableSubprocessConverterTest method testToFlowElement_autostart.
@Test
public void testToFlowElement_autostart() {
final ReusableSubprocess definition = new ReusableSubprocess();
definition.getExecutionSet().setAdHocAutostart(new AdHocAutostart(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.autoStart.of(propertyWriter.getFlowElement()).get());
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class ReusableSubprocessConverterTest method testToFlowElementForAbortParent.
private void testToFlowElementForAbortParent(boolean independent, boolean abortParent, boolean expectedAbortParent) {
final ReusableSubprocess definition = new ReusableSubprocess();
definition.getExecutionSet().setIndependent(new Independent(independent));
definition.getExecutionSet().setAbortParent(new AbortParent(abortParent));
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);
assertEquals(expectedAbortParent, CustomElement.abortParent.of(propertyWriter.getFlowElement()).get());
}
Aggregations