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 import org.apache.maven.shared.utils.io.FileUtils;
26
27 public class MavenITmng6127PluginExecutionConfigurationInterferenceTest
28 extends AbstractMavenIntegrationTestCase
29 {
30
31 public MavenITmng6127PluginExecutionConfigurationInterferenceTest()
32 {
33 super( "[3.5.1,)" );
34 }
35
36 public void testCustomMojoExecutionConfigurator()
37 throws Exception
38 {
39 File testDir =
40 ResourceExtractor.simpleExtractResources( getClass(),
41 "/mng-6127-plugin-execution-configuration-interference" );
42 File pluginDir = new File( testDir, "plugin" );
43 File projectDir = new File( testDir, "project" );
44 File modAprojectDir = new File( projectDir, "mod-a" );
45 File modBprojectDir = new File( projectDir, "mod-b" );
46 File modCprojectDir = new File( projectDir, "mod-c" );
47
48 Verifier verifier;
49
50
51 verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" );
52 verifier.executeGoal( "install" );
53 verifier.resetStreams();
54 verifier.verifyErrorFreeLog();
55
56 File modAconfigurationFile = new File( modAprojectDir, "configuration.txt" );
57 File modBconfigurationFile = new File( modBprojectDir, "configuration.txt" );
58 File modCconfigurationFile = new File( modCprojectDir, "configuration.txt" );
59 modAconfigurationFile.delete();
60 modBconfigurationFile.delete();
61 modCconfigurationFile.delete();
62
63
64 verifier = newVerifier( projectDir.getAbsolutePath(), "remote" );
65 verifier.executeGoal( "verify" );
66 verifier.resetStreams();
67 verifier.verifyErrorFreeLog();
68
69 verifier.assertFilePresent( modAconfigurationFile.getCanonicalPath() );
70 String modAactual = FileUtils.fileRead( modAconfigurationFile );
71 assertEquals( "name=mod-a, secondName=second from components.xml", modAactual );
72
73 verifier.assertFilePresent( modBconfigurationFile.getCanonicalPath() );
74 String modBactual = FileUtils.fileRead( modBconfigurationFile );
75 assertEquals( "name=mod-b, secondName=second from components.xml", modBactual );
76
77 verifier.assertFilePresent( modCconfigurationFile.getCanonicalPath() );
78 String modCactual = FileUtils.fileRead( modCconfigurationFile );
79 assertEquals( "secondName=second from components.xml", modCactual );
80 }
81 }