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.List;
26
27
28
29
30
31
32 public class MavenITmng4936EventSpyTest
33 extends AbstractMavenIntegrationTestCase
34 {
35
36 public MavenITmng4936EventSpyTest()
37 {
38 super( "[3.0.2,)" );
39 }
40
41
42
43
44
45
46 public void testit()
47 throws Exception
48 {
49 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4936" );
50
51 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
52 verifier.setForkJvm( true );
53 verifier.setAutoclean( false );
54 verifier.deleteDirectory( "target" );
55 verifier.setSystemProperty( "maven.ext.class.path", "spy-0.1.jar" );
56 verifier.addCliOption( "-X" );
57 verifier.executeGoal( "validate" );
58 verifier.verifyErrorFreeLog();
59 verifier.resetStreams();
60
61 List<String> lines = verifier.loadLines( "target/spy.log", "UTF-8" );
62 assertTrue( lines.toString(), lines.get( 0 ).toString().startsWith( "init" ) );
63 assertTrue( lines.toString(), lines.get( lines.size() - 1 ).toString().startsWith( "close" ) );
64 assertTrue( lines.toString(),
65 lines.contains( "event: org.apache.maven.settings.building.DefaultSettingsBuildingRequest" ) );
66 assertTrue( lines.toString(),
67 lines.contains( "event: org.apache.maven.settings.building.DefaultSettingsBuildingResult" ) );
68 assertTrue( lines.toString(),
69 lines.contains( "event: org.apache.maven.execution.DefaultMavenExecutionRequest" ) );
70 assertTrue( lines.toString(),
71 lines.contains( "event: org.apache.maven.execution.DefaultMavenExecutionResult" ) );
72 assertTrue( lines.toString(),
73 lines.contains( "event: org.apache.maven.lifecycle.internal.DefaultExecutionEvent" ) );
74 }
75
76 }