@Test public void testGetMarshallerCallback() { final DMNContentResource resource = mock(DMNContentResource.class); final Diagram diagram = mock(Diagram.class); final Graph graph = mock(Graph.class); final ProjectMetadata projectMetadata = mock(ProjectMetadata.class); final String name = "name"; when(diagram.getName()).thenReturn(name); when(diagram.getGraph()).thenReturn(graph); when(resource.getMetadata()).thenReturn(projectMetadata); service.getMarshallerCallback(resource, projectDiagramCallback).onSuccess(diagram); verify(projectDiagramCallback).onSuccess(projectDiagramArgumentCaptor.capture()); final ProjectDiagramImpl projectDiagram = projectDiagramArgumentCaptor.getValue(); assertEquals(name, projectDiagram.getName()); assertEquals(graph, projectDiagram.getGraph()); assertEquals(projectMetadata, projectDiagram.getMetadata()); }
ServiceCallback<Diagram> getMarshallerCallback(final DMNContentResource resource, final ServiceCallback<ProjectDiagram> callback) { return new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { callback.onSuccess(asProjectDiagramImpl(diagram, resource)); } @Override public void onError(final ClientRuntimeError error) { callback.onError(error); } }; }
DMNClientProjectDiagramService extends ClientProjectDiagramService { ServiceCallback<Diagram> getMarshallerCallback(final DMNContentResource resource, final ServiceCallback<ProjectDiagram> callback) { return new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { callback.onSuccess(asProjectDiagramImpl(diagram, resource)); } @Override public void onError(final ClientRuntimeError error) { callback.onError(error); } }; } }
DMNClientProjectDiagramService extends ClientProjectDiagramService { ServiceCallback<Diagram> getMarshallerCallback(final DMNContentResource resource, final ServiceCallback<ProjectDiagram> callback) { return new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { callback.onSuccess(asProjectDiagramImpl(diagram, resource)); } @Override public void onError(final ClientRuntimeError error) { callback.onError(error); } }; } @Inject  DMNClientProjectDiagramService(final ShapeManager shapeManager,
                                          final SessionManager sessionManager,
                                          final Caller<ProjectDiagramService> diagramServiceCaller,
                                          final Caller<DiagramLookupService> diagramLookupServiceCaller,
                                          final Event<SessionDiagramSavedEvent> saveEvent,
                                          final Caller<DMNContentService> dmnContentServiceCaller,
                                          final DMNMarshallerService dmnMarshallerService); }
DMNClientProjectDiagramService extends ClientProjectDiagramService { ServiceCallback<Diagram> getMarshallerCallback(final DMNContentResource resource, final ServiceCallback<ProjectDiagram> callback) { return new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { callback.onSuccess(asProjectDiagramImpl(diagram, resource)); } @Override public void onError(final ClientRuntimeError error) { callback.onError(error); } }; } @Inject  DMNClientProjectDiagramService(final ShapeManager shapeManager,
                                          final SessionManager sessionManager,
                                          final Caller<ProjectDiagramService> diagramServiceCaller,
                                          final Caller<DiagramLookupService> diagramLookupServiceCaller,
                                          final Event<SessionDiagramSavedEvent> saveEvent,
                                          final Caller<DMNContentService> dmnContentServiceCaller,
                                          final DMNMarshallerService dmnMarshallerService); @Override void getByPath(final Path path,
                          final ServiceCallback<ProjectDiagram> callback); @Override void saveOrUpdate(final Path path,
                             final ProjectDiagram diagram,
                             final Metadata metadata,
                             final String comment,
                             final ServiceCallback<ProjectDiagram> callback); }
DMNClientProjectDiagramService extends ClientProjectDiagramService { ServiceCallback<Diagram> getMarshallerCallback(final DMNContentResource resource, final ServiceCallback<ProjectDiagram> callback) { return new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { callback.onSuccess(asProjectDiagramImpl(diagram, resource)); } @Override public void onError(final ClientRuntimeError error) { callback.onError(error); } }; } @Inject  DMNClientProjectDiagramService(final ShapeManager shapeManager,
                                          final SessionManager sessionManager,
                                          final Caller<ProjectDiagramService> diagramServiceCaller,
                                          final Caller<DiagramLookupService> diagramLookupServiceCaller,
                                          final Event<SessionDiagramSavedEvent> saveEvent,
                                          final Caller<DMNContentService> dmnContentServiceCaller,
                                          final DMNMarshallerService dmnMarshallerService); @Override void getByPath(final Path path,
                          final ServiceCallback<ProjectDiagram> callback); @Override void saveOrUpdate(final Path path,
                             final ProjectDiagram diagram,
                             final Metadata metadata,
                             final String comment,
                             final ServiceCallback<ProjectDiagram> callback);  }