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.Iterator;
26 import java.util.List;
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 public class MavenITmng2720SiblingClasspathArtifactsTest
42 extends AbstractMavenIntegrationTestCase
43 {
44
45 public MavenITmng2720SiblingClasspathArtifactsTest()
46 {
47 super( "[2.1.0,)" );
48 }
49
50 public void testIT()
51 throws Exception
52 {
53 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2720" );
54
55 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
56 verifier.setAutoclean( false );
57 verifier.deleteDirectory( "child2/target" );
58 verifier.deleteDirectory( "child3/target" );
59 verifier.executeGoal( "initialize" );
60 verifier.verifyErrorFreeLog();
61 verifier.resetStreams();
62
63 List classPath;
64
65 classPath = verifier.loadLines( "child2/target/compile.txt", "UTF-8" );
66 assertMainJar( classPath );
67
68 classPath = verifier.loadLines( "child2/target/runtime.txt", "UTF-8" );
69 assertMainJar( classPath );
70
71 classPath = verifier.loadLines( "child2/target/test.txt", "UTF-8" );
72 assertMainJar( classPath );
73
74 classPath = verifier.loadLines( "child3/target/compile.txt", "UTF-8" );
75 assertTestJar( classPath );
76
77 classPath = verifier.loadLines( "child3/target/runtime.txt", "UTF-8" );
78 assertTestJar( classPath );
79
80 classPath = verifier.loadLines( "child3/target/test.txt", "UTF-8" );
81 assertTestJar( classPath );
82 }
83
84 private void assertMainJar( List classPath )
85 {
86 assertTrue( classPath.toString(), classPath.contains( "main.jar" ) );
87 assertFalse( classPath.toString(), classPath.contains( "main" ) );
88 assertFalse( classPath.toString(), classPath.contains( "test.jar" ) );
89 assertFalse( classPath.toString(), classPath.contains( "test" ) );
90 }
91
92 private void assertTestJar( List classPath )
93 {
94 assertFalse( classPath.toString(), classPath.contains( "main.jar" ) );
95 assertFalse( classPath.toString(), classPath.contains( "main" ) );
96 assertTrue( classPath.toString(), classPath.contains( "test.jar" ) );
97 assertFalse( classPath.toString(), classPath.contains( "test" ) );
98 }
99
100 }