Search in sources :

Example 6 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class ExampleImportPresenterTest method filterProjectsTest.

@Test
public void filterProjectsTest() {
    Set<ExampleProject> projects = new HashSet<>();
    projects.add(new ExampleProject(mock(Path.class), "p1a", "p1a description", null));
    projects.add(new ExampleProject(mock(Path.class), "p3b", "p3b description", null));
    projects.add(new ExampleProject(mock(Path.class), "p2a", "p2a description", null));
    doReturn(projects).when(libraryService).getExampleProjects();
    Map<String, String> params = new HashMap<>();
    params.put("repositoryUrl", "repoUrl");
    importPresenter.onStartup(new DefaultPlaceRequest(LibraryPlaces.PROJECT_SCREEN, params));
    final List<TileWidget> filteredProjects = importPresenter.filterProjects("a");
    assertEquals(2, filteredProjects.size());
}
Also used : HashMap(java.util.HashMap) TileWidget(org.kie.workbench.common.screens.library.client.widgets.common.TileWidget) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) ExampleProject(org.kie.workbench.common.screens.examples.model.ExampleProject) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 7 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class ExampleImportPresenterTest method onStartupWithoutProjectsTest.

@Test
public void onStartupWithoutProjectsTest() {
    Map<String, String> params = new HashMap<>();
    params.put("repositoryUrl", "repoUrl");
    importPresenter.onStartup(new DefaultPlaceRequest(LibraryPlaces.PROJECT_SCREEN, params));
    verify(view).hideBusyIndicator();
    verify(notificationEvent).fire(any());
    verify(libraryPlaces).goToLibrary();
}
Also used : HashMap(java.util.HashMap) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 8 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method goToLibraryFromOrganizationalUnitsScreenTest.

@Test
public void goToLibraryFromOrganizationalUnitsScreenTest() {
    doReturn(Optional.of(activeOrganizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
    doReturn(Optional.empty()).when(projectContext).getActiveWorkspaceProject();
    doReturn(Optional.empty()).when(projectContext).getActiveModule();
    final PlaceRequest placeRequest = new DefaultPlaceRequest(LibraryPlaces.LIBRARY_SCREEN);
    final PartDefinitionImpl part = new PartDefinitionImpl(placeRequest);
    part.setSelectable(false);
    libraryPlaces.goToLibrary();
    verify(libraryPlaces).closeLibraryPlaces();
    verify(placeManager).goTo(eq(part), any(PanelDefinition.class));
    verify(libraryPlaces).setupLibraryBreadCrumbsWithoutProject();
    verify(projectContextChangeEvent, times(1)).fire(any(WorkspaceProjectContextChangeEvent.class));
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) PanelDefinition(org.uberfire.workbench.model.PanelDefinition) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) WorkspaceProjectContextChangeEvent(org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent) Test(org.junit.Test)

Example 9 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method goToProjectMetricsTest.

@Test
public void goToProjectMetricsTest() {
    final PlaceRequest projectScreen = new DefaultPlaceRequest(LibraryPlaces.PROJECT_METRICS_SCREEN);
    final PartDefinitionImpl part = new PartDefinitionImpl(projectScreen);
    part.setSelectable(false);
    libraryPlaces.goToProjectMetrics();
    verify(placeManager).goTo(eq(part), any(PanelDefinition.class));
    verify(projectMetricsEvent).fire(any(WorkbenchProjectMetricsEvent.class));
    verify(libraryPlaces).setupLibraryBreadCrumbsForProjectMetrics();
}
Also used : PathPlaceRequest(org.uberfire.mvp.impl.PathPlaceRequest) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) PlaceRequest(org.uberfire.mvp.PlaceRequest) PartDefinitionImpl(org.uberfire.workbench.model.impl.PartDefinitionImpl) WorkbenchProjectMetricsEvent(org.kie.workbench.common.screens.library.client.events.WorkbenchProjectMetricsEvent) PanelDefinition(org.uberfire.workbench.model.PanelDefinition) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Example 10 with DefaultPlaceRequest

use of org.uberfire.mvp.impl.DefaultPlaceRequest in project kie-wb-common by kiegroup.

the class LibraryPlacesTest method onSelectProjectTest.

@Test
public void onSelectProjectTest() {
    doReturn(PlaceStatus.OPEN).when(placeManager).getStatus(LibraryPlaces.LIBRARY_PERSPECTIVE);
    final DefaultPlaceRequest projectSettingsPlaceRequest = new DefaultPlaceRequest(LibraryPlaces.PROJECT_SCREEN);
    final PlaceGainFocusEvent placeGainFocusEvent = mock(PlaceGainFocusEvent.class);
    doReturn(projectSettingsPlaceRequest).when(placeGainFocusEvent).getPlace();
    libraryPlaces.onSelectPlaceEvent(placeGainFocusEvent);
    verify(libraryPlaces).hideDocks();
    verify(libraryPlaces).setupLibraryBreadCrumbs();
}
Also used : PlaceGainFocusEvent(org.uberfire.client.workbench.events.PlaceGainFocusEvent) DefaultPlaceRequest(org.uberfire.mvp.impl.DefaultPlaceRequest) Test(org.junit.Test)

Aggregations

DefaultPlaceRequest (org.uberfire.mvp.impl.DefaultPlaceRequest)46 PartDefinitionImpl (org.uberfire.workbench.model.impl.PartDefinitionImpl)29 Test (org.junit.Test)17 PlaceRequest (org.uberfire.mvp.PlaceRequest)15 PanelDefinition (org.uberfire.workbench.model.PanelDefinition)14 PathPlaceRequest (org.uberfire.mvp.impl.PathPlaceRequest)12 Perspective (org.uberfire.client.annotations.Perspective)11 WorkbenchPerspective (org.uberfire.client.annotations.WorkbenchPerspective)11 PerspectiveDefinition (org.uberfire.workbench.model.PerspectiveDefinition)11 PerspectiveDefinitionImpl (org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl)11 MultiListWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter)8 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)7 PanelDefinitionImpl (org.uberfire.workbench.model.impl.PanelDefinitionImpl)7 HashMap (java.util.HashMap)4 UberfireDock (org.uberfire.client.workbench.docks.UberfireDock)3 PlaceGainFocusEvent (org.uberfire.client.workbench.events.PlaceGainFocusEvent)3 SimpleWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter)3 StaticWorkbenchPanelPresenter (org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter)3 ArrayList (java.util.ArrayList)2 WorkbenchProjectMetricsEvent (org.kie.workbench.common.screens.library.client.events.WorkbenchProjectMetricsEvent)2