|
3 | 3 |
|
4 | 4 | import java.io.File; |
5 | 5 | import java.io.FileNotFoundException; |
6 | | -import java.io.FileInputStream; |
7 | | - |
8 | | -import javax.xml.parsers.DocumentBuilder; |
9 | | -import javax.xml.parsers.DocumentBuilderFactory; |
10 | | -import javax.xml.xpath.XPath; |
11 | | -import javax.xml.xpath.XPathConstants; |
12 | | -import javax.xml.xpath.XPathFactory; |
13 | 6 |
|
14 | 7 | import java.util.Scanner; |
15 | 8 |
|
16 | 9 | import org.junit.Test; |
17 | 10 |
|
18 | 11 | import org.junit.Assert; |
19 | | -import org.w3c.dom.Document; |
20 | | -import org.w3c.dom.NodeList; |
21 | 12 |
|
22 | 13 | /** |
23 | 14 | * |
@@ -57,6 +48,21 @@ public void testToolchainLogExists() throws Exception { |
57 | 48 | Assert.assertTrue("Did not find project properties contain java.home message for status goal in build.log", logContainsMessage(buildLog, String.format(TOOLCHAIN_NOT_HONORED_WARNING, "status"))); |
58 | 49 | } |
59 | 50 |
|
| 51 | + @Test |
| 52 | + public void verifyLogMessageForExpansionVariables() throws Exception { |
| 53 | + File buildLog = new File("../build.log"); |
| 54 | + Assert.assertTrue(buildLog.exists()); |
| 55 | + String os = System.getProperty("os.name"); |
| 56 | + if (os != null && os.toLowerCase().startsWith("windows")) { |
| 57 | + Assert.assertTrue("Did not find variable expansion message in build.log", logContainsMessage(buildLog, "Resolving Property EXP_VAR for expression !EXP_VAR!_!EXP_VAR3!. Resolved expression value is TEST")); |
| 58 | + Assert.assertTrue("Did not find second variable expansion message in build.log", logContainsMessage(buildLog, "Resolving Property EXP_VAR3 for expression !EXP_VAR!_!EXP_VAR3!. Resolved expression value is TEST_WINDOWS")); |
| 59 | + }else { |
| 60 | + Assert.assertTrue("Did not find variable expansion message in build.log", logContainsMessage(buildLog, "Resolving Property EXP_VAR for expression ${EXP_VAR}_${EXP_VAR2}. Resolved expression value is TEST")); |
| 61 | + Assert.assertTrue("Did not find second variable expansion message in build.log", logContainsMessage(buildLog, "Resolving Property EXP_VAR2 for expression ${EXP_VAR}_${EXP_VAR2}. Resolved expression value is TEST_UNIX")); |
| 62 | + } |
| 63 | + |
| 64 | + } |
| 65 | + |
60 | 66 | private boolean logContainsMessage( File logFile, String message) throws FileNotFoundException { |
61 | 67 |
|
62 | 68 | Assert.assertTrue("Log file not found at location: "+ LOG_LOCATION, logFile.exists()); |
|
0 commit comments