@Test public void testOnSaveOntologyHierarchy() { SaveOntologyHierarchyEvent eventMock = mock(SaveOntologyHierarchyEvent.class); Ontology ontologyMock = mock(Ontology.class); OntologyHierarchy ontologyHierarchyMock = mock(OntologyHierarchy.class); when(ontologyMock.getVersion()).thenReturn("version"); when(eventMock.getOntology()).thenReturn(ontologyMock); when(eventMock.getIris()).thenReturn(iriListMock); when(iriListMock.iterator()).thenReturn(iriIteratorMock); uut = new OntologiesPresenterImpl(serviceFacadeMock, appServiceMock, editorStoreMock, previewStoreMock, factoryMock, avuFactoryMock, appearanceMock, previewGridPresenterMock, editorGridPresenterMock, categorizeViewMock) { @Override void addHierarchies(OntologiesView.ViewType type, OntologyHierarchy parent, List<OntologyHierarchy> children) { } @Override boolean isValidHierarchy(OntologyHierarchy result) { return true; } @Override void displayErrorToAdmin() { } }; uut.properties = propertiesMock; uut.announcer = announcerMock; uut.ontologyUtil = utilMock; uut.onSaveOntologyHierarchy(eventMock); verify(serviceFacadeMock, times(2)).saveOntologyHierarchy(eq(eventMock.getOntology().getVersion()), anyString(), asyncOntologyHierarchyCaptor.capture()); asyncOntologyHierarchyCaptor.getValue().onSuccess(ontologyHierarchyMock); verify(serviceFacadeMock).getOntologyHierarchies(anyString(), asyncOntologyHierarchyListCaptor.capture()); asyncOntologyHierarchyListCaptor.getValue().onSuccess(ontologyHierarchyListMock); verify(viewMock, times(2)).clearTreeStore(isA(OntologiesView.ViewType.class)); verify(utilMock).createIriToAttrMap(eq(ontologyHierarchyListMock)); verify(viewMock, times(5)).maskTree(isA(OntologiesView.ViewType.class)); verify(viewMock).unmaskTree(isA(OntologiesView.ViewType.class)); verify(viewMock).updateButtonStatus(); verify(viewMock).showTreePanel(); }
@Override public void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event) { List<String> iris = event.getIris(); String ontologyVersion = event.getOntology().getVersion(); for (String iri : iris) { view.maskTree(OntologiesView.ViewType.EDITOR); serviceFacade.saveOntologyHierarchy(ontologyVersion, iri, new SaveHierarchyAsyncCallback(ontologyVersion, iri)); } view.showTreePanel(); }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { @Override public void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event) { List<String> iris = event.getIris(); String ontologyVersion = event.getOntology().getVersion(); for (String iri : iris) { view.maskTree(OntologiesView.ViewType.EDITOR); serviceFacade.saveOntologyHierarchy(ontologyVersion, iri, new SaveHierarchyAsyncCallback(ontologyVersion, iri)); } view.showTreePanel(); } }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { @Override public void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event) { List<String> iris = event.getIris(); String ontologyVersion = event.getOntology().getVersion(); for (String iri : iris) { view.maskTree(OntologiesView.ViewType.EDITOR); serviceFacade.saveOntologyHierarchy(ontologyVersion, iri, new SaveHierarchyAsyncCallback(ontologyVersion, iri)); } view.showTreePanel(); } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { @Override public void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event) { List<String> iris = event.getIris(); String ontologyVersion = event.getOntology().getVersion(); for (String iri : iris) { view.maskTree(OntologiesView.ViewType.EDITOR); serviceFacade.saveOntologyHierarchy(ontologyVersion, iri, new SaveHierarchyAsyncCallback(ontologyVersion, iri)); } view.showTreePanel(); } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); @Override void go(HasOneWidget container); @Override OntologiesView getView(); @Override void appsDNDtoHierarchy(List<App> apps, OntologyHierarchy hierarchy); @Override void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp); @Override void onRefreshOntologies(RefreshOntologiesEvent event); @Override void onSelectOntologyVersion(SelectOntologyVersionEvent event); @Override void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event); @Override void onCategorizeButtonClicked(CategorizeButtonClickedEvent event); @Override void onPublishOntologyClick(PublishOntologyClickEvent event); @Override void onPreviewHierarchySelected(PreviewHierarchySelectedEvent event); @Override void onHierarchySelected(HierarchySelectedEvent event); @Override OntologyHierarchy getHierarchyFromElement(Element el); @Override OntologyHierarchy getSelectedHierarchy(); @Override Ontology getSelectedOntology(); @Override void onDeleteOntologyButtonClicked(final DeleteOntologyButtonClickedEvent event); @Override void onDeleteHierarchy(final DeleteHierarchyEvent event); @Override void onDeleteAppsSelected(DeleteAppsSelected event); @Override void onRefreshPreviewButtonClicked(RefreshPreviewButtonClicked event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); void onRestoreAppButtonClicked(RestoreAppButtonClicked event); void getTrashItems(); }
OntologiesPresenterImpl implements OntologiesView.Presenter,
                                                RefreshOntologiesEvent.RefreshOntologiesEventHandler,
                                                SelectOntologyVersionEvent.SelectOntologyVersionEventHandler,
                                                SaveOntologyHierarchyEvent.SaveOntologyHierarchyEventHandler,
                                                PublishOntologyClickEvent.PublishOntologyClickEventHandler,
                                                HierarchySelectedEvent.HierarchySelectedEventHandler,
                                                PreviewHierarchySelectedEvent.PreviewHierarchySelectedEventHandler,
                                                CategorizeButtonClickedEvent.CategorizeButtonClickedEventHandler,
                                                DeleteOntologyButtonClickedEvent.DeleteOntologyButtonClickedEventHandler,
                                                DeleteHierarchyEvent.DeleteHierarchyEventHandler,
                                                DeleteAppsSelected.DeleteAppsSelectedHandler,
                                                RefreshPreviewButtonClicked.RefreshPreviewButtonClickedHandler,
                                                AppSearchResultLoadEvent.AppSearchResultLoadEventHandler,
                                                RestoreAppButtonClicked.RestoreAppButtonClickedHandler { @Override public void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event) { List<String> iris = event.getIris(); String ontologyVersion = event.getOntology().getVersion(); for (String iri : iris) { view.maskTree(OntologiesView.ViewType.EDITOR); serviceFacade.saveOntologyHierarchy(ontologyVersion, iri, new SaveHierarchyAsyncCallback(ontologyVersion, iri)); } view.showTreePanel(); } @Inject  OntologiesPresenterImpl(OntologyServiceFacade serviceFacade,
                                   AppServiceFacade appService,
                                   final TreeStore<OntologyHierarchy> editorTreeStore,
                                   final TreeStore<OntologyHierarchy> previewTreeStore,
                                   OntologiesViewFactory factory,
                                   AvuAutoBeanFactory avuFactory,
                                   OntologiesView.OntologiesViewAppearance appearance,
                                   AdminAppsGridView.Presenter previewGridPresenter,
                                   AdminAppsGridView.Presenter editorGridPresenter,
                                   AppCategorizeView categorizeView); @Override void go(HasOneWidget container); @Override OntologiesView getView(); @Override void appsDNDtoHierarchy(List<App> apps, OntologyHierarchy hierarchy); @Override void hierarchyDNDtoApp(final OntologyHierarchy hierarchy, final App targetApp); @Override void onRefreshOntologies(RefreshOntologiesEvent event); @Override void onSelectOntologyVersion(SelectOntologyVersionEvent event); @Override void onSaveOntologyHierarchy(SaveOntologyHierarchyEvent event); @Override void onCategorizeButtonClicked(CategorizeButtonClickedEvent event); @Override void onPublishOntologyClick(PublishOntologyClickEvent event); @Override void onPreviewHierarchySelected(PreviewHierarchySelectedEvent event); @Override void onHierarchySelected(HierarchySelectedEvent event); @Override OntologyHierarchy getHierarchyFromElement(Element el); @Override OntologyHierarchy getSelectedHierarchy(); @Override Ontology getSelectedOntology(); @Override void onDeleteOntologyButtonClicked(final DeleteOntologyButtonClickedEvent event); @Override void onDeleteHierarchy(final DeleteHierarchyEvent event); @Override void onDeleteAppsSelected(DeleteAppsSelected event); @Override void onRefreshPreviewButtonClicked(RefreshPreviewButtonClicked event); @Override void onAppSearchResultLoad(AppSearchResultLoadEvent event); void onRestoreAppButtonClicked(RestoreAppButtonClicked event); void getTrashItems();  }