mboapache commented on code in PR #85:
URL: https://github.com/apache/db-jdo/pull/85#discussion_r1387168344


##########
exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java:
##########
@@ -140,37 +141,178 @@ private String getTrimmedPropertyValue(Properties props, 
String key) {
     return value == null ? "" : value.trim();
   }
 
+  private static String fileToString(String fileName) {
+    try {
+      byte[] encoded = Files.readAllBytes(Paths.get(fileName));
+      return new String(encoded);
+    } catch (IOException ex) {
+      return "Problems reading " + fileName + ": " + ex.getMessage();
+    }
+  }
+
+  /** */
   @Override
-  public void execute() throws MojoExecutionException, MojoFailureException {
+  public void execute() throws MojoExecutionException {
     if (!doRunTCK) {
       System.out.println("Skipping RunTCK goal!");
       return;
     }
 
-    Properties props = null;
     boolean alreadyran = false;
-    String runonce = "false";
-    List<String> propsString = new ArrayList<>();
-    List<String> command;
+    boolean runonce = false;
     String cpString = null;
-    InvocationResult result;
-    File fromFile = null;
-    File toFile = null;
 
+    List<String> propsString = initTCKRun();
+    String excludeFile = confDirectory + File.separator + exclude;
+    propsString.add(
+        "-Djdo.tck.exclude="
+            + 
getTrimmedPropertyValue(PropertyUtils.getProperties(excludeFile), 
"jdo.tck.exclude"));
+
+    // Create configuration log directory
+    String thisLogDir = logsDirectory + File.separator + Utilities.now();
+    String cfgDirName = thisLogDir + File.separator + "configuration";
+    File cfgDir = new File(cfgDirName);
+    if (!(cfgDir.exists()) && !(cfgDir.mkdirs())) {
+      throw new MojoExecutionException("Failed to create directory " + 
cfgDirName);
+    }
+    propsString.add("-Djdo.tck.log.directory=" + thisLogDir);
+
+    copyConfigurationFiles();
+
+    // Get ClassLoader URLs to build classpath below
+    List<URL> urlList =
+        new ArrayList<>(
+            Arrays.asList(
+                ((URLClassLoader) 
Thread.currentThread().getContextClassLoader()).getURLs()));
+
+    // Get contents of pmf properties file to build new file below
+    String pmfPropsReadFileName = confDirectory + File.separator + 
pmfProperties;
+    String defaultPropsContents = "";
+    try {
+      defaultPropsContents = Utilities.readFile(pmfPropsReadFileName);
+    } catch (IOException ex) {
+      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);
+      alreadyran = false;

Review Comment:
   I renamed it to alreadyRan



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jdo-dev-unsubscr...@db.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to