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 java.io.File;
23
24 import org.apache.maven.it.util.ResourceExtractor;
25
26
27
28
29
30
31 public class MavenITmng6256SpecialCharsAlternatePOMLocation
32 extends AbstractMavenIntegrationTestCase
33 {
34 public MavenITmng6256SpecialCharsAlternatePOMLocation()
35 {
36 super( "(3.6.0,)" );
37 }
38
39 protected MavenITmng6256SpecialCharsAlternatePOMLocation( String constraint )
40 {
41 super( constraint );
42 }
43
44
45
46
47
48
49 public void testDirectoryWithSpace()
50 throws Exception
51 {
52 runWithMvnFileLongOption( "directory-with- -space" );
53 runWithMvnFileShortOption( "directory-with- -space" );
54 }
55
56
57
58
59
60
61 public void testDirectoryWithClosingBracket()
62 throws Exception
63 {
64 runWithMvnFileLongOption( "directory-with-)-closing-bracket" );
65 runWithMvnFileShortOption( "directory-with-)-closing-bracket" );
66 }
67
68 private void runWithMvnFileLongOption( String subDir )
69 throws Exception
70 {
71 runCoreExtensionWithOption( "--file", subDir );
72 }
73
74 private void runWithMvnFileShortOption( String subDir )
75 throws Exception
76 {
77 runCoreExtensionWithOption( "-f", subDir );
78 }
79
80 private void runCoreExtensionWithOption( String option, String subDir )
81 throws Exception
82 {
83 File resourceDir =
84 ResourceExtractor.simpleExtractResources( getClass(), "/mng-6256-special-chars-alternate-pom-location" );
85
86 File testDir = new File( resourceDir, "../mng-6256-" + subDir );
87 testDir.mkdir();
88
89 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
90 verifier.getCliOptions().add( option );
91 verifier.getCliOptions().add( "\"" + new File( resourceDir, subDir ).getAbsolutePath() + "\"" );
92 verifier.executeGoal( "validate" );
93 verifier.verifyErrorFreeLog();
94 verifier.resetStreams();
95 }
96 }