Search in sources :

Example 26 with OrganizationalUnit

use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.

the class ContributorsListPresenterTest method editWithPermissionTest.

@Test
public void editWithPermissionTest() {
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
    presenter.edit();
    verify(editContributorsPopUpPresenter).show(organizationalUnit);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Test(org.junit.Test)

Example 27 with OrganizationalUnit

use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.

the class ContributorsManagementPresenterTest method setupTest.

@Test
public void setupTest() {
    final List<SocialUser> users = new ArrayList<>();
    users.add(userA);
    users.add(userB);
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    doReturn(users.stream().map(SocialUser::getUserName).collect(Collectors.toList())).when(organizationalUnit).getContributors();
    doReturn(userB.getUserName()).when(organizationalUnit).getOwner();
    presenter.setup(organizationalUnit);
    verify(view).init(presenter);
    verify(view).clearFilter();
    verify(contributorsManagementListItemPresenter).setup(userA);
    verify(contributorsManagementListItemPresenter).setup(userB);
    verify(contributorsManagementListItemPresenter).setup(userC);
    verify(contributorsManagementListItemPresenter, times(3)).setSelected(true);
    verify(contributorsManagementListItemPresenter, times(2)).setEnabled(true);
    verify(contributorsManagementListItemPresenter).setEnabled(false);
    verify(view).clearUsers();
    verify(view, times(3)).addUser(contributorsManagementListItemPresenter);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) SocialUser(org.ext.uberfire.social.activities.model.SocialUser) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 28 with OrganizationalUnit

use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.

the class DeleteOrganizationalUnitPopUpPresenterTest method showWithPermissionTest.

@Test
public void showWithPermissionTest() {
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    doReturn("ou-name").when(organizationalUnit).getName();
    presenter.show(organizationalUnit);
    verify(view).show(organizationalUnit.getName());
    assertEquals(organizationalUnit, presenter.organizationalUnit);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Test(org.junit.Test)

Example 29 with OrganizationalUnit

use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.

the class DeleteOrganizationalUnitPopUpPresenterTest method showWithoutPermissionTest.

@Test
public void showWithoutPermissionTest() {
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    doReturn("ou-name").when(organizationalUnit).getName();
    doReturn(false).when(organizationalUnitController).canDeleteOrgUnit(organizationalUnit);
    presenter.show(organizationalUnit);
    verify(view, never()).show(organizationalUnit.getName());
    assertNull(presenter.organizationalUnit);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Test(org.junit.Test)

Example 30 with OrganizationalUnit

use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.

the class AddProjectPopUpPresenterTest method newProjectIsCreated.

@Test
public void newProjectIsCreated() throws Exception {
    final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
    when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
    doReturn("test").when(view).getName();
    doReturn("description").when(view).getDescription();
    presenter.add();
    verify(libraryService).createProject("test", organizationalUnit, "description", DeploymentMode.VALIDATED);
}
Also used : OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) Test(org.junit.Test)

Aggregations

OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)60 Test (org.junit.Test)33 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)19 ArrayList (java.util.ArrayList)18 Repository (org.guvnor.structure.repositories.Repository)17 ExampleOrganizationalUnit (org.kie.workbench.common.screens.examples.model.ExampleOrganizationalUnit)13 Module (org.guvnor.common.services.project.model.Module)11 POM (org.guvnor.common.services.project.model.POM)10 Branch (org.guvnor.structure.repositories.Branch)10 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)10 WorkspaceProjectContextChangeEvent (org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent)9 Before (org.junit.Before)8 Path (org.uberfire.backend.vfs.Path)7 OrganizationalUnitImpl (org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl)6 ExampleProject (org.kie.workbench.common.screens.examples.model.ExampleProject)6 ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)5 NewProjectEvent (org.guvnor.common.services.project.events.NewProjectEvent)3 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 Command (org.uberfire.mvp.Command)3