1 package org.apache.maven.it;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.it.util.ResourceExtractor;
23
24 import java.io.File;
25 import java.util.*;
26
27
28
29
30 public class MavenITmng6173GetProjectsAndDependencyGraphTest
31 extends AbstractMavenIntegrationTestCase
32 {
33
34 public MavenITmng6173GetProjectsAndDependencyGraphTest()
35 {
36 super( "[3.0-alpha-3,)" );
37 }
38
39
40
41
42
43
44
45 public void testitShouldReturnProjectsAndProjectDependencyGraph()
46 throws Exception
47 {
48
49 File testDir = ResourceExtractor.simpleExtractResources( getClass(),
50 "/mng-6173-get-projects-and-dependency-graph" );
51
52 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
53 verifier.setAutoclean( false );
54 verifier.deleteDirectory( "target" );
55 verifier.deleteDirectory( "module-1/target" );
56 verifier.deleteDirectory( "module-2/target" );
57 verifier.addCliOption( "-pl" );
58 verifier.addCliOption( "module-1" );
59 verifier.executeGoal( "validate" );
60 verifier.verifyErrorFreeLog();
61 verifier.resetStreams();
62
63 Properties properties = verifier.loadProperties( "module-1/target/session.properties" );
64 assertEquals( "1", properties.getProperty( "session.projects.size" ) );
65 assertEquals( "module-1", properties.getProperty( "session.projects.0.artifactId" ) );
66 assertEquals( "1", properties.getProperty("session.projectDependencyGraph.sortedProjects.size" ) );
67 assertEquals( "module-1", properties.getProperty(
68 "session.projectDependencyGraph.sortedProjects.0.artifactId" ) );
69 }
70
71 }