use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class RepositoryListServiceImplTest method setup.
@Before
public void setup() {
Set<Repository> repositories = new HashSet<Repository>();
repositories.add(new GitRepository("dora", new Space("space")));
final SocialEventRepositoryConstraint socialEventRepositoryConstraint = mock(SocialEventRepositoryConstraint.class);
when(socialEventRepositoryConstraint.getAuthorizedRepositories()).thenReturn(repositories);
service.repositoryConstraint = socialEventRepositoryConstraint;
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class ExplorerMenuTest method testOnArchiveActiveRepo.
@Test
public void testOnArchiveActiveRepo() throws Exception {
final Path rootRepoPath = mock(Path.class);
final Repository repository = mock(Repository.class);
when(repository.getDefaultBranch()).thenReturn(Optional.of(new Branch("master", rootRepoPath)));
final WorkspaceProject project = mock(WorkspaceProject.class);
when(project.getRepository()).thenReturn(repository);
when(context.getActiveWorkspaceProject()).thenReturn(Optional.of(project));
menu.onArchiveActiveRepository();
verify(view).archive(rootRepoPath);
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class BaseViewPresenterTest method testAutomaticModuleBuildDisabled.
@Test
public void testAutomaticModuleBuildDisabled() {
final OrganizationalUnit ou = mock(OrganizationalUnit.class);
final Repository repository = mock(Repository.class);
final Module module = mock(Module.class);
ApplicationPreferences.setUp(new HashMap<String, String>() {
{
put(ExplorerService.BUILD_PROJECT_PROPERTY_NAME, "true");
}
});
when(activeContextItems.setupActiveModule(content)).thenReturn(true);
final WorkspaceProject project = mock(WorkspaceProject.class);
when(project.getOrganizationalUnit()).thenReturn(ou);
when(project.getRepository()).thenReturn(repository);
when(project.getBranch()).thenReturn(new Branch("master", mock(Path.class)));
when(activeContextItems.getActiveProject()).thenReturn(project);
when(activeContextItems.getActiveModule()).thenReturn(module);
presenter.doContentCallback(content);
verify(buildServiceActual, never()).build(any(Module.class));
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method testDelete.
@Test
public void testDelete() throws Exception {
final WorkspaceProject project = mock(WorkspaceProject.class);
final Repository repository = mock(Repository.class);
final String ouName = "test-realm";
final Space space = new Space(ouName);
doReturn(repository).when(project).getRepository();
doReturn("myrepo").when(repository).getAlias();
doReturn(space).when(repository).getSpace();
service.delete(project);
verify(repositoryService).removeRepository(eq(space), eq("myrepo"));
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class ProjectScreenServiceImplTest method testCopyNoPOM.
@Test
public void testCopyNoPOM() throws Exception {
final WorkspaceProject project = mock(WorkspaceProject.class);
final OrganizationalUnit ou = mock(OrganizationalUnit.class);
final Path projectRoot = mock(Path.class);
doReturn(ou).when(project).getOrganizationalUnit();
doReturn(projectRoot).when(project).getRootPath();
final Repository newRepository = mock(Repository.class);
final Path newRepositoryRoot = PathFactory.newPath("root", "file:///root");
doReturn(Optional.of(new Branch("master", newRepositoryRoot))).when(newRepository).getDefaultBranch();
doReturn(newRepository).when(repositoryCopier).copy(ou, "newName", projectRoot);
doReturn(null).when(pomService).load(any(Path.class));
service.copy(project, "newName");
verify(repositoryCopier).copy(ou, "newName", projectRoot);
verify(metadataService, never()).getMetadata(any(Path.class));
verify(pomService, never()).save(any(Path.class), any(POM.class), any(Metadata.class), anyString(), anyBoolean());
}
Aggregations