diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index a584e858..021ec12c 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -17,6 +17,8 @@
${project.build.directory}/integration-test-base-dir
${testBaseDir}/test-resources
+ 1.7.36
+ 2.22.1
@@ -51,6 +53,24 @@
org.semver4j
semver4j
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.24.1
+ test
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.24.1
+ test
+
+
+ org.apache.logging.log4j
+ log4j-slf4j2-impl
+ 2.24.1
+ test
+
org.projectlombok
diff --git a/integration-tests/src/test/java/org/openmrs/maven/plugins/AbstractSdkIT.java b/integration-tests/src/test/java/org/openmrs/maven/plugins/AbstractSdkIT.java
index 02ab76f9..8416f356 100644
--- a/integration-tests/src/test/java/org/openmrs/maven/plugins/AbstractSdkIT.java
+++ b/integration-tests/src/test/java/org/openmrs/maven/plugins/AbstractSdkIT.java
@@ -18,6 +18,8 @@
import org.openmrs.maven.plugins.model.DistroProperties;
import org.openmrs.maven.plugins.model.Server;
import org.openmrs.maven.plugins.utility.SDKConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
@@ -45,10 +47,11 @@
import static org.openmrs.maven.plugins.SdkMatchers.hasPlatformVersion;
import static org.openmrs.maven.plugins.SdkMatchers.hasWarVersion;
-
@RunWith(BlockJUnit4ClassRunner.class)
public abstract class AbstractSdkIT {
+ public final Logger log = LoggerFactory.getLogger(getClass());
+
/**
* contains name of directory in project's target dir, where integration tests are conducted
*/
@@ -74,6 +77,7 @@ public abstract class AbstractSdkIT {
Path testBaseDir;
Path testResourceDir;
+ boolean preserveTestOutput;
public String resolveSdkArtifact() throws MojoExecutionException {
Properties sdk = new Properties();
@@ -116,6 +120,7 @@ public void setup() throws Exception {
testResourceDir = testBaseDir.resolve("test-resources");
testDirectoryPath = testBaseDir.resolve(getClass().getSimpleName() + "_" + nextCounter());
testDirectory = testDirectoryPath.toFile();
+ preserveTestOutput = Boolean.parseBoolean(System.getProperty("preserveTestOutput"));
if (!testDirectory.mkdirs()) {
throw new RuntimeException("Unable to create test directory: " + testDirectory);
}
@@ -128,7 +133,13 @@ public void setup() throws Exception {
@After
public void teardown() {
- FileUtils.deleteQuietly(testDirectory);
+ verifier.resetStreams();
+ if (preserveTestOutput) {
+ log.debug("Test output preserved: " + testDirectory.getName());
+ }
+ else {
+ FileUtils.deleteQuietly(testDirectory);
+ }
cleanAnswers();
}
@@ -139,22 +150,26 @@ static synchronized int nextCounter() {
public String setupTestServer() throws Exception{
Verifier setupServer = new Verifier(testDirectory.getAbsolutePath());
String serverId = UUID.randomUUID().toString();
-
- addTaskParam(setupServer, "openMRSPath", testDirectory.getAbsolutePath());
- addTaskParam(setupServer, "distro", "referenceapplication:2.2");
- addTaskParam(setupServer, "debug", "1044");
- addMockDbSettings(setupServer);
-
- addAnswer(serverId);
- addAnswer(System.getProperty("java.home"));
- addAnswer("8080");
- addTaskParam(setupServer, BATCH_ANSWERS, getAnswers());
- cleanAnswers();
-
- String sdk = resolveSdkArtifact();
- setupServer.executeGoal(sdk + ":setup");
- assertFilePresent(serverId, "openmrs-server.properties");
- new File(testDirectory, "log.txt").delete();
+ try {
+ addTaskParam(setupServer, "openMRSPath", testDirectory.getAbsolutePath());
+ addTaskParam(setupServer, "distro", "referenceapplication:2.2");
+ addTaskParam(setupServer, "debug", "1044");
+ addMockDbSettings(setupServer);
+
+ addAnswer(serverId);
+ addAnswer(System.getProperty("java.home"));
+ addAnswer("8080");
+ addTaskParam(setupServer, BATCH_ANSWERS, getAnswers());
+ cleanAnswers();
+
+ String sdk = resolveSdkArtifact();
+ setupServer.executeGoal(sdk + ":setup");
+ assertFilePresent(serverId, "openmrs-server.properties");
+ new File(testDirectory, "log.txt").delete();
+ }
+ finally {
+ verifier.resetStreams();
+ }
return serverId;
}
diff --git a/integration-tests/src/test/resources/integration-test/invokeIT/pom.xml b/integration-tests/src/test/resources/integration-test/invokeIT/pom.xml
index b7c8f37f..c054fd3a 100644
--- a/integration-tests/src/test/resources/integration-test/invokeIT/pom.xml
+++ b/integration-tests/src/test/resources/integration-test/invokeIT/pom.xml
@@ -62,6 +62,24 @@
3.9.0
compile
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.24.1
+ compile
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.24.1
+ compile
+
+
+ org.apache.logging.log4j
+ log4j-slf4j2-impl
+ 2.24.1
+ compile
+
diff --git a/integration-tests/src/test/resources/log4j2.xml b/integration-tests/src/test/resources/log4j2.xml
new file mode 100644
index 00000000..d40c60cb
--- /dev/null
+++ b/integration-tests/src/test/resources/log4j2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 11a26b41..720acbc0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -373,7 +373,7 @@
commons-io
commons-io
- 2.7
+ 2.17.0