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.Collections;
26 import java.util.Iterator;
27 import java.util.List;
28
29
30
31
32
33
34 public class MavenITmng3183LoggingToFileTest
35 extends AbstractMavenIntegrationTestCase
36 {
37
38 public MavenITmng3183LoggingToFileTest()
39 {
40 super( "[3.0-alpha-1,)" );
41 }
42
43
44
45
46
47
48 public void testit()
49 throws Exception
50 {
51 File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3183" );
52
53 Verifier verifier = newVerifier( testDir.getAbsolutePath() );
54 verifier.setAutoclean( false );
55 verifier.addCliOption( "-l" );
56 verifier.addCliOption( "maven.log" );
57 verifier.setLogFileName( "stdout.txt" );
58 new File( testDir, "stdout.txt" ).delete();
59 new File( testDir, "maven.log" ).delete();
60 verifier.executeGoal( "validate" );
61 verifier.verifyErrorFreeLog();
62 verifier.resetStreams();
63
64 List<String> stdout = verifier.loadLines( "stdout.txt", "UTF-8" );
65
66 for ( Iterator<String> it = stdout.iterator(); it.hasNext(); )
67 {
68 String line = it.next();
69 if ( line.startsWith( "+" ) || line.startsWith( "EMMA" ) )
70 {
71 it.remove();
72 }
73 }
74
75 assertEquals( Collections.EMPTY_LIST, stdout );
76
77 List<String> log = verifier.loadLines( "maven.log", "UTF-8" );
78
79 assertFalse( log.isEmpty() );
80 }
81
82 }