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
26
27
28
29
30
31
32 public class MavenITmng0449PluginVersionResolutionTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng0449PluginVersionResolutionTest()
37 {
38 super( "[2.0,)" );
39 }
40
41
42
43
44
45
46
47 public void testitLifecycleInvocation()
48 throws Exception
49 {
50 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0449" );
51 testDir = new File( testDir, "lifecycle" );
52
53 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
54 verifier.setAutoclean( false );
55 verifier.deleteDirectory( "target" );
56 try
57 {
58 verifier.deleteArtifacts( "org.apache.maven.its.mng0449" );
59 }
60 catch ( Exception e )
61 {
62
63 }
64 verifier.addCliOption( "--settings" );
65 verifier.addCliOption( "settings.xml" );
66 verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
67 verifier.executeGoal( "validate" );
68 verifier.verifyErrorFreeLog();
69 verifier.resetStreams();
70
71
72 if ( matchesVersionRange( "(,3.0-alpha-3)" ) )
73 {
74 verifier.assertFileNotPresent( "target/touch-release.txt" );
75 verifier.assertFilePresent( "target/touch-snapshot.txt" );
76 }
77 else
78 {
79 verifier.assertFilePresent( "target/touch-release.txt" );
80 verifier.assertFileNotPresent( "target/touch-snapshot.txt" );
81 }
82 verifier.assertFilePresent( "target/package.txt" );
83 }
84
85
86
87
88
89
90
91 public void testitCliInvocation()
92 throws Exception
93 {
94 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-0449" );
95 testDir = new File( testDir, "direct" );
96
97 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
98 verifier.setAutoclean( false );
99 verifier.deleteDirectory( "target" );
100 try
101 {
102 verifier.deleteArtifacts( "org.apache.maven.its.mng0449" );
103 }
104 catch ( Exception e )
105 {
106
107 }
108 verifier.addCliOption( "--settings" );
109 verifier.addCliOption( "settings.xml" );
110 verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
111 verifier.executeGoal( "org.apache.maven.its.mng0449:maven-it-plugin-a:touch" );
112 verifier.verifyErrorFreeLog();
113 verifier.resetStreams();
114
115
116 if ( matchesVersionRange( "(,3.0-alpha-3)" ) )
117 {
118 verifier.assertFileNotPresent( "target/touch-release.txt" );
119 verifier.assertFilePresent( "target/touch-snapshot.txt" );
120 }
121 else
122 {
123 verifier.assertFilePresent( "target/touch-release.txt" );
124 verifier.assertFileNotPresent( "target/touch-snapshot.txt" );
125 }
126 }
127
128 }