use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method queryAnItemThatIsInLuceneIndexButAlreadyDeletedFromGitRepository.
@Test
public void queryAnItemThatIsInLuceneIndexButAlreadyDeletedFromGitRepository() throws Exception {
final Path path = mockPath("file://the_project");
final WorkspaceProject project = spy(WorkspaceProject.class);
final Branch branch = mock(Branch.class);
when(project.getBranch()).thenReturn(branch);
when(branch.getPath()).thenReturn(path);
doReturn(true).when(ioService).exists(any());
final ProjectAssetsQuery query = new ProjectAssetsQuery(project, "", 10, 20, Collections.emptyList());
final PageResponse<RefactoringPageRow> pageRowPageResponse = new PageResponse<>();
final ArrayList<RefactoringPageRow> assetPageRowList = new ArrayList<>();
final RefactoringPageRow pageRow = mock(RefactoringPageRow.class);
final Path filePath = mockPath("file://the_project/delete.me");
when(filePath.getFileName()).thenReturn("delete.me");
when(pageRow.getValue()).thenReturn(filePath);
assetPageRowList.add(pageRow);
pageRowPageResponse.setPageRowList(assetPageRowList);
when(refactoringQueryService.query(any(RefactoringPageRequest.class))).thenReturn(pageRowPageResponse);
when(ioService.readAttributes(any())).thenThrow(new NoSuchFileException());
final AssetQueryResult result = libraryService.getProjectAssets(query);
assertEquals(ResultType.Normal, result.getResultType());
assertTrue(result.getAssetInfos().isPresent());
List<AssetInfo> projectAssets = result.getAssetInfos().get();
assertTrue(projectAssets.isEmpty());
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryServiceImplTest method emptyFirstPage.
@Test
public void emptyFirstPage() throws Exception {
final WorkspaceProject project = spy(WorkspaceProject.class);
final Branch branch = mock(Branch.class);
final Path path = mock(Path.class);
when(project.getBranch()).thenReturn(branch);
when(branch.getPath()).thenReturn(path);
when(path.toURI()).thenReturn("file://a/b/c");
doReturn(true).when(ioService).exists(any());
final ProjectAssetsQuery query = new ProjectAssetsQuery(project, "", 0, 10, Collections.emptyList());
final PageResponse<RefactoringPageRow> pageRowPageResponse = new PageResponse<>();
pageRowPageResponse.setPageRowList(new ArrayList<>());
when(refactoringQueryService.query(any(RefactoringPageRequest.class))).thenReturn(pageRowPageResponse);
libraryService.getProjectAssets(query);
verify(refactoringQueryService).query(pageRequestArgumentCaptor.capture());
final RefactoringPageRequest pageRequest = pageRequestArgumentCaptor.getValue();
assertEquals(FindAllLibraryAssetsQuery.NAME, pageRequest.getQueryName());
assertEquals(1, pageRequest.getQueryTerms().size());
assertEquals("file://a/b/c", pageRequest.getQueryTerms().iterator().next().getValue());
assertEquals(0, pageRequest.getStartRowIndex());
assertEquals(10, (int) pageRequest.getPageSize());
}
use of org.guvnor.common.services.project.model.WorkspaceProject 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.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class ProjectScreen method getDuplicateCommand.
CommandWithFileNameAndCommitMessage getDuplicateCommand() {
return details -> {
copyPopUpPresenter.getView().hide();
view.showBusyIndicator(view.getLoadingMessage());
promises.promisify(projectScreenService, s -> {
s.copy(workspaceProject, details.getNewFileName());
}).then(i -> {
view.hideBusyIndicator();
notificationEvent.fire(new NotificationEvent(view.getItemSuccessfullyDuplicatedMessage(), NotificationEvent.NotificationType.SUCCESS));
return promises.resolve();
}).catch_(this::onError);
};
}
use of org.guvnor.common.services.project.model.WorkspaceProject in project kie-wb-common by kiegroup.
the class LibraryPlaces method goToProject.
public void goToProject(final WorkspaceProject project) {
if (projectContext.getActiveWorkspaceProject().map(activeProject -> !activeProject.equals(project)).orElse(true)) {
if (closeAllPlacesOrNothing()) {
projectContextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(project, project.getMainModule()));
goToProject();
}
} else {
goToProject();
}
}
Aggregations