Search in sources :

Example 1 with MetadataImpl

use of org.kie.workbench.common.stunner.core.diagram.MetadataImpl in project kie-wb-common by kiegroup.

the class SessionPreviewImplTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.preview = new SessionPreviewImpl(definitionManager, shapeManager, textPropertyProviderFactory, canvasCommandManager, definitionUtils, graphUtils, canvasHandlerFactories, canvasCommandFactories, selectionControl, view);
    final DiagramImpl diagram = new DiagramImpl("diagram", new MetadataImpl());
    final GraphImpl graph = new GraphImpl("graph", new GraphNodeStoreImpl());
    final DefinitionSetImpl definitionSet = new DefinitionSetImpl("id");
    diagram.setGraph(graph);
    graph.setContent(definitionSet);
    definitionSet.setBounds(new BoundsImpl(new BoundImpl(0.0, 0.0), new BoundImpl(100.0, 100.0)));
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(session.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(shapeManager.getCanvasFactory(any(Diagram.class))).thenReturn(canvasFactory);
    when(canvasFactory.newCanvas()).thenReturn(canvas);
    when(canvasFactory.newControl(eq(ZoomControl.class))).thenReturn(zoomControl);
    when(canvasHandlerFactories.select(any(Annotation.class))).thenReturn(canvasHandlerFactories);
    when(canvasHandlerFactories.get()).thenReturn(canvasHandler);
    when(canvas.getView()).thenReturn(canvasView);
    preview.open(session, callback);
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) ZoomControl(org.kie.workbench.common.stunner.core.client.canvas.controls.zoom.ZoomControl) MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) DefinitionSetImpl(org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSetImpl) DiagramImpl(org.kie.workbench.common.stunner.core.diagram.DiagramImpl) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Annotation(java.lang.annotation.Annotation) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Before(org.junit.Before)

Example 2 with MetadataImpl

use of org.kie.workbench.common.stunner.core.diagram.MetadataImpl in project kie-wb-common by kiegroup.

the class XMLEncoderDiagramMetadataMarshallerTest method testEncode.

@Test
public void testEncode() throws Exception {
    MetadataImpl metadata = new MetadataImpl.MetadataImplBuilder("defSet1").build();
    metadata.setTitle("title1");
    metadata.setCanvasRootUUID("root1");
    metadata.setShapeSetId("ss1");
    metadata.setThumbData("thumbData1");
    metadata.setTitle("title1");
    String result = tested.marshall(metadata);
    assertNotNull(result);
}
Also used : MetadataImpl(org.kie.workbench.common.stunner.core.diagram.MetadataImpl) Test(org.junit.Test)

Aggregations

MetadataImpl (org.kie.workbench.common.stunner.core.diagram.MetadataImpl)2 Annotation (java.lang.annotation.Annotation)1 Before (org.junit.Before)1 Test (org.junit.Test)1 ZoomControl (org.kie.workbench.common.stunner.core.client.canvas.controls.zoom.ZoomControl)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1 DiagramImpl (org.kie.workbench.common.stunner.core.diagram.DiagramImpl)1 DefinitionSetImpl (org.kie.workbench.common.stunner.core.graph.content.definition.DefinitionSetImpl)1 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)1 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)1 GraphImpl (org.kie.workbench.common.stunner.core.graph.impl.GraphImpl)1 GraphNodeStoreImpl (org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl)1