public void onSocialFileSelected(@Observes final SocialFileSelectedEvent event) { vfsService.call(new RemoteCallback<Path>() { @Override public void callback(Path path) { projectService.call(new RemoteCallback<WorkspaceProject>() { @Override public void callback(final WorkspaceProject project) { openBestSuitedScreen(event.getEventType(), path, project); } }).resolveProject(path); } }).get(event.getUri()); }
@Test public void testOnSocialFileSelected_Asset() { doReturn(mock(WorkspaceProject.class)).when(projectService).resolveProject(any(Path.class)); doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(LibraryPlaces.LIBRARY_PERSPECTIVE); final PlaceRequest libraryPerspective = libraryPlaces.getLibraryPlaceRequestWithoutRefresh(); final SocialFileSelectedEvent event = new SocialFileSelectedEvent("any", "uri"); libraryPlaces.onSocialFileSelected(event); verify(placeManager).goTo(libraryPerspective); verify(libraryPlaces).goToAsset(any(Path.class)); }
@Test public void testOnSocialFileSelected_Repository() { doReturn(mock(WorkspaceProject.class)).when(projectService).resolveProject(any(Path.class)); doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(LibraryPlaces.LIBRARY_PERSPECTIVE); final SocialFileSelectedEvent event = new SocialFileSelectedEvent(ExtendedTypes.NEW_REPOSITORY_EVENT.name(), null); libraryPlaces.onSocialFileSelected(event); verify(placeManager).goTo(LibraryPlaces.REPOSITORY_STRUCTURE_SCREEN); }
@Test public void testOnSocialFileSelected_Module() { doReturn(mock(WorkspaceProject.class)).when(projectService).resolveProject(any(Path.class)); doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(LibraryPlaces.LIBRARY_PERSPECTIVE); final PlaceRequest libraryPerspective = libraryPlaces.getLibraryPlaceRequestWithoutRefresh(); final SocialFileSelectedEvent event = new SocialFileSelectedEvent(ModuleEventType.NEW_MODULE.name(), null); libraryPlaces.onSocialFileSelected(event); verify(placeManager).goTo(libraryPerspective); verify(libraryPlaces).goToProject(); }