use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class BaseTest method createMultimoduleProject.
protected FolderEntry createMultimoduleProject() throws ServerException, NotFoundException, ConflictException, ForbiddenException {
String pom = "<groupId>test</groupId>" + "<artifactId>testArtifact</artifactId>" + "<version>42</version>" + "<modules>" + " <module>module1</module>" + " <module>module2</module>" + "</modules>";
FolderEntry parentFolder = createTestProject("parent", pom);
String pomModule1 = "<groupId>module1</groupId>" + "<artifactId>testModule1</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("parent/module1", pomModule1);
String pomModule2 = "<groupId>module2</groupId>" + "<artifactId>testModule2</artifactId>" + "<version>2</version>" + "<dependencies>" + " <dependency>" + " <groupId>junit</groupId>" + " <artifactId>junit</artifactId>" + " <version>4.12</version>" + " </dependency>" + "</dependencies>";
createTestProject("parent/module2", pomModule2);
return parentFolder;
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class BaseTest method createTestProject.
protected FolderEntry createTestProject(String name, String pomContent) throws ServerException, NotFoundException, ConflictException, ForbiddenException {
FolderEntry folder = pm.getProjectsRoot().createFolder(name);
folder.createFile("pom.xml", getPomContent(pomContent).getBytes());
projectRegistry.setProjectType(folder.getPath().toString(), MAVEN_ID, false);
//inform DeltaProcessingStat about new project
JavaModelManager.getJavaModelManager().deltaState.resourceChanged(new ResourceChangedEvent(root, new ProjectCreatedEvent("", folder.getPath().toString())));
return folder;
}
use of org.eclipse.che.api.project.server.FolderEntry in project che by eclipse.
the class PomReconcilerTest method testReconcilePomWhenPomContainsDependecyWithIncorrectAtrifactId.
@Test
public void testReconcilePomWhenPomContainsDependecyWithIncorrectAtrifactId() throws Exception {
String brokenDependency = " <dependency>\n" + " <groupId>junit</groupId>\n" + " <artifactId>jjjjjjjunit</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