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

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


The following commit(s) were added to refs/heads/dev_TTL by this push:
     new f66ca85  fix tests
f66ca85 is described below

commit f66ca8500e107f15cd7d7e7304769a5c670e2c61
Author: jt <[email protected]>
AuthorDate: Mon Sep 23 15:04:59 2019 +0800

    fix tests
---
 .../org/apache/iotdb/jdbc/IoTDBConnection.java     |  42 ++++----
 .../org/apache/iotdb/jdbc/IoTDBSQLException.java   |   4 +-
 .../org/apache/iotdb/db/engine/StorageEngine.java  |   6 +-
 .../org/apache/iotdb/db/monitor/StatMonitor.java   |   3 +-
 .../iotdb/db/qp/executor/QueryProcessExecutor.java |   4 +-
 .../engine/modification/DeletionFileNodeTest.java  |  16 +--
 .../db/engine/modification/DeletionQueryTest.java  |  21 ++--
 .../storagegroup/FileNodeManagerBenchmark.java     |  16 +--
 .../iotdb/db/engine/storagegroup/TTLTest.java      |   8 +-
 .../org/apache/iotdb/db/metadata/MTreeTest.java    | 112 ++++++++++-----------
 10 files changed, 116 insertions(+), 116 deletions(-)

diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
index ff0aaeb..9c58e25 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
@@ -54,7 +54,7 @@ public class IoTDBConnection implements Connection {
   private static final Logger logger = 
LoggerFactory.getLogger(IoTDBConnection.class);
   private final TSProtocolVersion protocolVersion = 
TSProtocolVersion.IOTDB_SERVICE_PROTOCOL_V1;
   public TSIService.Iface client = null;
-  public TS_SessionHandle sessionHandle = null;
+  TS_SessionHandle sessionHandle = null;
   private IoTDBConnectionParams params;
   private boolean isClosed = true;
   private SQLWarning warningChain = null;
@@ -103,7 +103,7 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public void clearWarnings() throws SQLException {
+  public void clearWarnings() {
     warningChain = null;
   }
 
@@ -172,7 +172,7 @@ public class IoTDBConnection implements Connection {
               resultSetConcurrency));
     }
     if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) {
-      throw new SQLException(String.format("Statements with resultset type %d 
are not supported",
+      throw new SQLException(String.format("Statements with ResultSet type %d 
are not supported",
           resultSetType));
     }
     return new IoTDBStatement(this, client, sessionHandle, zoneId);
@@ -189,18 +189,18 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public boolean getAutoCommit() throws SQLException {
+  public boolean getAutoCommit() {
     return autoCommit;
   }
 
   @Override
-  public void setAutoCommit(boolean arg0) throws SQLException {
+  public void setAutoCommit(boolean arg0) {
     autoCommit = arg0;
   }
 
   @Override
-  public String getCatalog() throws SQLException {
-    return "no cata log";
+  public String getCatalog() {
+    return "no catalog";
   }
 
   @Override
@@ -224,7 +224,7 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public int getHoldability() throws SQLException {
+  public int getHoldability() {
     // throw new SQLException("Method not supported");
     return 0;
   }
@@ -243,7 +243,7 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public int getNetworkTimeout() throws SQLException {
+  public int getNetworkTimeout() {
     return Config.connectionTimeoutInMs;
   }
 
@@ -258,7 +258,7 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public int getTransactionIsolation() throws SQLException {
+  public int getTransactionIsolation() {
     return Connection.TRANSACTION_NONE;
   }
 
@@ -278,17 +278,17 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public SQLWarning getWarnings() throws SQLException {
+  public SQLWarning getWarnings() {
     return warningChain;
   }
 
   @Override
-  public boolean isClosed() throws SQLException {
+  public boolean isClosed() {
     return isClosed;
   }
 
   @Override
-  public boolean isReadOnly() throws SQLException {
+  public boolean isReadOnly() {
     return false;
   }
 
@@ -364,12 +364,12 @@ public class IoTDBConnection implements Connection {
   }
 
   @Override
-  public void rollback() throws SQLException {
+  public void rollback() {
     // do nothing in rollback
   }
 
   @Override
-  public void rollback(Savepoint arg0) throws SQLException {
+  public void rollback(Savepoint arg0) {
     // do nothing in rollback
   }
 
@@ -419,7 +419,7 @@ public class IoTDBConnection implements Connection {
       }
       if (protocolVersion.getValue() != 
openResp.getServerProtocolVersion().getValue()) {
         throw new TException(String
-            .format("Protocol not supported, Client version is {}, but Server 
version is {}",
+            .format("Protocol not supported, Client version is %d, but Server 
version is %d",
                 protocolVersion.getValue(), 
openResp.getServerProtocolVersion().getValue()));
       }
       setProtocol(openResp.getServerProtocolVersion());
@@ -438,7 +438,7 @@ public class IoTDBConnection implements Connection {
     isClosed = false;
   }
 
-  public boolean reconnect() {
+  boolean reconnect() {
     boolean flag = false;
     for (int i = 1; i <= Config.RETRY_NUM; i++) {
       try {
@@ -487,7 +487,7 @@ public class IoTDBConnection implements Connection {
     try {
       RpcUtils.verifySuccess(resp);
     } catch (IoTDBRPCException e) {
-      throw new IoTDBSQLException(e.getMessage(), resp.getStatus());
+      throw new IoTDBSQLException(e.getMessage(), resp);
     }
     this.zoneId = ZoneId.of(zoneId);
   }
@@ -496,11 +496,7 @@ public class IoTDBConnection implements Connection {
     return client.getProperties();
   }
 
-  public TSProtocolVersion getProtocol() {
-    return protocol;
-  }
-
-  public void setProtocol(TSProtocolVersion protocol) {
+  private void setProtocol(TSProtocolVersion protocol) {
     this.protocol = protocol;
   }
 
diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java 
b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
index ac857ef..84dbd17 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBSQLException.java
@@ -20,7 +20,7 @@
 package org.apache.iotdb.jdbc;
 
 import java.sql.SQLException;
-import org.apache.iotdb.service.rpc.thrift.TS_Status;
+import org.apache.iotdb.service.rpc.thrift.TSStatus;
 
 public class IoTDBSQLException extends SQLException {
 
@@ -30,7 +30,7 @@ public class IoTDBSQLException extends SQLException {
     super(reason);
   }
 
-  public IoTDBSQLException(String reason, TS_Status status) {
+  public IoTDBSQLException(String reason, TSStatus status) {
     super(reason, status.sqlState, status.statusType.code);
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java 
b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
index 1a5599a..5885c2b 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/StorageEngine.java
@@ -185,7 +185,7 @@ public class StorageEngine implements IService {
    * @param insertPlan physical plan of insertion
    * @return true if and only if this insertion succeeds
    */
-  public boolean insert(InsertPlan insertPlan) throws StorageEngineException {
+  public boolean insert(InsertPlan insertPlan) throws ProcessorException {
 
     StorageGroupProcessor storageGroupProcessor;
     try {
@@ -194,14 +194,14 @@ public class StorageEngine implements IService {
       logger.warn("get StorageGroupProcessor of device {} failed, because {}",
           insertPlan.getDeviceId(),
           e.getMessage(), e);
-      throw new StorageEngineException(e);
+      throw new ProcessorException(e);
     }
 
     // TODO monitor: update statistics
     try {
       return storageGroupProcessor.insert(insertPlan);
     } catch (QueryProcessorException e) {
-      throw new StorageEngineException(e.getMessage());
+      throw new ProcessorException(e);
     }
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java 
b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
index 951b655..368eb98 100644
--- a/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
+++ b/server/src/main/java/org/apache/iotdb/db/monitor/StatMonitor.java
@@ -31,6 +31,7 @@ import org.apache.iotdb.db.concurrent.ThreadName;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.engine.StorageEngine;
+import org.apache.iotdb.db.exception.ProcessorException;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.MetadataErrorException;
 import org.apache.iotdb.db.exception.StartupException;
@@ -388,7 +389,7 @@ public class StatMonitor implements IService {
           numInsert.incrementAndGet();
           pointNum = entry.getValue().dataPointList.size();
           numPointsInsert.addAndGet(pointNum);
-        } catch (StorageEngineException e) {
+        } catch (ProcessorException e) {
           numInsertError.incrementAndGet();
           logger.error("Inserting stat points error.", e);
         }
diff --git 
a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
 
b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
index 59aeb18..3568324 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/qp/executor/QueryProcessExecutor.java
@@ -246,8 +246,8 @@ public class QueryProcessExecutor extends 
AbstractQueryProcessExecutor {
       insertPlan.setDataTypes(dataTypes);
       return storageEngine.insert(insertPlan);
 
-    } catch (PathErrorException | StorageEngineException e) {
-      throw new ProcessorException(e.getMessage());
+    } catch (PathErrorException e) {
+      throw new ProcessorException(e);
     }
   }
 
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
index b759816..4ac8eb1 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
@@ -19,7 +19,6 @@
 
 package org.apache.iotdb.db.engine.modification;
 
-import static junit.framework.TestCase.assertTrue;
 import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_CONTEXT;
 import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_JOB_ID;
 import static org.junit.Assert.assertEquals;
@@ -29,21 +28,21 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
+import junit.framework.TestCase;
 import org.apache.iotdb.db.conf.directories.DirectoryManager;
 import org.apache.iotdb.db.engine.StorageEngine;
 import 
org.apache.iotdb.db.engine.modification.io.LocalTextModificationAccessor;
 import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.MetadataErrorException;
 import org.apache.iotdb.db.exception.PathErrorException;
 import org.apache.iotdb.db.exception.ProcessorException;
 import org.apache.iotdb.db.exception.StartupException;
+import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.metadata.MManager;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.query.control.QueryResourceManager;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
 import org.apache.iotdb.db.utils.TimeValuePair;
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
@@ -54,7 +53,6 @@ import org.apache.iotdb.tsfile.write.record.TSRecord;
 import org.apache.iotdb.tsfile.write.record.datapoint.DoubleDataPoint;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class DeletionFileNodeTest {
@@ -126,7 +124,8 @@ public class DeletionFileNodeTest {
   }
 
   @Test
-  public void testDeleteInBufferWriteFile() throws StorageEngineException, 
IOException {
+  public void testDeleteInBufferWriteFile()
+      throws StorageEngineException, IOException, ProcessorException {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, processorName);
       for (int j = 0; j < 10; j++) {
@@ -158,7 +157,7 @@ public class DeletionFileNodeTest {
       assertEquals(3, modifications.size());
       int i = 0;
       for (Modification modification : modifications) {
-        assertTrue(modification.equals(realModifications[i++]));
+        TestCase.assertEquals(modification, realModifications[i++]);
       }
     } finally {
       accessor.close();
@@ -210,7 +209,8 @@ public class DeletionFileNodeTest {
   }
 
   @Test
-  public void testDeleteInOverflowFile() throws StorageEngineException, 
IOException {
+  public void testDeleteInOverflowFile()
+      throws StorageEngineException, ProcessorException {
     // insert into BufferWrite
     for (int i = 101; i <= 200; i++) {
       TSRecord record = new TSRecord(i, processorName);
@@ -252,7 +252,7 @@ public class DeletionFileNodeTest {
     assertEquals( 3, modifications.size());
     int i = 0;
     for (Modification modification : modifications) {
-      assertTrue(modification.equals(realModifications[i++]));
+      TestCase.assertEquals(modification, realModifications[i++]);
     }
   }
 }
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
index 6cfeb82..c7968ab 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
@@ -27,28 +27,26 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.MetadataErrorException;
 import org.apache.iotdb.db.exception.PathErrorException;
+import org.apache.iotdb.db.exception.ProcessorException;
 import org.apache.iotdb.db.exception.StartupException;
+import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.metadata.MManager;
 import org.apache.iotdb.db.qp.physical.crud.InsertPlan;
 import org.apache.iotdb.db.query.executor.EngineQueryRouter;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
 import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
 import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
 import org.apache.iotdb.tsfile.read.expression.QueryExpression;
 import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
 import org.apache.iotdb.tsfile.write.record.TSRecord;
 import org.apache.iotdb.tsfile.write.record.datapoint.DoubleDataPoint;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class  DeletionQueryTest {
@@ -89,7 +87,7 @@ public class  DeletionQueryTest {
 
   @Test
   public void testDeleteInBufferWriteCache() throws
-      StorageEngineException, IOException {
+      StorageEngineException, IOException, ProcessorException {
 
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, processorName);
@@ -121,7 +119,8 @@ public class  DeletionQueryTest {
   }
 
   @Test
-  public void testDeleteInBufferWriteFile() throws StorageEngineException, 
IOException {
+  public void testDeleteInBufferWriteFile()
+      throws StorageEngineException, IOException, ProcessorException {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, processorName);
       for (int j = 0; j < 10; j++) {
@@ -152,7 +151,8 @@ public class  DeletionQueryTest {
   }
 
   @Test
-  public void testDeleteInOverflowCache() throws StorageEngineException, 
IOException {
+  public void testDeleteInOverflowCache()
+      throws StorageEngineException, IOException, ProcessorException {
     // insert into BufferWrite
     for (int i = 101; i <= 200; i++) {
       TSRecord record = new TSRecord(i, processorName);
@@ -187,14 +187,15 @@ public class  DeletionQueryTest {
 
     int count = 0;
     while (dataSet.hasNext()) {
-      RowRecord record = dataSet.next();
+      dataSet.next();
       count++;
     }
     assertEquals(150, count);
   }
 
   @Test
-  public void testDeleteInOverflowFile() throws StorageEngineException, 
IOException {
+  public void testDeleteInOverflowFile()
+      throws StorageEngineException, IOException, ProcessorException {
     // insert into BufferWrite
     for (int i = 101; i <= 200; i++) {
       TSRecord record = new TSRecord(i, processorName);
@@ -237,7 +238,7 @@ public class  DeletionQueryTest {
 
   @Test
   public void testSuccessiveDeletion()
-      throws StorageEngineException, IOException, InterruptedException {
+      throws StorageEngineException, IOException, ProcessorException {
     for (int i = 1; i <= 100; i++) {
       TSRecord record = new TSRecord(i, processorName);
       for (int j = 0; j < 10; j++) {
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FileNodeManagerBenchmark.java
 
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FileNodeManagerBenchmark.java
index 7d16042..0c11a70 100644
--- 
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FileNodeManagerBenchmark.java
+++ 
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FileNodeManagerBenchmark.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicLong;
 import org.apache.iotdb.db.engine.StorageEngine;
+import org.apache.iotdb.db.exception.ProcessorException;
 import org.apache.iotdb.db.exception.StorageEngineException;
 import org.apache.iotdb.db.exception.MetadataErrorException;
 import org.apache.iotdb.db.exception.PathErrorException;
@@ -39,11 +40,11 @@ import 
org.apache.iotdb.tsfile.write.record.datapoint.LongDataPoint;
  */
 public class FileNodeManagerBenchmark {
 
-  private static int numOfWoker = 10;
+  private static int numOfWorker = 10;
   private static int numOfDevice = 10;
   private static int numOfMeasurement = 10;
   private static long numOfTotalLine = 10000000;
-  private static CountDownLatch latch = new CountDownLatch(numOfWoker);
+  private static CountDownLatch latch = new CountDownLatch(numOfWorker);
   private static AtomicLong atomicLong = new AtomicLong();
 
   private static String[] devices = new String[numOfDevice];
@@ -83,12 +84,13 @@ public class FileNodeManagerBenchmark {
     tearDown();
     prepare();
     long startTime = System.currentTimeMillis();
-    for (int i = 0; i < numOfWoker; i++) {
-      Woker woker = new Woker();
-      woker.start();
+    for (int i = 0; i < numOfWorker; i++) {
+      Worker worker = new Worker();
+      worker.start();
     }
     latch.await();
     long endTime = System.currentTimeMillis();
+    System.out.println("Elapsed time: " + (endTime - startTime) + "ms");
     tearDown();
   }
 
@@ -100,7 +102,7 @@ public class FileNodeManagerBenchmark {
     return tsRecord;
   }
 
-  private static class Woker extends Thread {
+  private static class Worker extends Thread {
 
     @Override
     public void run() {
@@ -115,7 +117,7 @@ public class FileNodeManagerBenchmark {
           TSRecord tsRecord = getRecord(deltaObject, time);
           StorageEngine.getInstance().insert(new InsertPlan(tsRecord));
         }
-      } catch (StorageEngineException e) {
+      } catch (ProcessorException e) {
         e.printStackTrace();
       } finally {
         latch.countDown();
diff --git 
a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java 
b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
index d8b32bc..d0d47ee 100644
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
@@ -102,7 +102,7 @@ public class TTLTest {
   }
 
   @Test
-  public void testTTLWrite() throws StorageEngineException {
+  public void testTTLWrite() throws QueryProcessorException {
     InsertPlan insertPlan = new InsertPlan();
     insertPlan.setDeviceId(sg1);
     insertPlan.setTime(System.currentTimeMillis());
@@ -127,7 +127,7 @@ public class TTLTest {
     assertTrue(storageGroupProcessor.insert(insertPlan));
   }
 
-  private void prepareData() throws StorageEngineException {
+  private void prepareData() throws QueryProcessorException {
     InsertPlan insertPlan = new InsertPlan();
     insertPlan.setDeviceId(sg1);
     insertPlan.setTime(System.currentTimeMillis());
@@ -155,7 +155,7 @@ public class TTLTest {
   }
 
   @Test
-  public void testTTLRead() throws IOException, StorageEngineException {
+  public void testTTLRead() throws IOException, QueryProcessorException {
     prepareData();
 
     // files before ttl
@@ -204,7 +204,7 @@ public class TTLTest {
   }
 
   @Test
-  public void testTTLRemoval() throws StorageEngineException {
+  public void testTTLRemoval() throws StorageEngineException, 
QueryProcessorException {
     prepareData();
 
     storageGroupProcessor.waitForAllCurrentTsFileProcessorsClosed();
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java 
b/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
index 1cc8e67..75c8ceb 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MTreeTest.java
@@ -29,7 +29,7 @@ import java.util.HashMap;
 import java.util.List;
 import org.apache.iotdb.db.exception.PathErrorException;
 import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
+import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
 import org.apache.iotdb.tsfile.file.metadata.enums.CompressionType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
@@ -55,14 +55,14 @@ public class MTreeTest {
     MTree root = new MTree("root");
     try {
       root.addTimeseriesPath("root.laptop.d1.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
     } catch (PathErrorException e) {
       e.printStackTrace();
       fail(e.getMessage());
     }
     try {
       root.addTimeseriesPath("root.laptop.d1.s1.b", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
     } catch (PathErrorException e) {
       Assert.assertEquals(
           String.format("The Node [%s] is left node, the timeseries %s can't 
be created", "s1",
@@ -74,20 +74,20 @@ public class MTreeTest {
   public void testAddAndPathExist() {
     MTree root = new MTree("root");
     String path1 = "root";
-    assertEquals(true, root.isPathExist(path1));
-    assertEquals(false, root.isPathExist("root.laptop.d1"));
+    assertTrue(root.isPathExist(path1));
+    assertFalse(root.isPathExist("root.laptop.d1"));
     try {
       root.addTimeseriesPath("root.laptop.d1.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
     } catch (PathErrorException e1) {
       fail(e1.getMessage());
     }
-    assertEquals(true, root.isPathExist("root.laptop.d1"));
-    assertEquals(true, root.isPathExist("root.laptop"));
-    assertEquals(false, root.isPathExist("root.laptop.d1.s2"));
+    assertTrue(root.isPathExist("root.laptop.d1"));
+    assertTrue(root.isPathExist("root.laptop"));
+    assertFalse(root.isPathExist("root.laptop.d1.s2"));
     try {
       root.addTimeseriesPath("aa.bb.cc", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
     } catch (PathErrorException e) {
       Assert.assertEquals(String.format("Timeseries %s is not right.", 
"aa.bb.cc"), e.getMessage());
     }
@@ -97,25 +97,25 @@ public class MTreeTest {
   public void testAddAndQueryPath() {
     MTree root = new MTree("root");
     try {
-      assertEquals(false, root.isPathExist("root.a.d0"));
-      assertEquals(false, root.checkFileNameByPath("root.a.d0"));
+      assertFalse(root.isPathExist("root.a.d0"));
+      assertFalse(root.checkFileNameByPath("root.a.d0"));
       root.setStorageGroup("root.a.d0");
       root.addTimeseriesPath("root.a.d0.s0", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root.addTimeseriesPath("root.a.d0.s1", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
-      assertEquals(false, root.isPathExist("root.a.d1"));
-      assertEquals(false, root.checkFileNameByPath("root.a.d1"));
+      assertFalse(root.isPathExist("root.a.d1"));
+      assertFalse(root.checkFileNameByPath("root.a.d1"));
       root.setStorageGroup("root.a.d1");
       root.addTimeseriesPath("root.a.d1.s0", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root.addTimeseriesPath("root.a.d1.s1", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root.setStorageGroup("root.a.b.d0");
       root.addTimeseriesPath("root.a.b.d0.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
     } catch (PathErrorException e1) {
       e1.printStackTrace();
@@ -148,35 +148,35 @@ public class MTreeTest {
     try {
       root.setStorageGroup("root.a.d0");
       root.addTimeseriesPath("root.a.d0.s0", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root.addTimeseriesPath("root.a.d0.s1", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root.setStorageGroup("root.a.d1");
       root.addTimeseriesPath("root.a.d1.s0", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root.addTimeseriesPath("root.a.d1.s1", TSDataType.INT32, TSEncoding.RLE, 
CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root.setStorageGroup("root.a.b.d0");
       root.addTimeseriesPath("root.a.b.d0.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root1.setStorageGroup("root.a.d0");
       root1.addTimeseriesPath("root.a.d0.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root1.addTimeseriesPath("root.a.d0.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root2.setStorageGroup("root.a.d1");
       root2.addTimeseriesPath("root.a.d1.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       root2.addTimeseriesPath("root.a.d1.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       root3.setStorageGroup("root.a.b.d0");
       root3.addTimeseriesPath("root.a.b.d0.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
 
       String[] metadataStrs = new String[3];
       metadataStrs[0] = root1.toString();
@@ -195,11 +195,11 @@ public class MTreeTest {
     MTree root = new MTree("root");
     try {
       root.setStorageGroup("root.laptop.d1");
-      assertEquals(true, root.isPathExist("root.laptop.d1"));
-      assertEquals(true, root.checkFileNameByPath("root.laptop.d1"));
+      assertTrue(root.isPathExist("root.laptop.d1"));
+      assertTrue(root.checkFileNameByPath("root.laptop.d1"));
       assertEquals("root.laptop.d1", 
root.getStorageGroupNameByPath("root.laptop.d1"));
-      assertEquals(false, root.isPathExist("root.laptop.d1.s1"));
-      assertEquals(true, root.checkFileNameByPath("root.laptop.d1.s1"));
+      assertFalse(root.isPathExist("root.laptop.d1.s1"));
+      assertTrue(root.checkFileNameByPath("root.laptop.d1.s1"));
       assertEquals("root.laptop.d1", 
root.getStorageGroupNameByPath("root.laptop.d1.s1"));
     } catch (PathErrorException e) {
       e.printStackTrace();
@@ -218,24 +218,24 @@ public class MTreeTest {
           e.getMessage());
     }
     // check timeseries
-    assertEquals(false, root.isPathExist("root.laptop.d1.s0"));
-    assertEquals(false, root.isPathExist("root.laptop.d1.s1"));
-    assertEquals(false, root.isPathExist("root.laptop.d2.s0"));
-    assertEquals(false, root.isPathExist("root.laptop.d2.s1"));
+    assertFalse(root.isPathExist("root.laptop.d1.s0"));
+    assertFalse(root.isPathExist("root.laptop.d1.s1"));
+    assertFalse(root.isPathExist("root.laptop.d2.s0"));
+    assertFalse(root.isPathExist("root.laptop.d2.s1"));
 
     try {
       assertEquals("root.laptop.d1", 
root.getStorageGroupNameByPath("root.laptop.d1.s0"));
       root.addTimeseriesPath("root.laptop.d1.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       assertEquals("root.laptop.d1", 
root.getStorageGroupNameByPath("root.laptop.d1.s1"));
       root.addTimeseriesPath("root.laptop.d1.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       assertEquals("root.laptop.d2", 
root.getStorageGroupNameByPath("root.laptop.d2.s0"));
       root.addTimeseriesPath("root.laptop.d2.s0", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
       assertEquals("root.laptop.d2", 
root.getStorageGroupNameByPath("root.laptop.d2.s1"));
       root.addTimeseriesPath("root.laptop.d2.s1", TSDataType.INT32, 
TSEncoding.RLE, CompressionType.valueOf
-          (TSFileConfig.compressor), Collections.EMPTY_MAP);
+          (TSFileDescriptor.getInstance().getConfig().getCompressor()), 
Collections.EMPTY_MAP);
     } catch (PathErrorException e) {
       e.printStackTrace();
       fail(e.getMessage());
@@ -246,18 +246,18 @@ public class MTreeTest {
       e.printStackTrace();
       fail(e.getMessage());
     }
-    assertEquals(false, root.isPathExist("root.laptop.d1.s0"));
+    assertFalse(root.isPathExist("root.laptop.d1.s0"));
     try {
       root.deletePath("root.laptop.d1");
     } catch (PathErrorException e) {
       e.printStackTrace();
       fail(e.getMessage());
     }
-    assertEquals(false, root.isPathExist("root.laptop.d1.s1"));
-    assertEquals(false, root.isPathExist("root.laptop.d1"));
-    assertEquals(true, root.isPathExist("root.laptop"));
-    assertEquals(true, root.isPathExist("root.laptop.d2"));
-    assertEquals(true, root.isPathExist("root.laptop.d2.s0"));
+    assertFalse(root.isPathExist("root.laptop.d1.s1"));
+    assertFalse(root.isPathExist("root.laptop.d1"));
+    assertTrue(root.isPathExist("root.laptop"));
+    assertTrue(root.isPathExist("root.laptop.d2"));
+    assertTrue(root.isPathExist("root.laptop.d2.s0"));
   }
 
   @Test
@@ -265,19 +265,19 @@ public class MTreeTest {
     // set storage group first
     MTree root = new MTree("root");
     try {
-      assertEquals(false, root.checkStorageGroup("root"));
-      assertEquals(false, root.checkStorageGroup("root1.laptop.d2"));
+      assertFalse(root.checkStorageGroup("root"));
+      assertFalse(root.checkStorageGroup("root1.laptop.d2"));
 
       root.setStorageGroup("root.laptop.d1");
-      assertEquals(true, root.checkStorageGroup("root.laptop.d1"));
-      assertEquals(false, root.checkStorageGroup("root.laptop.d2"));
-      assertEquals(false, root.checkStorageGroup("root.laptop"));
-      assertEquals(false, root.checkStorageGroup("root.laptop.d1.s1"));
+      assertTrue(root.checkStorageGroup("root.laptop.d1"));
+      assertFalse(root.checkStorageGroup("root.laptop.d2"));
+      assertFalse(root.checkStorageGroup("root.laptop"));
+      assertFalse(root.checkStorageGroup("root.laptop.d1.s1"));
 
       root.setStorageGroup("root.laptop.d2");
-      assertEquals(true, root.checkStorageGroup("root.laptop.d1"));
-      assertEquals(true, root.checkStorageGroup("root.laptop.d2"));
-      assertEquals(false, root.checkStorageGroup("root.laptop.d3"));
+      assertTrue(root.checkStorageGroup("root.laptop.d1"));
+      assertTrue(root.checkStorageGroup("root.laptop.d2"));
+      assertFalse(root.checkStorageGroup("root.laptop.d3"));
     } catch (PathErrorException e) {
       e.printStackTrace();
       fail(e.getMessage());

Reply via email to