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.List;
26
27
28
29
30
31
32 public class MavenITmng4800NearestWinsVsScopeWideningTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng4800NearestWinsVsScopeWideningTest()
37 {
38 super( "[3.0-beta-4,)" );
39 }
40
41 public void testitAB()
42 throws Exception
43 {
44 testit( "test-ab" );
45 }
46
47 public void testitBA()
48 throws Exception
49 {
50 testit( "test-ba" );
51 }
52
53
54
55
56
57
58 private void testit( String test )
59 throws Exception
60 {
61 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4800" );
62
63 Verifier verifier = newVerifier( new File( testDir, test ).getAbsolutePath() );
64 verifier.setAutoclean( false );
65 verifier.deleteDirectory( "target" );
66 verifier.deleteArtifacts( "org.apache.maven.its.mng4800" );
67 verifier.addCliOption( "-s" );
68 verifier.addCliOption( "settings.xml" );
69 verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
70 verifier.executeGoal( "validate" );
71 verifier.verifyErrorFreeLog();
72 verifier.resetStreams();
73
74 List<String> compile = verifier.loadLines( "target/compile.txt", "UTF-8" );
75
76 assertTrue( test + " > " + compile.toString(), compile.contains( "b-0.1.jar" ) );
77 assertTrue( test + " > " + compile.toString(), compile.contains( "c-0.1.jar" ) );
78 assertTrue( test + " > " + compile.toString(), compile.contains( "s-0.1.jar" ) );
79 assertTrue( test + " > " + compile.toString(), compile.contains( "x-0.1.jar" ) );
80 assertFalse( test + " > " + compile.toString(), compile.contains( "a-0.1.jar" ) );
81 assertFalse( test + " > " + compile.toString(), compile.contains( "s-0.2.jar" ) );
82 assertFalse( test + " > " + compile.toString(), compile.contains( "y-0.1.jar" ) );
83
84 List<String> runtime = verifier.loadLines( "target/runtime.txt", "UTF-8" );
85
86 assertTrue( test + " > " + runtime.toString(), runtime.contains( "b-0.1.jar" ) );
87 assertTrue( test + " > " + runtime.toString(), runtime.contains( "c-0.1.jar" ) );
88 assertTrue( test + " > " + runtime.toString(), runtime.contains( "s-0.1.jar" ) );
89 assertTrue( test + " > " + runtime.toString(), runtime.contains( "x-0.1.jar" ) );
90 assertTrue( test + " > " + runtime.toString(), runtime.contains( "a-0.1.jar" ) );
91 assertFalse( test + " > " + runtime.toString(), runtime.contains( "s-0.2.jar" ) );
92 assertFalse( test + " > " + runtime.toString(), runtime.contains( "y-0.1.jar" ) );
93 }
94
95 }