You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by ti...@apache.org on 2021/01/07 20:12:38 UTC
[db-jdo] branch master updated: Fix failing `mvn clean install` failing due to `datanucleaus.txt` and… (#14)
This is an automated email from the ASF dual-hosted git repository.
tilmannz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/db-jdo.git
The following commit(s) were added to refs/heads/master by this push:
new 30ce77a Fix failing `mvn clean install` failing due to `datanucleaus.txt` and… (#14)
30ce77a is described below
commit 30ce77a1cc37c833ac3d5afcefb59a5060551133
Author: Tilmann <ti...@apache.org>
AuthorDate: Thu Jan 7 21:12:29 2021 +0100
Fix failing `mvn clean install` failing due to `datanucleaus.txt` and… (#14)
---
.../java/org/apache/jdo/exectck/AbstractTCKMojo.java | 11 +++++++++++
.../src/main/java/org/apache/jdo/exectck/Enhance.java | 9 ++++++++-
exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java | 16 ++++++++++------
pom.xml | 1 +
tck/pom.xml | 1 +
5 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/exectck/src/main/java/org/apache/jdo/exectck/AbstractTCKMojo.java b/exectck/src/main/java/org/apache/jdo/exectck/AbstractTCKMojo.java
index e1ea1d9..bd266f0 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/AbstractTCKMojo.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/AbstractTCKMojo.java
@@ -18,6 +18,7 @@ package org.apache.jdo.exectck;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.nio.charset.Charset;
import java.util.Collection;
import java.util.HashSet;
import java.util.Properties;
@@ -139,4 +140,14 @@ public abstract class AbstractTCKMojo extends AbstractMojo {
File.separator + LOG4J2_CONFIGURATION);
FileUtils.copyFile(fromFile, toFile);
}
+
+ protected void resetFileContent(String fileName) throws MojoExecutionException {
+ File file = new File(fileName);
+ // reset file content
+ try {
+ FileUtils.write(file, "", Charset.defaultCharset());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Failed to reset file content: " + file.toURI());
+ }
+ }
}
diff --git a/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java b/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java
index 0c08469..2f4e726 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java
@@ -18,6 +18,7 @@
package org.apache.jdo.exectck;
import java.net.MalformedURLException;
+import java.nio.charset.Charset;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.io.FileUtils;
@@ -79,6 +80,9 @@ public class Enhance extends AbstractTCKMojo {
idtypes = new HashSet<String>();
PropertyUtils.string2Set(identitytypes, idtypes);
+ // Reset logfile content (may not be empty if previous run crashed)
+ resetFileContent(implLogFile);
+
// Create directory for enhancer logs
String enhanceLogsDirName = logsDirectory + File.separator + "enhanced";
File enhancerLogsDir = new File(enhanceLogsDirName);
@@ -242,7 +246,10 @@ public class Enhance extends AbstractTCKMojo {
try {
File logFile = new File(implLogFile);
File testLogFile = new File(testLogFilename);
- FileUtils.moveFile(logFile, testLogFile);
+ FileUtils.copyFile(logFile, testLogFile);
+ // reset file content
+ FileUtils.write(logFile, "", Charset.defaultCharset());
+ FileUtils.forceDeleteOnExit(logFile);
} catch (Exception e) {
System.out.println(">> Error moving implementation log file: " +
e.getMessage());
diff --git a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
index fff1cfc..cb1cee7 100644
--- a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
+++ b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
@@ -15,13 +15,11 @@
*/
package org.apache.jdo.exectck;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
+import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
@@ -268,6 +266,10 @@ public class RunTCK extends AbstractTCKMojo {
Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
}
+ // Reset logfile content (may not be empty if previous run crashed)
+ resetFileContent(implLogFile);
+ resetFileContent(TCK_LOG_FILE);
+
int failureCount = 0;
for (String db : dbs) {
System.setProperty("jdo.tck.database", db);
@@ -436,6 +438,7 @@ public class RunTCK extends AbstractTCKMojo {
try {
File logFile = new File(implLogFile);
FileUtils.copyFile(logFile, new File(testLogFilename));
+ resetFileContent(implLogFile);
} catch (Exception e) {
System.out.println(">> Error copying implementation log file: "
+ e.getMessage());
@@ -444,6 +447,7 @@ public class RunTCK extends AbstractTCKMojo {
try {
File logFile = new File(TCK_LOG_FILE);
FileUtils.copyFile(logFile, new File(tckLogFilename));
+ resetFileContent(TCK_LOG_FILE);
} catch (Exception e) {
System.out.println(">> Error copying tck log file: "
+ e.getMessage());
@@ -467,12 +471,12 @@ public class RunTCK extends AbstractTCKMojo {
}
// Remove log file
try {
- FileUtils.forceDelete(new File(implLogFile));
+ FileUtils.forceDeleteOnExit(new File(implLogFile));
} catch (Exception e) {
System.out.println(">> Error deleting log file: " + e.getMessage());
}
try {
- FileUtils.forceDelete(new File(TCK_LOG_FILE));
+ FileUtils.forceDeleteOnExit(new File(TCK_LOG_FILE));
} catch (Exception e) {
System.out.println(">> Error deleting log file: " + e.getMessage());
}
diff --git a/pom.xml b/pom.xml
index a922cde..97c94d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -60,6 +60,7 @@
</includes>
</fileset>
</filesets>
+ <failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
diff --git a/tck/pom.xml b/tck/pom.xml
index 0aa1ace..4ed44c1 100644
--- a/tck/pom.xml
+++ b/tck/pom.xml
@@ -126,6 +126,7 @@
</includes>
</fileset>
</filesets>
+ <failOnError>false</failOnError>
</configuration>
</plugin>
</plugins>