use of org.eclipse.core.resources.IProject in project che by eclipse.
the class PomChangeListener method updateProms.
// @ScheduleDelay(initialDelay = 30, delay = 3)
protected void updateProms() {
try {
if (projectToUpdate.size() == 0) {
return;
}
Set<String> projects = new HashSet<>(projectToUpdate);
projectToUpdate.clear();
IWorkspace workspace = eclipseWorkspaceProvider.get();
List<IProject> projectsList = projects.stream().map(project -> workspace.getRoot().getProject(project)).collect(Collectors.toList());
mavenWorkspace.update(projectsList);
} catch (Throwable t) {
JavaPlugin.log(t);
}
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class MavenServerService method reimportDependencies.
@POST
@Path("reimport")
@ApiOperation(value = "Re-import maven model")
@ApiResponses({ @ApiResponse(code = 200, message = "OK"), @ApiResponse(code = 500, message = "Internal Server Error") })
public Response reimportDependencies(@ApiParam(value = "The paths to projects which need to be reimported") @QueryParam("projectPath") List<String> paths) throws ServerException {
IWorkspace workspace = eclipseWorkspaceProvider.get();
List<IProject> projectsList = paths.stream().map(projectPath -> workspace.getRoot().getProject(projectPath)).collect(Collectors.toList());
mavenWorkspace.update(projectsList);
return Response.ok().build();
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class PomReconcilerTest method testReconcilePomWhenPomContainsDependecyWithIncorrectVersion.
@Test
public void testReconcilePomWhenPomContainsDependecyWithIncorrectVersion() throws Exception {
String brokenDependency = " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <version>33333333.8.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n";
MavenServerService serverService = new MavenServerService(null, projectRegistry, pm, projectManager, null, null);
FolderEntry testProject = createTestProject(PROJECT_NAME, getPomContentWithDependency(brokenDependency));
VirtualFileEntry pom = testProject.getChild("pom.xml");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
mavenWorkspace.update(Collections.singletonList(project));
mavenWorkspace.waitForUpdate();
List<Problem> problems = serverService.reconcilePom(String.format("/%s/pom.xml", PROJECT_NAME));
assertThat(problems).hasSize(1);
assertThat(problems.get(0).isError()).isTrue();
assertThat(pom).isNotNull();
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class PomReconcilerTest method testReconcilePomWhenPomContainsCorrectDependency.
@Test
public void testReconcilePomWhenPomContainsCorrectDependency() throws Exception {
String dependency = " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <version>3.8.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n";
MavenServerService serverService = new MavenServerService(null, projectRegistry, pm, projectManager, null, null);
FolderEntry testProject = createTestProject(PROJECT_NAME, getPomContentWithDependency(dependency));
VirtualFileEntry pom = testProject.getChild("pom.xml");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
mavenWorkspace.update(Collections.singletonList(project));
mavenWorkspace.waitForUpdate();
List<Problem> problems = serverService.reconcilePom(String.format("/%s/pom.xml", PROJECT_NAME));
assertThat(problems).isEmpty();
assertThat(pom).isNotNull();
}
use of org.eclipse.core.resources.IProject in project che by eclipse.
the class PomReconcilerTest method testReconcilePomWhenPomContainsDependecyWithIncorrectGroupId.
@Test
public void testReconcilePomWhenPomContainsDependecyWithIncorrectGroupId() throws Exception {
String brokenDependency = " <dependency>\n" + " <groupId>junittttt</groupId>\n" + " <artifactId>junit</artifactId>\n" + " <version>3.8.1</version>\n" + " <scope>test</scope>\n" + " </dependency>\n";
MavenServerService serverService = new MavenServerService(null, projectRegistry, pm, projectManager, null, null);
FolderEntry testProject = createTestProject(PROJECT_NAME, getPomContentWithDependency(brokenDependency));
VirtualFileEntry pom = testProject.getChild("pom.xml");
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
mavenWorkspace.update(Collections.singletonList(project));
mavenWorkspace.waitForUpdate();
List<Problem> problems = serverService.reconcilePom(String.format("/%s/pom.xml", PROJECT_NAME));
assertThat(problems).hasSize(1);
assertThat(problems.get(0).isError()).isTrue();
assertThat(pom).isNotNull();
}
Aggregations