Search in sources :

Example 6 with SessionInfoMock

use of org.uberfire.mocks.SessionInfoMock in project kie-wb-common by kiegroup.

the class SpacesScreenServiceImplTest method before.

@Before
public void before() {
    sessionInfo = new SessionInfoMock();
    spacesScreenService = spy(new SpacesScreenServiceImpl(organizationalUnitService, sessionInfo));
}
Also used : SessionInfoMock(org.uberfire.mocks.SessionInfoMock) Before(org.junit.Before)

Example 7 with SessionInfoMock

use of org.uberfire.mocks.SessionInfoMock in project kie-wb-common by kiegroup.

the class SpaceContributorsListServiceImplTest method setup.

@Before
public void setup() {
    promises = new SyncPromises();
    sessionInfo = new SessionInfoMock("owner");
    organizationalUnitServiceCaller = new CallerMock<>(organizationalUnitService);
    libraryServiceCaller = new CallerMock<>(libraryService);
    final OrganizationalUnit activeSpace = mock(OrganizationalUnit.class);
    doReturn(mock(Space.class)).when(activeSpace).getSpace();
    doReturn(activeSpace).when(libraryPlaces).getActiveSpace();
    service = new SpaceContributorsListServiceImpl(libraryPlaces, organizationalUnitServiceCaller, afterEditOrganizationalUnitEvent, libraryServiceCaller, sessionInfo, organizationalUnitController, contributorsSecurityUtils, promises);
}
Also used : Space(org.uberfire.spaces.Space) SessionInfoMock(org.uberfire.mocks.SessionInfoMock) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) SyncPromises(org.uberfire.promise.SyncPromises) Before(org.junit.Before)

Example 8 with SessionInfoMock

use of org.uberfire.mocks.SessionInfoMock in project kie-wb-common by kiegroup.

the class AddProjectPopUpPresenterTest method setup.

@Before
public void setup() {
    libraryServiceCaller = new CallerMock<>(libraryService);
    validationServiceCaller = new CallerMock<>(validationService);
    projectServiceCaller = new CallerMock<>(projectService);
    sessionInfo = new SessionInfoMock();
    selectedOrganizationalUnit = mock(OrganizationalUnit.class);
    doReturn("selectedOrganizationalUnit").when(selectedOrganizationalUnit).getIdentifier();
    when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(selectedOrganizationalUnit));
    when(projectContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
    when(projectContext.getActiveModule()).thenReturn(Optional.empty());
    when(projectContext.getActiveRepositoryRoot()).thenReturn(Optional.empty());
    when(projectContext.getActivePackage()).thenReturn(Optional.empty());
    presenter = spy(new AddProjectPopUpPresenter(libraryServiceCaller, busyIndicatorView, notificationEvent, libraryPlaces, projectContext, view, sessionInfo, newProjectEvent, libraryPreferences, conflictingRepositoriesPopup, validationServiceCaller, errorPopup, translationService, projectServiceCaller, logger, archetypePreferences, spaceScopedResolutionStrategySupplier));
    doReturn("baseUrl").when(presenter).getBaseURL();
    doReturn("emptyNameMessage").when(view).getEmptyNameMessage();
    doReturn("invalidNameMessage").when(view).getInvalidNameMessage();
    doReturn("duplicatedProjectMessage").when(view).getDuplicatedProjectMessage();
    libraryInfo = new LibraryInfo(new ArrayList<>());
    doReturn(libraryInfo).when(libraryService).getLibraryInfo(selectedOrganizationalUnit);
    doReturn(true).when(validationService).isProjectNameValid(any());
    doReturn(true).when(validationService).validateGroupId(any());
    doReturn(true).when(validationService).validateArtifactId(any());
    doReturn(true).when(validationService).validateGAVVersion(any());
    doReturn(mock(WorkspaceProject.class)).when(libraryService).createProject(any(), any(), any(), Mockito.<String>any());
    presenter.setup();
}
Also used : SessionInfoMock(org.uberfire.mocks.SessionInfoMock) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) LibraryInfo(org.kie.workbench.common.screens.library.api.LibraryInfo) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Example 9 with SessionInfoMock

use of org.uberfire.mocks.SessionInfoMock in project kie-wb-common by kiegroup.

the class ProjectContributorsListServiceImplTest method setup.

@Before
public void setup() {
    promises = new SyncPromises();
    sessionInfo = new SessionInfoMock("owner");
    repositoryServiceCaller = new CallerMock<>(repositoryService);
    final OrganizationalUnit activeSpace = mock(OrganizationalUnit.class);
    doReturn(mock(Space.class)).when(activeSpace).getSpace();
    doReturn(activeSpace).when(libraryPlaces).getActiveSpace();
    final WorkspaceProject activeProject = mock(WorkspaceProject.class);
    final Repository activeRepository = mock(Repository.class);
    doReturn("alias").when(activeRepository).getAlias();
    doReturn(activeRepository).when(activeProject).getRepository();
    doReturn(activeProject).when(libraryPlaces).getActiveWorkspace();
    service = new ProjectContributorsListServiceImpl(libraryPlaces, repositoryServiceCaller, spaceContributorsListService, sessionInfo, projectController, contributorsSecurityUtils, promises);
}
Also used : Space(org.uberfire.spaces.Space) SessionInfoMock(org.uberfire.mocks.SessionInfoMock) Repository(org.guvnor.structure.repositories.Repository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) SyncPromises(org.uberfire.promise.SyncPromises) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)9 SessionInfoMock (org.uberfire.mocks.SessionInfoMock)9 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)3 UsernameProvider (org.uberfire.preferences.shared.UsernameProvider)3 ArrayList (java.util.ArrayList)2 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)2 PreferenceScopeFactoryImpl (org.uberfire.preferences.shared.impl.PreferenceScopeFactoryImpl)2 SyncPromises (org.uberfire.promise.SyncPromises)2 Space (org.uberfire.spaces.Space)2 SocialUser (org.ext.uberfire.social.activities.model.SocialUser)1 Module (org.guvnor.common.services.project.model.Module)1 Branch (org.guvnor.structure.repositories.Branch)1 Repository (org.guvnor.structure.repositories.Repository)1 LibraryInfo (org.kie.workbench.common.screens.library.api.LibraryInfo)1 LibraryOrganizationalUnitPreferences (org.kie.workbench.common.screens.library.api.preferences.LibraryOrganizationalUnitPreferences)1 LibraryProjectPreferences (org.kie.workbench.common.screens.library.api.preferences.LibraryProjectPreferences)1 SessionInfo (org.uberfire.rpc.SessionInfo)1