14
14
*/
15
15
public class IntegrationTest {
16
16
17
- protected String execute (String root , String ... args ) throws IOException , InterruptedException , MavenInvocationException {
17
+ protected String execute (String root , boolean offline , String ... args ) throws IOException , InterruptedException , MavenInvocationException {
18
18
InvocationRequest request = new DefaultInvocationRequest ();
19
19
request .setPomFile ( new File ( root + "/pom.xml" ) );
20
20
request .setGoals (Arrays .asList (args ));
21
+ request .setOffline (offline );
21
22
Invoker invoker = new DefaultInvoker ();
22
23
invoker .setWorkingDirectory (new File (root ));
23
24
25
+
24
26
ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
25
27
ByteArrayOutputStream errorStream = new ByteArrayOutputStream ();
26
28
invoker .setErrorHandler (new PrintStreamHandler (new PrintStream (outputStream ), true ));
@@ -31,25 +33,15 @@ protected String execute(String root, String... args) throws IOException, Interr
31
33
return output ;
32
34
}
33
35
34
- private String getContent (BufferedReader reader ) throws IOException {
35
- String line ;
36
- String content = "" ;
37
- while ((line = reader .readLine ()) != null ) {
38
- System .out .println ("[IntegrationTest > Stderr] " + line );
39
- content += line ;
40
- }
41
- return content ;
42
- }
43
-
44
36
@ Test
45
37
public void shouldCompileProjectWithSingleLessFile () throws IOException , InterruptedException , MavenInvocationException {
46
38
47
39
String root = "target/test-project" ;
48
40
49
- String output = execute (root , "clean" );
41
+ String output = execute (root , true , "clean" );
50
42
the (output ).shouldContain ("BUILD SUCCESS" );
51
43
52
- output = execute (root , "install" , "-o " );
44
+ output = execute (root , true , "install " );
53
45
the (output ).shouldContain ("BUILD SUCCESS" );
54
46
55
47
File f = new File (root + "/target/web/bootstrap.css" );
@@ -59,9 +51,9 @@ public void shouldCompileProjectWithSingleLessFile() throws IOException, Interru
59
51
@ Test
60
52
public void shouldCompileProjectWithMultipleLessFile () throws IOException , InterruptedException , MavenInvocationException {
61
53
String root = "target/test-project-list" ;
62
- String output = execute (root , "clean" );
54
+ String output = execute (root , true , "clean" );
63
55
the (output ).shouldContain ("BUILD SUCCESS" );
64
- output = execute (root , "install" , "-o " );
56
+ output = execute (root , true , "install " );
65
57
the (output ).shouldContain ("BUILD SUCCESS" );
66
58
67
59
File f = new File (root + "/target/web1/bootstrap.css" );
0 commit comments