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.util.Properties;
26
27
28
29
30
31
32 public class MavenITmng4747JavaAgentUsedByPluginTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng4747JavaAgentUsedByPluginTest()
37 {
38 super( "[2.0.3,3.0-alpha-1),[3.0-beta-2,)" );
39 }
40
41
42
43
44
45
46
47 public void testit()
48 throws Exception
49 {
50 requiresJavaVersion( "[1.5,)" );
51
52 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4747" );
53
54 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
55 verifier.setAutoclean( false );
56 verifier.deleteDirectory( "target" );
57 verifier.setEnvironmentVariable( "MAVEN_OPTS", "-javaagent:agent.jar" );
58 verifier.executeGoal( "validate" );
59 verifier.verifyErrorFreeLog();
60 verifier.resetStreams();
61
62 Properties props1 = verifier.loadProperties( "target/agent.properties" );
63 Properties props2 = verifier.loadProperties( "target/plugin.properties" );
64 assertNotNull( props1.get( "Mng4747Agent" ) );
65 assertEquals( props1.get( "Mng4747Agent" ), props2.get( "Mng4747Agent" ) );
66 }
67
68 }