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