use of org.guvnor.structure.organizationalunit.OrganizationalUnit 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.OrganizationalUnit in project kie-wb-common by kiegroup.
the class EditContributorsPopUpPresenterTest method showWithPermissionTest.
@Test
public void showWithPermissionTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
presenter.show(organizationalUnit);
verify(contributorsManagementPresenter).setup(organizationalUnit);
verify(view).append(any());
verify(view).show(organizationalUnit);
assertEquals(organizationalUnit, presenter.organizationalUnit);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ContributorsListPresenterTest method organizationalUnitEditedTest.
@Test
public void organizationalUnitEditedTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final AfterEditOrganizationalUnitEvent afterEditOrganizationalUnitEvent = mock(AfterEditOrganizationalUnitEvent.class);
doReturn(organizationalUnit).when(afterEditOrganizationalUnitEvent).getEditedOrganizationalUnit();
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
presenter.organizationalUnitEdited(afterEditOrganizationalUnitEvent);
verify(view).clearFilterText();
verify(presenter).updateContributors(organizationalUnit);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ContributorsListPresenterTest method filterContributorsTest.
@Test
public void filterContributorsTest() {
final InOrder order = inOrder(contributorsListItemPresenter);
presenter.contributors = new ArrayList<>();
presenter.contributors.add("John");
presenter.contributors.add("Mary");
presenter.contributors.add("Jonathan");
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn("Mary").when(organizationalUnit).getOwner();
doReturn(presenter.contributors).when(organizationalUnit).getContributors();
doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
presenter.filterContributors("h");
verify(view).clearContributors();
order.verify(contributorsListItemPresenter).setup("John", "Contributor");
order.verify(contributorsListItemPresenter).setup("Jonathan", "Contributor");
verify(view, times(2)).addContributor(any());
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ContributorsListPresenterTest method getContributorsCountTest.
@Test
public void getContributorsCountTest() {
final List<String> contributors = new ArrayList<>();
contributors.add("B");
contributors.add("c");
contributors.add("a");
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn("B").when(organizationalUnit).getOwner();
doReturn(contributors).when(organizationalUnit).getContributors();
doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
assertEquals(3, presenter.getContributorsCount());
}
Aggregations