use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ProjectScreenTestBase method createProject.
protected WorkspaceProject createProject() {
final Path rootPath = mock(Path.class);
doReturn("git://modulePath").when(rootPath).toURI();
final Module module = mock(Module.class);
doReturn("mainModuleName").when(module).getModuleName();
doReturn("modulePath").when(module).getIdentifier();
doReturn(rootPath).when(module).getRootPath();
final Path pomPath = mock(Path.class);
doReturn(pomPath).when(module).getPomXMLPath();
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final Repository repository = mock(Repository.class);
final Path repositoryRootPath = mock(Path.class);
doReturn(Optional.of(new Branch("master", repositoryRootPath))).when(repository).getDefaultBranch();
doReturn("rootpath").when(repositoryRootPath).toURI();
return new WorkspaceProject(organizationalUnit, repository, new Branch("master", mock(Path.class)), module);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class EditContributorsPopUpPresenterTest method showWithoutPermissionTest.
@Test
public void showWithoutPermissionTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn(false).when(organizationalUnitController).canUpdateOrgUnit(organizationalUnit);
presenter.show(organizationalUnit);
verify(contributorsManagementPresenter, never()).setup();
verify(view, never()).append(any());
verify(view, never()).show(organizationalUnit);
assertNull(presenter.organizationalUnit);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ContributorsListPresenterTest method setupTest.
@Test
public void setupTest() {
final InOrder order = inOrder(contributorsListItemPresenter);
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();
when(projectContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(organizationalUnit));
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.setup();
verify(view).init(presenter);
verify(view).clearContributors();
order.verify(contributorsListItemPresenter).setup("a", "Contributor");
order.verify(contributorsListItemPresenter).setup("B", "Owner");
order.verify(contributorsListItemPresenter).setup("c", "Contributor");
verify(view, times(3)).addContributor(any());
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class ContributorsListPresenterTest method editWithoutPermissionTest.
@Test
public void editWithoutPermissionTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
doReturn(Optional.of(organizationalUnit)).when(projectContext).getActiveOrganizationalUnit();
doReturn(false).when(organizationalUnitController).canUpdateOrgUnit(organizationalUnit);
presenter.edit();
verify(editContributorsPopUpPresenter, never()).show(organizationalUnit);
}
use of org.guvnor.structure.organizationalunit.OrganizationalUnit in project kie-wb-common by kiegroup.
the class AddProjectPopUpPresenterTest method newWorkbenchProjectWithAdvancedSettingsIsCreated.
@Test
public void newWorkbenchProjectWithAdvancedSettingsIsCreated() 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();
doReturn("groupId").when(view).getGroupId();
doReturn("artifactId").when(view).getArtifactId();
doReturn("version").when(view).getVersion();
doReturn(true).when(view).isAdvancedOptionsSelected();
presenter.add();
final ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);
verify(libraryService).createProject(eq(organizationalUnit), pomArgumentCaptor.capture(), eq(DeploymentMode.VALIDATED));
final POM pom = pomArgumentCaptor.getValue();
assertEquals("test", pom.getName());
assertEquals("description", pom.getDescription());
assertEquals("groupId", pom.getGav().getGroupId());
assertEquals("artifactId", pom.getGav().getArtifactId());
assertEquals("version", pom.getGav().getVersion());
}
Aggregations