[MINVOKER-260] confirm streamLogs by IT tests · apache/maven-invoker-plugin@bfecb96 (original) (raw)
``
1
`+
/*
`
``
2
`+
- Licensed to the Apache Software Foundation (ASF) under one
`
``
3
`+
- or more contributor license agreements. See the NOTICE file
`
``
4
`+
- distributed with this work for additional information
`
``
5
`+
- regarding copyright ownership. The ASF licenses this file
`
``
6
`+
- to you under the Apache License, Version 2.0 (the
`
``
7
`+
- "License"); you may not use this file except in compliance
`
``
8
`+
- with the License. You may obtain a copy of the License at
`
``
9
`+
*
`
``
10
`+
`
``
11
`+
*
`
``
12
`+
- Unless required by applicable law or agreed to in writing,
`
``
13
`+
- software distributed under the License is distributed on an
`
``
14
`+
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
`
``
15
`+
- KIND, either express or implied. See the License for the
`
``
16
`+
- specific language governing permissions and limitations
`
``
17
`+
- under the License.
`
``
18
`+
*/
`
``
19
+
``
20
`+
def FS = File.separator
`
``
21
+
``
22
`+
// make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else,
`
``
23
`+
// so check if touch.txt exist
`
``
24
+
``
25
`+
assert new File(basedir, 'target/its/beanshell/touch.txt').exists()
`
``
26
`+
assert new File(basedir, 'target/its/groovy/touch.txt').exists()
`
``
27
+
``
28
`+
// logs
`
``
29
`+
def buildLog = new File(basedir, 'build.log').text
`
``
30
`+
def beanshellLog = new File(basedir, 'target/its/beanshell/build.log').text
`
``
31
`+
def groovyLog = new File(basedir, 'target/its/groovy/build.log').text
`
``
32
+
``
33
`+
// beanshell failed and no log message
`
``
34
`+
assert !buildLog.contains('[INFO] Output form beanshell script')
`
``
35
`+
assert buildLog.contains('[INFO] org.apache.maven.shared.scriptinterpreter.ScriptEvaluationException: java.lang.OutOfMemoryError: Requested array size exceeds VM limit')
`
``
36
`+
assert buildLog.contains('[INFO] beanshell' + FS + 'pom.xml ................................ FAILED')
`
``
37
+
``
38
`+
assert beanshellLog.contains('Output form beanshell script')
`
``
39
`+
assert beanshellLog.contains('java.lang.OutOfMemoryError: Requested array size exceeds VM limit')
`
``
40
+
``
41
`+
// groovy failed and no log message
`
``
42
`+
assert !buildLog.contains('[INFO] Output from groovy script')
`
``
43
`+
assert !buildLog.contains('Assertion failed:')
`
``
44
`+
assert !buildLog.contains('assert pom.contains("9.9.9")')
`
``
45
`+
assert buildLog.contains('[INFO] org.apache.maven.shared.scriptinterpreter.ScriptEvaluationException: Assertion Error')
`
``
46
`+
assert buildLog.contains('[INFO] groovy' + FS + 'pom.xml ................................... FAILED')
`
``
47
+
``
48
`+
assert groovyLog.contains('Output from groovy script')
`
``
49
`+
assert groovyLog.contains('Assertion failed:')
`
``
50
`+
assert groovyLog.contains('assert pom.contains("9.9.9")')
`