@Test public void testDoNewDiagram() { final String fileName = "file.dmn"; final String title = "file"; final Metadata metadata = mock(Metadata.class); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = mock(Diagram.class); doReturn(metadata).when(service).buildMetadataInstance(fileName); when(factoryManager.newDiagram(title, defSetId, metadata)).thenReturn(diagram); service.doNewDiagram(fileName, callback); verify(marshallerService).setOnDiagramLoad(callback); verify(marshallerService).registerDiagramInstance(diagram, title, shapeSetId); verify(callback).onSuccess(diagram); }
void doNewDiagram(final String fileName, final ServiceCallback<Diagram> callback) { try { final String title = createDiagramTitleFromFilePath(fileName); final Metadata metadata = buildMetadataInstance(fileName); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = factoryManager.newDiagram(title, defSetId, metadata); marshallerService.setOnDiagramLoad(callback); marshallerService.registerDiagramInstance(diagram, title, shapeSetId); callback.onSuccess(diagram); } catch (final Exception e) { throw new RuntimeException(e); } }
DMNClientDiagramServiceImpl extends AbstractKogitoClientDiagramService { void doNewDiagram(final String fileName, final ServiceCallback<Diagram> callback) { try { final String title = createDiagramTitleFromFilePath(fileName); final Metadata metadata = buildMetadataInstance(fileName); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = factoryManager.newDiagram(title, defSetId, metadata); marshallerService.setOnDiagramLoad(callback); marshallerService.registerDiagramInstance(diagram, title, shapeSetId); callback.onSuccess(diagram); } catch (final Exception e) { throw new RuntimeException(e); } } }
DMNClientDiagramServiceImpl extends AbstractKogitoClientDiagramService { void doNewDiagram(final String fileName, final ServiceCallback<Diagram> callback) { try { final String title = createDiagramTitleFromFilePath(fileName); final Metadata metadata = buildMetadataInstance(fileName); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = factoryManager.newDiagram(title, defSetId, metadata); marshallerService.setOnDiagramLoad(callback); marshallerService.registerDiagramInstance(diagram, title, shapeSetId); callback.onSuccess(diagram); } catch (final Exception e) { throw new RuntimeException(e); } } DMNClientDiagramServiceImpl(); @Inject  DMNClientDiagramServiceImpl(final FactoryManager factoryManager,
                                       final DefinitionManager definitionManager,
                                       final Promises promises,
                                       final DMNMarshallerService marshallerService); }
DMNClientDiagramServiceImpl extends AbstractKogitoClientDiagramService { void doNewDiagram(final String fileName, final ServiceCallback<Diagram> callback) { try { final String title = createDiagramTitleFromFilePath(fileName); final Metadata metadata = buildMetadataInstance(fileName); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = factoryManager.newDiagram(title, defSetId, metadata); marshallerService.setOnDiagramLoad(callback); marshallerService.registerDiagramInstance(diagram, title, shapeSetId); callback.onSuccess(diagram); } catch (final Exception e) { throw new RuntimeException(e); } } DMNClientDiagramServiceImpl(); @Inject  DMNClientDiagramServiceImpl(final FactoryManager factoryManager,
                                       final DefinitionManager definitionManager,
                                       final Promises promises,
                                       final DMNMarshallerService marshallerService); @Override void transform(final String fileName,
                          final String xml,
                          final ServiceCallback<Diagram> callback); @Override String generateDefaultId(); @Override void transform(final String xml,
                          final ServiceCallback<Diagram> callback); @Override Promise<String> transform(final KogitoDiagramResourceImpl resource); }
DMNClientDiagramServiceImpl extends AbstractKogitoClientDiagramService { void doNewDiagram(final String fileName, final ServiceCallback<Diagram> callback) { try { final String title = createDiagramTitleFromFilePath(fileName); final Metadata metadata = buildMetadataInstance(fileName); final String defSetId = BindableAdapterUtils.getDefinitionSetId(DMNDefinitionSet.class); final String shapeSetId = BindableAdapterUtils.getShapeSetId(DMNShapeSet.class); final Diagram diagram = factoryManager.newDiagram(title, defSetId, metadata); marshallerService.setOnDiagramLoad(callback); marshallerService.registerDiagramInstance(diagram, title, shapeSetId); callback.onSuccess(diagram); } catch (final Exception e) { throw new RuntimeException(e); } } DMNClientDiagramServiceImpl(); @Inject  DMNClientDiagramServiceImpl(final FactoryManager factoryManager,
                                       final DefinitionManager definitionManager,
                                       final Promises promises,
                                       final DMNMarshallerService marshallerService); @Override void transform(final String fileName,
                          final String xml,
                          final ServiceCallback<Diagram> callback); @Override String generateDefaultId(); @Override void transform(final String xml,
                          final ServiceCallback<Diagram> callback); @Override Promise<String> transform(final KogitoDiagramResourceImpl resource);  }