Search in sources :

Example 6 with MavenServerService

use of org.eclipse.che.plugin.maven.server.rest.MavenServerService 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();
}
Also used : FolderEntry(org.eclipse.che.api.project.server.FolderEntry) VirtualFileEntry(org.eclipse.che.api.project.server.VirtualFileEntry) MavenServerService(org.eclipse.che.plugin.maven.server.rest.MavenServerService) Problem(org.eclipse.che.ide.ext.java.shared.dto.Problem) IProject(org.eclipse.core.resources.IProject) Test(org.testng.annotations.Test) MavenServerManagerTest(org.eclipse.che.plugin.maven.server.rmi.MavenServerManagerTest)

Aggregations

FolderEntry (org.eclipse.che.api.project.server.FolderEntry)6 VirtualFileEntry (org.eclipse.che.api.project.server.VirtualFileEntry)6 Problem (org.eclipse.che.ide.ext.java.shared.dto.Problem)6 MavenServerService (org.eclipse.che.plugin.maven.server.rest.MavenServerService)6 MavenServerManagerTest (org.eclipse.che.plugin.maven.server.rmi.MavenServerManagerTest)6 Test (org.testng.annotations.Test)6 IProject (org.eclipse.core.resources.IProject)4