| 1 |
log = new File( basedir, 'build.log' ) |
| 2 |
assert log.exists() |
| 3 |
|
| 4 |
// Ensure that we can run this test on a windows box. |
| 5 |
sep = File.separator == '\\' ? '\\\\' : File.separator |
| 6 |
|
| 7 |
List<String> logFileLines = log.readLines(); |
| 8 |
println ' ==> Got [' + logFileLines.size() + '] lines in the LogFile' |
| 9 |
|
| 10 |
// 1) The non-existent source roots *should not* be added to the compileSourceRoot list: |
| 11 |
// |
| 12 |
// [DEBUG] Not adding non-existent or already added aspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/nonexistentCompileDirectory] to compileSourceRoots. |
| 13 |
// [DEBUG] Not adding non-existent or already added aspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/trivialaspects] to compileSourceRoots. |
| 14 |
// [DEBUG] Not adding non-existent or already added aspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/aspect] to compileSourceRoots. |
| 15 |
// |
| 16 |
nonexistentAspectSourcePathDirLine = logFileLines.findAll { |
| 17 |
line -> line.contains( 'Not adding non-existent or already added aspectSourcePathDir' ) |
| 18 |
} |
| 19 |
|
| 20 |
println 'Got nonexistentAspectSourcePathDirLine: ' + nonexistentAspectSourcePathDirLine |
| 21 |
|
| 22 |
assert nonexistentAspectSourcePathDirLine.size() == 3 |
| 23 |
assert nonexistentAspectSourcePathDirLine.get(0).contains( 'src/main/nonexistentCompileDirectory]'.replaceAll('/', sep) ) |
| 24 |
assert nonexistentAspectSourcePathDirLine.get(1).contains( 'src/main/trivialaspects]'.replaceAll('/', sep) ) |
| 25 |
assert nonexistentAspectSourcePathDirLine.get(2).contains( 'src/main/aspect]'.replaceAll('/', sep) ) |
| 26 |
|
| 27 |
// 2) The three non-existent test source roots *should not* be added to the testCompileSourceRoot list: |
| 28 |
// |
| 29 |
// [DEBUG] Not adding non-existent or already added testAspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/aspect] to testCompileSourceRoots. |
| 30 |
// [DEBUG] Not adding non-existent or already added testAspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/aspect] to testCompileSourceRoots. |
| 31 |
// [DEBUG] Not adding non-existent or already added testAspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/nonexistentTestCompileDirectory] to testCompileSourceRoots. |
| 32 |
// |
| 33 |
nonexistentTestAspectSourcePathDirLine = logFileLines.findAll { |
| 34 |
line -> line.contains( 'Not adding non-existent or already added testAspectSourcePathDir' ) |
| 35 |
} |
| 36 |
|
| 37 |
println 'Got nonexistentTestAspectSourcePathDirLine: ' + nonexistentTestAspectSourcePathDirLine |
| 38 |
|
| 39 |
assert nonexistentTestAspectSourcePathDirLine.size() == 3 |
| 40 |
assert nonexistentTestAspectSourcePathDirLine.get(0).contains( 'src/test/aspect]'.replaceAll('/', sep) ) |
| 41 |
assert nonexistentTestAspectSourcePathDirLine.get(1).contains( 'src/test/aspect]'.replaceAll('/', sep) ) |
| 42 |
assert nonexistentTestAspectSourcePathDirLine.get(2).contains( 'src/test/nonexistentTestCompileDirectory]'.replaceAll('/', sep) ) |
| 43 |
|
| 44 |
// 3) The properly existing source root *should* be added to the compileSourceRoot list: |
| 45 |
// |
| 46 |
// [DEBUG] Adding existing aspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/trivialaspects] to compileSourceRoots. |
| 47 |
// |
| 48 |
existingAspectSourcePathDir = logFileLines.findAll { |
| 49 |
line -> line.contains( 'Adding existing aspectSourcePathDir' ) |
| 50 |
} |
| 51 |
|
| 52 |
println 'Got existingAspectSourcePathDir: ' + existingAspectSourcePathDir |
| 53 |
|
| 54 |
assert existingAspectSourcePathDir.size() == 1 |
| 55 |
assert existingAspectSourcePathDir.get(0).contains( 'src/main/trivialaspects]'.replaceAll('/', sep) ) |
| 56 |
|
| 57 |
// 4) The properly existing test source root *should* be added to the testCompileSourceRoot list: |
| 58 |
// |
| 59 |
// [DEBUG] Adding existing testAspectSourcePathDir [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/trivialtestaspects] to testCompileSourceRoots. |
| 60 |
// |
| 61 |
existingTestAspectSourcePathDir = logFileLines.findAll { |
| 62 |
line -> line.contains( 'Adding existing testAspectSourcePathDir' ) |
| 63 |
} |
| 64 |
|
| 65 |
println 'Got existingTestAspectSourcePathDir: ' + existingTestAspectSourcePathDir |
| 66 |
|
| 67 |
assert existingTestAspectSourcePathDir.size() == 1 |
| 68 |
assert existingTestAspectSourcePathDir.get(0).contains( 'src/test/trivialtestaspects]'.replaceAll('/', sep) ) |
| 69 |
|
| 70 |
// 5) Finally, ensure that the compileSourceRoots and testCompileSourceRoots do not contain |
| 71 |
// any non-existent directories |
| 72 |
/* |
| 73 |
[echo] [compileSourceRoots] [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/java, /Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/main/trivialaspects] |
| 74 |
[echo] [testCompileSourceRoots] [/Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/java, /Users/lj/Development/Research/AspectJ/aspectj-maven-plugin/target/it/MASPECTJ-110/src/test/trivialtestaspects] |
| 75 |
*/ |
| 76 |
|
| 77 |
resultingCompileSourceRoots = logFileLines.find { |
| 78 |
line -> line.contains( '[echo] [compileSourceRoots]' ) |
| 79 |
} |
| 80 |
println "Got resultingCompileSourceRoots: " + resultingCompileSourceRoots |
| 81 |
assert resultingCompileSourceRoots.contains( 'src/main/java'.replaceAll('/', sep) ) |
| 82 |
assert resultingCompileSourceRoots.contains( 'src/main/trivialaspects'.replaceAll('/', sep) ) |
| 83 |
|
| 84 |
resultingTestCompileSourceRoots = logFileLines.find { |
| 85 |
line -> line.contains( '[echo] [testCompileSourceRoots]' ) |
| 86 |
} |
| 87 |
|
| 88 |
println "Got resultingTestCompileSourceRoots: " + resultingTestCompileSourceRoots |
| 89 |
assert resultingTestCompileSourceRoots.contains( 'src/test/java'.replaceAll('/', sep) ) |
| 90 |
assert resultingTestCompileSourceRoots.contains( 'src/test/trivialtestaspects'.replaceAll('/', sep) ) |