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 MavenITmng3885UniqueVersionFromParentProfileTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng3885UniqueVersionFromParentProfileTest()
37 {
38
39 super( "(2.0.10,3.0-alpha-1)" );
40 }
41
42
43
44
45
46
47
48 public void testitNonUniqueVersionReactor()
49 throws Exception
50 {
51 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3885" );
52
53 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
54 verifier.setLogFileName( "log-f.txt" );
55 verifier.setAutoclean( false );
56 verifier.deleteDirectory( "repo-f" );
57 verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
58 verifier.addCliOption( "-Pnon-unique-version" );
59 verifier.executeGoal( "validate" );
60 verifier.verifyErrorFreeLog();
61 verifier.resetStreams();
62
63 verifier.assertFilePresent( "repo-f/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-SNAPSHOT.jar" );
64 }
65
66
67
68
69
70
71
72 public void testitNonUniqueVersionStandalone()
73 throws Exception
74 {
75 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3885" );
76
77 Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() );
78 verifier.setLogFileName( "log-f.txt" );
79 verifier.setAutoclean( false );
80 verifier.deleteDirectory( "repo-f" );
81 verifier.filterFile( "../pom-template.xml", "../pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
82 verifier.addCliOption( "-Pnon-unique-version" );
83 verifier.executeGoal( "validate" );
84 verifier.verifyErrorFreeLog();
85 verifier.resetStreams();
86
87 verifier.assertFilePresent( "repo-f/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-SNAPSHOT.jar" );
88 }
89
90
91
92
93
94
95
96 public void testitUniqueVersionReactor()
97 throws Exception
98 {
99 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3885" );
100
101 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
102 verifier.setLogFileName( "log-t.txt" );
103 verifier.setAutoclean( false );
104 verifier.deleteDirectory( "repo-t" );
105 verifier.filterFile( "pom-template.xml", "pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
106 verifier.addCliOption( "-Punique-version" );
107 verifier.executeGoal( "validate" );
108 verifier.verifyErrorFreeLog();
109 verifier.resetStreams();
110
111 verifier.assertFileNotPresent( "repo-t/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-SNAPSHOT.jar" );
112 verifier.assertFilePresent( "repo-t/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-*-1.jar" );
113 }
114
115
116
117
118
119
120
121 public void testitUniqueVersionStandalone()
122 throws Exception
123 {
124 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3885" );
125
126 Verifier verifier = newVerifier( new File( testDir, "sub" ).getAbsolutePath() );
127 verifier.setLogFileName( "log-t.txt" );
128 verifier.setAutoclean( false );
129 verifier.deleteDirectory( "repo-t" );
130 verifier.filterFile( "../pom-template.xml", "../pom.xml", "UTF-8", verifier.newDefaultFilterProperties() );
131 verifier.addCliOption( "-Punique-version" );
132 verifier.executeGoal( "validate" );
133 verifier.verifyErrorFreeLog();
134 verifier.resetStreams();
135
136 verifier.assertFileNotPresent( "repo-t/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-SNAPSHOT.jar" );
137 verifier.assertFilePresent( "repo-t/org/apache/maven/its/mng3885/sub/0.2-SNAPSHOT/sub-0.2-*-1.jar" );
138 }
139
140 }