1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.maven.it;
21
22 import org.apache.maven.it.util.ResourceExtractor;
23
24 import java.io.File;
25 import java.util.List;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 public class MavenITmng2720SiblingClasspathArtifactsTest
41 extends AbstractMavenIntegrationTestCase
42 {
43
44 public MavenITmng2720SiblingClasspathArtifactsTest()
45 {
46 super( "[2.1.0,)" );
47 }
48
49 public void testIT()
50 throws Exception
51 {
52 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2720" );
53
54 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
55 verifier.setAutoclean( false );
56 verifier.deleteDirectory( "child2/target" );
57 verifier.deleteDirectory( "child3/target" );
58 verifier.executeGoal( "initialize" );
59 verifier.verifyErrorFreeLog();
60 verifier.resetStreams();
61
62 List<String> classPath;
63
64 classPath = verifier.loadLines( "child2/target/compile.txt", "UTF-8" );
65 assertMainJar( classPath );
66
67 classPath = verifier.loadLines( "child2/target/runtime.txt", "UTF-8" );
68 assertMainJar( classPath );
69
70 classPath = verifier.loadLines( "child2/target/test.txt", "UTF-8" );
71 assertMainJar( classPath );
72
73 classPath = verifier.loadLines( "child3/target/compile.txt", "UTF-8" );
74 assertTestJar( classPath );
75
76 classPath = verifier.loadLines( "child3/target/runtime.txt", "UTF-8" );
77 assertTestJar( classPath );
78
79 classPath = verifier.loadLines( "child3/target/test.txt", "UTF-8" );
80 assertTestJar( classPath );
81 }
82
83 private void assertMainJar( List<String> classPath )
84 {
85 assertTrue( classPath.toString(), classPath.contains( "main.jar" ) );
86 assertFalse( classPath.toString(), classPath.contains( "main" ) );
87 assertFalse( classPath.toString(), classPath.contains( "test.jar" ) );
88 assertFalse( classPath.toString(), classPath.contains( "test" ) );
89 }
90
91 private void assertTestJar( List<String> classPath )
92 {
93 assertFalse( classPath.toString(), classPath.contains( "main.jar" ) );
94 assertFalse( classPath.toString(), classPath.contains( "main" ) );
95 assertTrue( classPath.toString(), classPath.contains( "test.jar" ) );
96 assertFalse( classPath.toString(), classPath.contains( "test" ) );
97 }
98
99 }