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 public class MavenITmng5530MojoExecutionScopeTest
27 extends AbstractMavenIntegrationTestCase
28 {
29 public MavenITmng5530MojoExecutionScopeTest()
30 {
31 super( "[3.2.1,)" );
32 }
33
34 public void test_copyfiles()
35 throws Exception
36 {
37 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" );
38 File pluginDir = new File( testDir, "plugin" );
39 File projectDir = new File( testDir, "basic" );
40
41 Verifier verifier;
42
43
44 verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
45 verifier.executeGoal( "install" );
46 verifier.resetStreams();
47 verifier.verifyErrorFreeLog();
48
49
50 verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
51 verifier.executeGoal( "package" );
52 verifier.resetStreams();
53 verifier.verifyErrorFreeLog();
54
55
56 verifier.assertFilePresent( "target/execution-success.txt" );
57 verifier.assertFilePresent( "target/execution-before.txt" );
58 }
59
60 public void test_copyfiles_multithreaded()
61 throws Exception
62 {
63 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" );
64 File pluginDir = new File( testDir, "plugin" );
65 File projectDir = new File( testDir, "basic" );
66
67 Verifier verifier;
68
69
70 verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
71 verifier.executeGoal( "install" );
72 verifier.resetStreams();
73 verifier.verifyErrorFreeLog();
74
75
76 verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
77 verifier.getCliOptions().add( "--builder multithreaded -T 1" );
78 verifier.executeGoal( "package" );
79 verifier.resetStreams();
80 verifier.verifyErrorFreeLog();
81
82
83 verifier.assertFilePresent( "target/execution-success.txt" );
84 verifier.assertFilePresent( "target/execution-before.txt" );
85 }
86
87 public void testExtension()
88 throws Exception
89 {
90 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5530-mojo-execution-scope" );
91 File extensionDir = new File( testDir, "extension" );
92 File pluginDir = new File( testDir, "extension-plugin" );
93 File projectDir = new File( testDir, "extension-project" );
94
95 Verifier verifier;
96
97
98 verifier = newVerifier( extensionDir.getAbsolutePath(), "remote" );
99 verifier.executeGoal( "install" );
100 verifier.resetStreams();
101 verifier.verifyErrorFreeLog();
102
103
104 verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
105 verifier.executeGoal( "install" );
106 verifier.resetStreams();
107 verifier.verifyErrorFreeLog();
108
109
110 verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
111 verifier.addCliOption( "-Dmaven.ext.class.path=" + new File( extensionDir, "target/classes" ).getAbsolutePath() );
112 verifier.setForkJvm( true );
113 verifier.executeGoal( "package" );
114 verifier.resetStreams();
115 verifier.verifyErrorFreeLog();
116 }
117
118 }