Search in sources :

Example 1 with MavenServerResult

use of org.eclipse.che.maven.server.MavenServerResult in project che by eclipse.

the class MavenServerManagerTest method testResolveBadProject.

@Test
public void testResolveBadProject() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/BadProject/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    assertNotNull(resolveProject.getProblems());
    assertEquals(1, resolveProject.getProblems().size());
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 2 with MavenServerResult

use of org.eclipse.che.maven.server.MavenServerResult in project che by eclipse.

the class MavenServerManagerTest method testMultimoduleProjectModuleHasDependencyOnAnotherModule.

@Test
public void testMultimoduleProjectModuleHasDependencyOnAnotherModule() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/multimoduleProject/test/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    MavenProjectInfo projectInfo = resolveProject.getProjectInfo();
    assertNotNull(projectInfo);
    MavenModel mavenModel = projectInfo.getMavenModel();
    assertNotNull(mavenModel);
    assertThat(mavenModel.getPackaging()).isEqualTo("jar");
    assertThat(mavenModel.getModules()).isEmpty();
    assertThat(mavenModel.getDependencies()).isNotEmpty().hasSize(6);
    mavenModel.getDependencies().forEach(mavenArtifact -> System.out.println(mavenArtifact.getFile().getAbsolutePath()));
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) MavenModel(org.eclipse.che.maven.data.MavenModel) MavenProjectInfo(org.eclipse.che.maven.server.MavenProjectInfo) File(java.io.File) Test(org.testng.annotations.Test)

Example 3 with MavenServerResult

use of org.eclipse.che.maven.server.MavenServerResult in project che by eclipse.

the class MavenServerManagerTest method testResolveMultimoduleProjectModulePom.

@Test
public void testResolveMultimoduleProjectModulePom() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/multimoduleProject/subModule/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    MavenProjectInfo projectInfo = resolveProject.getProjectInfo();
    assertNotNull(projectInfo);
    MavenModel mavenModel = projectInfo.getMavenModel();
    assertNotNull(mavenModel);
    assertThat(mavenModel.getPackaging()).isEqualTo("jar");
    assertThat(mavenModel.getModules()).isEmpty();
    assertThat(mavenModel.getDependencies()).isNotEmpty().hasSize(3);
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) MavenModel(org.eclipse.che.maven.data.MavenModel) MavenProjectInfo(org.eclipse.che.maven.server.MavenProjectInfo) File(java.io.File) Test(org.testng.annotations.Test)

Example 4 with MavenServerResult

use of org.eclipse.che.maven.server.MavenServerResult in project che by eclipse.

the class MavenServerManagerTest method testResolveProject.

@Test
public void testResolveProject() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/FirstProject/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    assertNotNull(resolveProject.getProjectInfo());
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) File(java.io.File) Test(org.testng.annotations.Test)

Example 5 with MavenServerResult

use of org.eclipse.che.maven.server.MavenServerResult in project che by eclipse.

the class MavenServerManagerTest method testProjectHasDependencies.

@Test
public void testProjectHasDependencies() throws Exception {
    MavenServerResult resolveProject = mavenServer.resolveProject(new File(MavenServerManagerTest.class.getResource("/FirstProject/pom.xml").getFile()), Collections.emptyList(), Collections.emptyList());
    assertNotNull(resolveProject);
    MavenProjectInfo projectInfo = resolveProject.getProjectInfo();
    assertNotNull(projectInfo);
    MavenModel mavenModel = projectInfo.getMavenModel();
    assertNotNull(mavenModel);
    List<MavenArtifact> dependencies = mavenModel.getDependencies();
    assertFalse(dependencies.isEmpty());
    assertEquals(26, dependencies.size());
}
Also used : MavenServerResult(org.eclipse.che.maven.server.MavenServerResult) MavenModel(org.eclipse.che.maven.data.MavenModel) MavenProjectInfo(org.eclipse.che.maven.server.MavenProjectInfo) File(java.io.File) MavenArtifact(org.eclipse.che.maven.data.MavenArtifact) Test(org.testng.annotations.Test)

Aggregations

MavenServerResult (org.eclipse.che.maven.server.MavenServerResult)7 File (java.io.File)6 Test (org.testng.annotations.Test)6 MavenProjectInfo (org.eclipse.che.maven.server.MavenProjectInfo)5 MavenModel (org.eclipse.che.maven.data.MavenModel)4 MavenArtifact (org.eclipse.che.maven.data.MavenArtifact)1