This is an automated email from the ASF dual-hosted git repository.
lta pushed a commit to branch Sync-Reconstruct
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/Sync-Reconstruct by this push:
new 3eee567 fix sync unit test bug
3eee567 is described below
commit 3eee567ed23f57d5687cf80aff3cb202fe7eff69
Author: lta <[email protected]>
AuthorDate: Mon Mar 18 13:38:16 2019 +0800
fix sync unit test bug
---
.../iotdb/db/sync/sender/FileManagerTest.java | 39 +++++++++++-----------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git
a/iotdb/src/test/java/org/apache/iotdb/db/sync/sender/FileManagerTest.java
b/iotdb/src/test/java/org/apache/iotdb/db/sync/sender/FileManagerTest.java
index 6e83e03..e8eedbd 100644
--- a/iotdb/src/test/java/org/apache/iotdb/db/sync/sender/FileManagerTest.java
+++ b/iotdb/src/test/java/org/apache/iotdb/db/sync/sender/FileManagerTest.java
@@ -38,11 +38,11 @@ import org.slf4j.LoggerFactory;
*/
public class FileManagerTest {
- public static final String POST_BACK_DIRECTORY_TEST = Constans.SYNC_CLIENT +
File.separator;
- public static final String LAST_FILE_INFO_TEST =
+ private static final String POST_BACK_DIRECTORY_TEST = Constans.SYNC_CLIENT
+ File.separator;
+ private static final String LAST_FILE_INFO_TEST =
POST_BACK_DIRECTORY_TEST + Constans.LAST_LOCAL_FILE_NAME;
- public static final String SENDER_FILE_PATH_TEST = POST_BACK_DIRECTORY_TEST
+ "data";
- FileManager manager = FileManager.getInstance();
+ private static final String SENDER_FILE_PATH_TEST = POST_BACK_DIRECTORY_TEST
+ "data";
+ private FileManager manager = FileManager.getInstance();
private static final Logger LOGGER =
LoggerFactory.getLogger(FileManagerTest.class);
@Before
@@ -53,12 +53,13 @@ public class FileManagerTest {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
file = new File(SENDER_FILE_PATH_TEST);
if (!file.exists()) {
file.mkdirs();
}
+ manager.setCurrentLocalFiles(new HashMap<>());
}
@After
@@ -94,12 +95,12 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}
@@ -130,12 +131,12 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}
@@ -186,12 +187,12 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}
@@ -231,12 +232,12 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}
@@ -292,13 +293,13 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
- newFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
+ newFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}
@@ -346,13 +347,13 @@ public class FileManagerTest {
String fileName =
SENDER_FILE_PATH_TEST + File.separator + i + File.separator + rand;
File file = new File(fileName);
- allFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
- newFileList.get(String.valueOf(i)).add(file.getAbsolutePath());
+ allFileList.get(String.valueOf(i)).add(file.getPath());
+ newFileList.get(String.valueOf(i)).add(file.getPath());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
if (!file.exists() && !file.createNewFile()) {
- LOGGER.error("Can not create new file {}", file.getAbsolutePath());
+ LOGGER.error("Can not create new file {}", file.getPath());
}
}
}