You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2019/09/26 17:19:09 UTC

[incubator-iotdb] 09/12: IOTDB-242 fix mvn integration-test failed because the files in the target folder changes (server and client module)

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch rel/0.8
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 26157c4630df076caa73e6a0d7e25713fca76356
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Fri Sep 27 00:46:42 2019 +0800

    IOTDB-242 fix mvn integration-test failed because the files in the target folder changes (server and client module)
---
 .../org/apache/iotdb/cli/client/AbstractScript.java |  2 +-
 .../org/apache/iotdb/db/script/EnvScriptIT.java     | 21 ++++++++++-----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/client/src/test/java/org/apache/iotdb/cli/client/AbstractScript.java b/client/src/test/java/org/apache/iotdb/cli/client/AbstractScript.java
index 9474982..e9bb602 100644
--- a/client/src/test/java/org/apache/iotdb/cli/client/AbstractScript.java
+++ b/client/src/test/java/org/apache/iotdb/cli/client/AbstractScript.java
@@ -55,7 +55,7 @@ public abstract class AbstractScript {
     if(!userDir.exists()) {
       throw new RuntimeException("user.dir " + userDir.getAbsolutePath() + " doesn't exist.");
     }
-    File target = new File(userDir, "target/classes/META-INF/maven/org.apache.iotdb/iotdb-client/pom.properties");
+    File target = new File(userDir, "target/maven-archiver/pom.properties");
     Properties properties = new Properties();
     try {
       properties.load(new FileReader(target));
diff --git a/server/src/test/java/org/apache/iotdb/db/script/EnvScriptIT.java b/server/src/test/java/org/apache/iotdb/db/script/EnvScriptIT.java
index f08e167..9b9406e 100644
--- a/server/src/test/java/org/apache/iotdb/db/script/EnvScriptIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/script/EnvScriptIT.java
@@ -19,10 +19,12 @@
 package org.apache.iotdb.db.script;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -105,18 +107,15 @@ public class EnvScriptIT {
     if(!userDir.exists()) {
       throw new RuntimeException("user.dir " + userDir.getAbsolutePath() + " doesn't exist.");
     }
-    File targetDir = new File(userDir, "target");
-    File[] files = targetDir.listFiles(new FileFilter() {
-      @Override
-      public boolean accept(File pathname) {
-        return pathname.isDirectory() && pathname.getName().startsWith("iotdb-server-");
-      }
-    });
-    if(files.length != 1) {
-      throw new RuntimeException(
-              "Exactly one directory starting with 'iotdb-server-' should have been found, but was " + files.length);
+    File target = new File(userDir, "target/maven-archiver/iotdb-server/pom.properties");
+    Properties properties = new Properties();
+    assertTrue(target.exists());
+    try {
+      properties.load(new FileReader(target));
+    } catch (IOException e) {
+      return "target/iotdb-server-";
     }
-    return files[0].getAbsolutePath();
+    return new File(userDir, String.format("target/%s-%s", properties.getProperty("artifactId"), properties.getProperty("version"))).getAbsolutePath();
   }
 
 }