use of org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl in project kie-wb-common by kiegroup.
the class SocialEventOUConstraintTest method setUp.
@Before
public void setUp() throws Exception {
Collection<OrganizationalUnit> ous = new ArrayList<OrganizationalUnit>();
final OrganizationalUnitImpl ou = new OrganizationalUnitImpl("ouname", "owner", "groupid");
ous.add(ou);
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(ous);
when(authorizationManager.authorize(ou, user)).thenReturn(true);
when(userCDIContextHelper.getUser()).thenReturn(user);
when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(true);
socialEventOUConstraint = new SocialEventOUConstraint(organizationalUnitService, authorizationManager, repositoryService, userCDIContextHelper);
}
use of org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl in project kie-wb-common by kiegroup.
the class SocialEventRepositoryConstraintTest method setUp.
@Before
public void setUp() throws Exception {
Collection<OrganizationalUnit> ous = new ArrayList<OrganizationalUnit>();
final OrganizationalUnitImpl ou = new OrganizationalUnitImpl("ouname", "owner", "groupid");
final OrganizationalUnitImpl ouSpy = spy(ou);
Collection<Repository> repositories = new ArrayList<Repository>();
repository = new GitRepository("repo", new Space("space"));
repositories.add(repository);
ous.add(ouSpy);
when(ouSpy.getRepositories()).thenReturn(repositories);
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(ous);
when(authorizationManager.authorize(ou, user)).thenReturn(true);
when(authorizationManager.authorize(repository, user)).thenReturn(true);
when(userCDIContextHelper.getUser()).thenReturn(user);
when(userCDIContextHelper.thereIsALoggedUserInScope()).thenReturn(true);
socialEventRepositoryConstraint = createSocialEventRepositoryContraint();
}
use of org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl in project kie-wb-common by kiegroup.
the class ImportRepositoryPopUpPresenterTest method setup.
@Before
public void setup() {
ou = new OrganizationalUnitImpl("test-ou", "test-admin", "test-id");
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(ou));
libraryServiceCaller = new CallerMock<>(libraryService);
presenter = new ImportRepositoryPopUpPresenter(view, libraryPlaces, projectContext, libraryServiceCaller);
}
use of org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl in project kie-wb-common by kiegroup.
the class OrganizationalUnitsScreenTest method setup.
@Before
public void setup() {
when(translationService.getTranslation(anyString())).thenReturn("");
libraryServiceCaller = new CallerMock<>(libraryService);
organizationalUnit1 = new OrganizationalUnitImpl("ou1", "owner1", "defaultGroupId1");
organizationalUnit2 = new OrganizationalUnitImpl("ou2", "owner2", "defaultGroupId2");
organizationalUnit3 = new OrganizationalUnitImpl("ou3", "owner3", "defaultGroupId3");
List<OrganizationalUnit> organizationalUnits = new ArrayList<>();
organizationalUnits.add(organizationalUnit1);
organizationalUnits.add(organizationalUnit2);
organizationalUnits.add(organizationalUnit3);
doReturn(organizationalUnits).when(libraryService).getOrganizationalUnits();
presenter = spy(new OrganizationalUnitsScreen(view, libraryPlaces, libraryServiceCaller, organizationalUnitPopUpPresenter, organizationalUnitController, organizationalUnitTileWidgets, projectContextChangeEvent, mock(WorkspaceProjectContext.class), libraryInternalPreferences, emptyOrganizationalUnitsScreen));
doReturn(true).when(organizationalUnitController).canCreateOrgUnits();
doReturn(true).when(organizationalUnitController).canReadOrgUnits();
doReturn(true).when(organizationalUnitController).canReadOrgUnit(any());
doReturn(tileWidget).when(organizationalUnitTileWidgets).get();
doReturn(mock(EmptyOrganizationalUnitsScreen.View.class)).when(emptyOrganizationalUnitsScreen).getView();
}
use of org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl in project kie-wb-common by kiegroup.
the class EditContributorsPopUpPresenterTest method setup.
@Before
public void setup() {
doReturn(true).when(organizationalUnitController).canReadOrgUnits();
doReturn(true).when(organizationalUnitController).canReadOrgUnit(any());
doReturn(true).when(organizationalUnitController).canUpdateOrgUnit(any());
doReturn(true).when(organizationalUnitController).canCreateOrgUnits();
doReturn(true).when(organizationalUnitController).canDeleteOrgUnit(any());
organizationalUnitServiceCaller = new CallerMock<>(organizationalUnitService);
doReturn(null).when(organizationalUnitService).getOrganizationalUnit(anyString());
doAnswer(invocationOnMock -> new OrganizationalUnitImpl((String) invocationOnMock.getArguments()[0], (String) invocationOnMock.getArguments()[1], (String) invocationOnMock.getArguments()[2])).when(organizationalUnitService).updateOrganizationalUnit(anyString(), anyString(), anyString(), any());
doReturn(mock(ContributorsManagementPresenter.View.class)).when(contributorsManagementPresenter).getView();
presenter = spy(new EditContributorsPopUpPresenter(view, contributorsManagementPresenter, afterEditOrganizationalUnitEvent, notificationEvent, organizationalUnitController, organizationalUnitServiceCaller));
}
Aggregations