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.io.IOException;
26 import java.util.Properties;
27
28
29
30
31
32
33
34 public class MavenITmng4254SelectableWagonProvidersTest
35 extends AbstractMavenIntegrationTestCase
36 {
37
38 public MavenITmng4254SelectableWagonProvidersTest()
39 {
40
41 super( "(2.2.0,3.0-alpha-1)" );
42 }
43
44 public void testCliUsage()
45 throws IOException, VerificationException
46 {
47 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4254" );
48
49 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
50 verifier.setAutoclean( false );
51 verifier.deleteDirectory( "target" );
52
53 verifier.addCliOption( "-Dmaven.wagon.provider.http=coreit" );
54 verifier.addCliOption( "-V" );
55
56 verifier.setLogFileName( "log-cli.txt" );
57 verifier.executeGoal( "validate" );
58
59 verifier.verifyErrorFreeLog();
60 verifier.resetStreams();
61
62 Properties props = verifier.loadProperties( "target/wagon-impl.properties" );
63 assertEquals( "org.apache.maven.wagon.providers.coreit.CoreItHttpWagon", props.getProperty( "wagon.class" ) );
64 }
65
66 public void testSettingsUsage()
67 throws IOException, VerificationException
68 {
69 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4254" );
70
71 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
72 verifier.setAutoclean( false );
73 verifier.deleteDirectory( "target" );
74
75 verifier.addCliOption( "--settings" );
76 verifier.addCliOption( "settings.xml" );
77 verifier.addCliOption( "-V" );
78
79 verifier.setLogFileName( "log-settings.txt" );
80 verifier.executeGoal( "validate" );
81
82 verifier.verifyErrorFreeLog();
83 verifier.resetStreams();
84
85 Properties props = verifier.loadProperties( "target/wagon-impl.properties" );
86 assertEquals( "org.apache.maven.wagon.providers.coreit.CoreItHttpWagon", props.getProperty( "wagon.class" ) );
87 }
88
89 public void testDefaultHttpWagon()
90 throws IOException, VerificationException
91 {
92 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4254" );
93
94 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
95 verifier.setAutoclean( false );
96 verifier.deleteDirectory( "target" );
97
98 verifier.addCliOption( "-V" );
99
100 verifier.setLogFileName( "log-default-http.txt" );
101 verifier.executeGoal( "validate" );
102
103 verifier.verifyErrorFreeLog();
104 verifier.resetStreams();
105
106 Properties props = verifier.loadProperties( "target/wagon-impl.properties" );
107 assertEquals( "org.apache.maven.wagon.providers.http.LightweightHttpWagon", props.getProperty( "wagon.class" ) );
108 }
109
110 public void testDefaultHttpsWagon()
111 throws IOException, VerificationException
112 {
113 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4254" );
114
115 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
116 verifier.setAutoclean( false );
117 verifier.deleteDirectory( "target" );
118
119 verifier.addCliOption( "-V" );
120 verifier.addCliOption( "-DwagonProtocol=https" );
121
122 verifier.setLogFileName( "log-default-https.txt" );
123 verifier.executeGoal( "validate" );
124
125 verifier.verifyErrorFreeLog();
126 verifier.resetStreams();
127
128 Properties props = verifier.loadProperties( "target/wagon-impl.properties" );
129 assertEquals( "org.apache.maven.wagon.providers.http.LightweightHttpsWagon", props.getProperty( "wagon.class" ) );
130 }
131
132 }