use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method importProjectWithoutCredentialsTest.
@Test
public void importProjectWithoutCredentialsTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final Repository repo = mock(Repository.class);
final WorkspaceProject project = mock(WorkspaceProject.class);
final String repositoryURL = "file:///some/path/to/fake-repo.git";
final String username = null;
final String password = null;
final ArgumentCaptor<RepositoryEnvironmentConfigurations> configCaptor = ArgumentCaptor.forClass(RepositoryEnvironmentConfigurations.class);
when(repositoryService.createRepository(any(), any(), any(), configCaptor.capture())).thenReturn(repo);
when(projectService.resolveProject(any(Repository.class))).thenReturn(project);
final WorkspaceProject observedProject = libraryService.importProject(organizationalUnit, repositoryURL, username, password);
verify(repositoryService).createRepository(same(organizationalUnit), eq(GitRepository.SCHEME.toString()), eq("fake-repo"), any());
RepositoryEnvironmentConfigurations observedConfig = configCaptor.getValue();
assertEquals(username, observedConfig.getUserName());
assertEquals(password, observedConfig.getPassword());
assertEquals(repositoryURL, observedConfig.getOrigin());
verify(projectService).resolveProject(same(repo));
assertSame(project, observedProject);
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method importProjectWithCredentialsTest.
@Test
public void importProjectWithCredentialsTest() {
final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
final Repository repo = mock(Repository.class);
final WorkspaceProject project = mock(WorkspaceProject.class);
final String repositoryURL = "file:///some/path/to/fake-repo.git";
final String username = "fakeUser";
final String password = "fakePassword";
final ArgumentCaptor<RepositoryEnvironmentConfigurations> configCaptor = ArgumentCaptor.forClass(RepositoryEnvironmentConfigurations.class);
when(repositoryService.createRepository(any(), any(), any(), configCaptor.capture())).thenReturn(repo);
when(projectService.resolveProject(any(Repository.class))).thenReturn(project);
final WorkspaceProject observedProject = libraryService.importProject(organizationalUnit, repositoryURL, username, password);
verify(repositoryService).createRepository(same(organizationalUnit), eq(GitRepository.SCHEME.toString()), eq("fake-repo"), any());
RepositoryEnvironmentConfigurations observedConfig = configCaptor.getValue();
assertEquals(username, observedConfig.getUserName());
assertEquals(password, observedConfig.getPassword());
assertEquals(repositoryURL, observedConfig.getOrigin());
verify(projectService).resolveProject(same(repo));
assertSame(project, observedProject);
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class ContributorsManagerTest method setUp.
@Before
public void setUp() throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
List<VersionRecord> repositoryHistory1 = new ArrayList<>();
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("02/01/2017"), "default://3da0441b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/01/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("02/01/2017"), "default://3da0443b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/02/2017"), "default://3da0441b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/03/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("02/03/2017"), "default://3da04471@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/04/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/05/2017"), "default://3da0443b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/02/2017"), "default://3da0444b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/05/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/06/2017"), "default://3da0443b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("01/06/2017"), "default://3da0447b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/06/2017"), "default://3da0445b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/06/2017"), "default://3da0457b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/06/2017"), "default://3da0441b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/03/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/04/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/05/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/06/2017"), "default://3da0443b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/0/2017"), "default://3da04474@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/08/2016"), "default://3da0445b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/08/2016"), "default://3da0446b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/09/2016"), "default://3da0447b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/10/2016"), "default://3da0445b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/11/2016"), "default://3da0444b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/11/2016"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/12/2016"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("01/12/2016"), "default://3da0441b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/04/2017"), "default://3da0444b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/05/2017"), "default://3da0444b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/02/2017"), "default://3da0443b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/05/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/06/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("02/01/2017"), "default://3da0441b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/01/2017"), "default://3da0442b@project1/file"));
repositoryHistory1.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("02/01/2017"), "default://3da0443b@project1/file"));
List<VersionRecord> repositoryHistory2 = new ArrayList<>();
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/02/2017"), "default://3da0441b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/03/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("02/03/2017"), "default://3da04471@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/04/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/05/2017"), "default://3da0443b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/02/2017"), "default://3da0444b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/05/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/06/2017"), "default://3da0443b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("01/06/2017"), "default://3da0447b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/06/2017"), "default://3da0445b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/06/2017"), "default://3da0457b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/06/2017"), "default://3da0441b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/03/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/04/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/05/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/06/2017"), "default://3da0443b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/0/2017"), "default://3da04474@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/08/2016"), "default://3da0445b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/08/2016"), "default://3da0446b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/09/2016"), "default://3da0447b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/10/2016"), "default://3da0445b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Pere", null, "", sdf.parse("01/11/2016"), "default://3da0444b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/11/2016"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("01/12/2016"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("01/12/2016"), "default://3da0441b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "David", null, "", sdf.parse("02/01/2017"), "default://3da0441b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/02/2017"), "default://3da0442b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/03/2017"), "default://3da0443b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("02/03/2017"), "default://3da0444b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/04/2017"), "default://3da0444b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Roger", null, "", sdf.parse("02/05/2017"), "default://3da0444b@project2/file"));
repositoryHistory2.add(new PortableVersionRecord(null, "Mark", null, "", sdf.parse("01/02/2017"), "default://3da0443b@project2/file"));
System.out.println("SUM = " + (repositoryHistory1.size() + repositoryHistory2.size()));
final Repository repo1 = makeRepository("testRepo1");
final Repository repo2 = makeRepository("testRepo2");
final OrganizationalUnit org1 = makeOrganizationalUnit("test1", Arrays.asList(repo1, repo2));
when(organizationalUnitService.getOrganizationalUnits()).thenReturn(Arrays.asList(org1));
final Set<WorkspaceProject> projects = new HashSet<>();
projects.add(makeProject(repo1, org1, "project1"));
projects.add(makeProject(repo2, org1, "project2"));
when(projectService.getAllWorkspaceProjects(eq(org1))).thenReturn(projects);
when(recordService.loadVersionRecords(any())).thenReturn(repositoryHistory1).thenReturn(repositoryHistory2);
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class ContributorsManagerTest method makeRepository.
private Repository makeRepository(final String repositoryAlias) {
final Repository repository = mock(Repository.class);
when(repository.getAlias()).thenReturn(repositoryAlias);
return repository;
}
use of org.guvnor.structure.repositories.Repository in project kie-wb-common by kiegroup.
the class LibraryToolbarPresenter method onUpdateSelectedBranch.
void onUpdateSelectedBranch() {
if (placeManager.closeAllPlacesOrNothing()) {
Repository repository = projectContext.getActiveWorkspaceProject().map(workspaceProject -> workspaceProject.getRepository()).orElseThrow(() -> new IllegalStateException("Cannot get repository without an active workspace project"));
projectService.call(new RemoteCallback<WorkspaceProject>() {
@Override
public void callback(WorkspaceProject project) {
libraryPlaces.goToProject(project);
setBranchSelectorVisibility();
}
}).resolveProject(repository.getSpace(), repository.getBranch(view.getSelectedBranch()).get());
} else {
setUpBranches();
}
}
Aggregations