Skip to content

Commit ff15b65

Browse files
authored
Merge pull request #1968 from venmanyarun/exp_variable_test
adding tests for expansion variable for server.env
2 parents 7f5e108 + b3bde4d commit ff15b65

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

liberty-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
<dependency>
9090
<groupId>io.openliberty.tools</groupId>
9191
<artifactId>ci.common</artifactId>
92-
<version>1.8.40</version>
92+
<version>1.8.41-SNAPSHOT</version>
9393
</dependency>
9494
<dependency>
9595
<groupId>org.apache.commons</groupId>

liberty-maven-plugin/src/it/toolchain-java-warning-server-env-custom-file-it/src/test/java/net/wasdev/wlp/maven/test/app/ToolchainTest.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,12 @@
33

44
import java.io.File;
55
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;
136

147
import java.util.Scanner;
158

169
import org.junit.Test;
1710

1811
import org.junit.Assert;
19-
import org.w3c.dom.Document;
20-
import org.w3c.dom.NodeList;
2112

2213
/**
2314
*
@@ -57,6 +48,21 @@ public void testToolchainLogExists() throws Exception {
5748
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")));
5849
}
5950

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+
6066
private boolean logContainsMessage( File logFile, String message) throws FileNotFoundException {
6167

6268
Assert.assertTrue("Log file not found at location: "+ LOG_LOCATION, logFile.exists());
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
JAVA_HOME=<REPLACE_JDK_PATH>
1+
JAVA_HOME=<REPLACE_JDK_PATH>
2+
3+
EXP_VAR=TEST
4+
EXP_VAR2=UNIX
5+
EXP_VAR3=WINDOWS
6+
TEST_EXP_VAR_UNIX=${EXP_VAR}_${EXP_VAR2}
7+
TEST_EXP_VAR_WIN=!EXP_VAR!_!EXP_VAR3!

0 commit comments

Comments
 (0)