You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ge...@apache.org on 2020/10/06 02:04:09 UTC

[iotdb] 01/01: delete

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

geniuspig pushed a commit to branch try_to_fix_bug
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 8c619c0b52ba8b2a27a268a0801521304d1ac6b8
Author: Boris <96...@qq.com>
AuthorDate: Tue Oct 6 10:03:44 2020 +0800

    delete
---
 .../db/{integration => }/IoTDBAggregationIT.java   |    2 +-
 .../iotdb/db/auth/LocalFileAuthorizerTest.java     |  337 -------
 .../iotdb/db/auth/LocalFileRoleAccessorTest.java   |   91 --
 .../iotdb/db/auth/LocalFileRoleManagerTest.java    |  143 ---
 .../iotdb/db/auth/LocalFileUserAccessorTest.java   |  108 --
 .../iotdb/db/auth/LocalFileUserManagerTest.java    |  197 ----
 .../db/auth/authorizer/OpenIdAuthorizerTest.java   |   80 --
 .../IoTDBDefaultThreadExceptionHandlerTest.java    |   78 --
 .../db/concurrent/IoTDBThreadPoolFactoryTest.java  |  219 ----
 .../apache/iotdb/db/conf/IoTDBDescriptorTest.java  |   76 --
 .../conf/adapter/ActiveTimeSeriesCounterTest.java  |  125 ---
 .../db/conf/adapter/CompressionRatioTest.java      |  109 --
 .../iotdb/db/conf/adapter/HyperLogLogTest.java     |   65 --
 .../adapter/IoTDBConfigDynamicAdapterTest.java     |  138 ---
 .../strategy/DirectoryStrategyTest.java            |  200 ----
 .../db/cost/statistic/PerformanceStatTest.java     |  107 --
 .../iotdb/db/engine/MetadataManagerHelper.java     |   93 --
 .../db/engine/cache/ChunkMetadataCacheTest.java    |  171 ----
 .../db/engine/memtable/MemTableFlushTaskTest.java  |   87 --
 .../iotdb/db/engine/memtable/MemTablePoolTest.java |   82 --
 .../db/engine/memtable/MemTableTestUtils.java      |   56 --
 .../db/engine/memtable/MemtableBenchmark.java      |   60 --
 .../db/engine/memtable/PrimitiveMemTableTest.java  |  199 ----
 .../engine/merge/MaxFileMergeFileSelectorTest.java |   85 --
 .../merge/MaxSeriesMergeFileSelectorTest.java      |  107 --
 .../apache/iotdb/db/engine/merge/MergeLogTest.java |   83 --
 .../iotdb/db/engine/merge/MergeManagerTest.java    |  180 ----
 .../iotdb/db/engine/merge/MergeOverLapTest.java    |  180 ----
 .../iotdb/db/engine/merge/MergePerfTest.java       |  107 --
 .../iotdb/db/engine/merge/MergeTaskTest.java       |  259 -----
 .../apache/iotdb/db/engine/merge/MergeTest.java    |  195 ----
 .../iotdb/db/engine/merge/MergeUpgradeTest.java    |  162 ---
 .../engine/modification/DeletionFileNodeTest.java  |  295 ------
 .../db/engine/modification/DeletionQueryTest.java  |  336 -------
 .../engine/modification/ModificationFileTest.java  |  102 --
 .../io/LocalTextModificationAccessorTest.java      |   82 --
 .../storagegroup/FileNodeManagerBenchmark.java     |  134 ---
 .../storagegroup/StorageGroupProcessorTest.java    |  603 -----------
 .../iotdb/db/engine/storagegroup/TTLTest.java      |  380 -------
 .../engine/storagegroup/TsFileProcessorTest.java   |  311 ------
 .../version/SimpleFileVersionControllerTest.java   |   55 -
 .../version/SysTimeVersionControllerTest.java      |   44 -
 .../iotdb/db/integration/IOTDBGroupByIT.java       |  616 ------------
 .../integration/IOTDBGroupByInnerIntervalIT.java   |  290 ------
 .../iotdb/db/integration/IoTDBAddSubDeviceIT.java  |  204 ----
 .../IoTDBAggregationAlignByDeviceIT.java           |  113 ---
 .../db/integration/IoTDBAggregationDeleteIT.java   |   98 --
 .../integration/IoTDBAggregationLargeDataIT.java   |  842 ----------------
 .../integration/IoTDBAggregationSmallDataIT.java   |  686 -------------
 .../apache/iotdb/db/integration/IoTDBAliasIT.java  |  332 -------
 .../iotdb/db/integration/IoTDBAlignByDeviceIT.java | 1047 --------------------
 .../org/apache/iotdb/db/integration/IoTDBAsIT.java |  603 -----------
 .../iotdb/db/integration/IoTDBAuthorizationIT.java | 1005 -------------------
 .../db/integration/IoTDBAutoCreateSchemaIT.java    |  149 ---
 .../iotdb/db/integration/IoTDBClearCacheIT.java    |  174 ----
 .../apache/iotdb/db/integration/IoTDBCloseIT.java  |  201 ----
 .../iotdb/db/integration/IoTDBCompleteIT.java      |  417 --------
 .../db/integration/IoTDBCreateSnapshotIT.java      |  159 ---
 .../apache/iotdb/db/integration/IoTDBDaemonIT.java |  416 --------
 .../db/integration/IoTDBDeleteStorageGroupIT.java  |  143 ---
 .../db/integration/IoTDBDeleteTimeseriesIT.java    |  184 ----
 .../iotdb/db/integration/IoTDBDeletionIT.java      |  283 ------
 .../iotdb/db/integration/IoTDBDisableAlignIT.java  |  401 --------
 .../db/integration/IoTDBEngineTimeGeneratorIT.java |  274 -----
 .../apache/iotdb/db/integration/IoTDBFillIT.java   |  727 --------------
 .../db/integration/IoTDBFloatPrecisionIT.java      |  164 ---
 .../db/integration/IoTDBFlushQueryMergeIT.java     |  208 ----
 .../iotdb/db/integration/IoTDBGroupByFillIT.java   |  627 ------------
 .../integration/IoTDBGroupByFillWithRangeIT.java   |  161 ---
 .../iotdb/db/integration/IoTDBInsertNaNIT.java     |  139 ---
 .../iotdb/db/integration/IoTDBLargeDataIT.java     |  343 -------
 .../apache/iotdb/db/integration/IoTDBLastIT.java   |  425 --------
 .../iotdb/db/integration/IoTDBLimitSlimitIT.java   |  207 ----
 .../db/integration/IoTDBLoadExternalTsfileIT.java  |  492 ---------
 .../iotdb/db/integration/IoTDBMergeTest.java       |  300 ------
 .../iotdb/db/integration/IoTDBMetadataFetchIT.java |  510 ----------
 .../IoTDBMultiOverlappedChunkInUnseqIT.java        |  109 --
 .../db/integration/IoTDBMultiOverlappedPageIT.java |  172 ----
 .../iotdb/db/integration/IoTDBMultiSeriesIT.java   |  440 --------
 .../db/integration/IoTDBMultiStatementsIT.java     |  198 ----
 .../iotdb/db/integration/IoTDBNumberPathIT.java    |  422 --------
 .../db/integration/IoTDBOverlappedPageIT.java      |  135 ---
 .../iotdb/db/integration/IoTDBQueryDemoIT.java     |  418 --------
 .../iotdb/db/integration/IoTDBQuotedPathIT.java    |  151 ---
 .../iotdb/db/integration/IoTDBRecoverIT.java       |  392 --------
 .../db/integration/IoTDBRecoverUnclosedIT.java     |  270 -----
 .../db/integration/IoTDBRemovePartitionIT.java     |  197 ----
 .../iotdb/db/integration/IoTDBRestartIT.java       |  353 -------
 .../IoTDBSameMeasurementsDifferentTypesIT.java     |  190 ----
 .../iotdb/db/integration/IoTDBSensorUpdateIT.java  |   87 --
 .../db/integration/IoTDBSequenceDataQueryIT.java   |  286 ------
 .../iotdb/db/integration/IoTDBSeriesReaderIT.java  |  408 --------
 .../iotdb/db/integration/IoTDBSimpleQueryIT.java   |  602 -----------
 .../integration/IoTDBSortedShowTimeseriesIT.java   |  304 ------
 .../iotdb/db/integration/IoTDBTagAlterIT.java      |  489 ---------
 .../apache/iotdb/db/integration/IoTDBTagIT.java    |  998 -------------------
 .../iotdb/db/integration/IoTDBTimeZoneIT.java      |  141 ---
 .../iotdb/db/integration/IoTDBTracingTest.java     |   67 --
 .../apache/iotdb/db/integration/IoTDBTtlIT.java    |  197 ----
 .../iotdb/db/integration/IoTDBVersionIT.java       |   67 --
 .../iotdb/db/metadata/MManagerAdvancedTest.java    |  156 ---
 .../iotdb/db/metadata/MManagerBasicTest.java       |  413 --------
 .../iotdb/db/metadata/MManagerImproveTest.java     |  192 ----
 .../org/apache/iotdb/db/metadata/MTreeTest.java    |  461 ---------
 .../apache/iotdb/db/metadata/MetaUtilsTest.java    |   65 --
 .../apache/iotdb/db/metadata/PartialPathTest.java  |   74 --
 .../iotdb/db/monitor/collector/FileSizeTest.java   |   95 --
 .../iotdb/db/mqtt/BrokerAuthenticatorTest.java     |   35 -
 .../iotdb/db/mqtt/JSONPayloadFormatTest.java       |   69 --
 .../iotdb/db/mqtt/PayloadFormatManagerTest.java    |   35 -
 .../apache/iotdb/db/mqtt/PublishHandlerTest.java   |   59 --
 .../java/org/apache/iotdb/db/qp/PlannerTest.java   |  178 ----
 .../iotdb/db/qp/bench/QueryParseBenchmark.java     |   44 -
 .../iotdb/db/qp/other/TSPlanContextAuthorTest.java |   81 --
 .../iotdb/db/qp/plan/ConcatOptimizerTest.java      |  124 ---
 .../iotdb/db/qp/plan/LogicalPlanSmallTest.java     |  354 -------
 .../apache/iotdb/db/qp/plan/PhysicalPlanTest.java  |  880 ----------------
 .../apache/iotdb/db/qp/plan/SerializationTest.java |   89 --
 .../iotdb/db/qp/strategy/LogicalGeneratorTest.java |   99 --
 .../db/query/aggregation/AggregateResultTest.java  |  265 -----
 .../db/query/control/FileReaderManagerTest.java    |  145 ---
 .../db/query/control/QueryResourceManagerTest.java |   29 -
 .../dataset/EngineDataSetWithValueFilterTest.java  |  150 ---
 .../db/query/dataset/GroupByFillDataSetTest.java   |  188 ----
 .../db/query/dataset/GroupByLevelDataSetTest.java  |  167 ----
 .../db/query/dataset/GroupByTimeDataSetTest.java   |  233 -----
 .../query/executor/GroupByEngineDataSetTest.java   |  175 ----
 .../query/externalsort/ExternalSortEngineTest.java |  191 ----
 .../db/query/externalsort/FakeChunkReaderWrap.java |   45 -
 ...ExternalSortFileSerializerDeserializerTest.java |  130 ---
 .../iotdb/db/query/reader/ReaderTestHelper.java    |   69 --
 .../reader/series/SeriesAggregateReaderTest.java   |  130 ---
 .../reader/series/SeriesReaderByTimestampTest.java |   85 --
 .../db/query/reader/series/SeriesReaderTest.java   |  165 ---
 .../query/reader/series/SeriesReaderTestUtil.java  |  184 ----
 .../query/reader/universal/FakedSeriesReader.java  |   88 --
 .../reader/universal/PriorityMergeReaderTest.java  |   66 --
 .../reader/universal/PriorityMergeReaderTest2.java |   58 --
 .../org/apache/iotdb/db/script/EnvScriptIT.java    |  121 ---
 .../apache/iotdb/db/sql/CheckPathValidityTest.java |   53 -
 .../db/sql/DatetimeQueryDataSetUtilsTest.java      |  142 ---
 .../db/sync/receiver/load/FileLoaderTest.java      |  347 -------
 .../recover/SyncReceiverLogAnalyzerTest.java       |  215 ----
 .../receiver/recover/SyncReceiverLoggerTest.java   |  112 ---
 .../db/sync/sender/manage/SyncFileManagerTest.java |  283 ------
 .../sender/recover/SyncSenderLogAnalyzerTest.java  |  175 ----
 .../sync/sender/recover/SyncSenderLoggerTest.java  |  111 ---
 .../db/sync/sender/transfer/SyncClientTest.java    |  140 ---
 .../apache/iotdb/db/tools/IoTDBWatermarkTest.java  |  208 ----
 .../org/apache/iotdb/db/tools/WalCheckerTest.java  |  163 ---
 .../iotdb/db/utils/MathQueryDataSetUtilsTest.java  |   64 --
 .../apache/iotdb/db/utils/OpenFileNumUtilTest.java |  288 ------
 .../java/org/apache/iotdb/db/utils/RandomNum.java  |   70 --
 .../iotdb/db/utils/TypeInferenceUtilsTest.java     |   72 --
 .../apache/iotdb/db/utils/VersionUtilsTest.java    |   55 -
 .../db/utils/datastructure/LongTVListTest.java     |   93 --
 .../db/utils/datastructure/PrecisionTest.java      |  125 ---
 .../iotdb/db/writelog/IoTDBLogFileSizeTest.java    |  177 ----
 .../apache/iotdb/db/writelog/PerformanceTest.java  |  177 ----
 .../iotdb/db/writelog/WriteLogNodeManagerTest.java |  111 ---
 .../apache/iotdb/db/writelog/WriteLogNodeTest.java |  240 -----
 .../iotdb/db/writelog/io/LogWriterReaderTest.java  |   86 --
 .../db/writelog/io/MultiFileLogReaderTest.java     |   84 --
 .../db/writelog/recover/DeviceStringTest.java      |  119 ---
 .../iotdb/db/writelog/recover/LogReplayerTest.java |  229 -----
 .../recover/RecoverResourceFromReaderTest.java     |  197 ----
 .../db/writelog/recover/SeqTsFileRecoverTest.java  |  274 -----
 .../writelog/recover/UnseqTsFileRecoverTest.java   |  220 ----
 168 files changed, 1 insertion(+), 37372 deletions(-)

diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationIT.java b/server/src/test/java/org/apache/iotdb/db/IoTDBAggregationIT.java
similarity index 99%
rename from server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationIT.java
rename to server/src/test/java/org/apache/iotdb/db/IoTDBAggregationIT.java
index 2554530..230a03a 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/IoTDBAggregationIT.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.iotdb.db.integration;
+package org.apache.iotdb.db;
 
 import static org.apache.iotdb.db.constant.TestConstant.avg;
 import static org.apache.iotdb.db.constant.TestConstant.count;
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileAuthorizerTest.java b/server/src/test/java/org/apache/iotdb/db/auth/LocalFileAuthorizerTest.java
deleted file mode 100644
index 485bb5b..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileAuthorizerTest.java
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-import java.util.Set;
-import org.apache.iotdb.db.auth.authorizer.IAuthorizer;
-import org.apache.iotdb.db.auth.authorizer.BasicAuthorizer;
-import org.apache.iotdb.db.auth.entity.User;
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LocalFileAuthorizerTest {
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void testAuthorizer() throws AuthException {
-
-    IAuthorizer authorizer = BasicAuthorizer.getInstance();
-    /*
-     * login
-     */
-    try {
-      authorizer.login("root", "root");
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    try {
-      authorizer.login("root", "error");
-    } catch (AuthException e) {
-      assertEquals("The username or the password is not correct", e.getMessage());
-    }
-    /*
-     * create user,delete user
-     */
-    User user = new User("user", "password");
-    try {
-      authorizer.createUser(user.getName(), user.getPassword());
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.createUser(user.getName(), user.getPassword());
-    } catch (AuthException e) {
-      assertEquals("User user already exists", e.getMessage());
-    }
-    try {
-      authorizer.login(user.getName(), user.getPassword());
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.deleteUser(user.getName());
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.deleteUser(user.getName());
-    } catch (AuthException e) {
-      assertEquals("User user does not exist", e.getMessage());
-    }
-
-    /*
-     * permission for user
-     */
-    String nodeName = "root.laptop.d1";
-    try {
-      authorizer.createUser(user.getName(), user.getPassword());
-      authorizer.grantPrivilegeToUser(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.grantPrivilegeToUser(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("User user already has INSERT_TIMESERIES on root.laptop.d1", e.getMessage());
-    }
-    try {
-      authorizer.grantPrivilegeToUser("error", nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("No such user error", e.getMessage());
-    }
-    try {
-      authorizer.revokePrivilegeFromUser(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.revokePrivilegeFromUser(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("User user does not have INSERT_TIMESERIES on root.laptop.d1", e.getMessage());
-    }
-    try {
-      authorizer.deleteUser(user.getName());
-      authorizer.revokePrivilegeFromUser(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("No such user user", e.getMessage());
-    }
-    /*
-     * role
-     */
-    String roleName = "role";
-    try {
-      authorizer.createRole(roleName);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.createRole(roleName);
-    } catch (AuthException e) {
-      assertEquals("Role role already exists", e.getMessage());
-    }
-
-    try {
-      authorizer.deleteRole(roleName);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.deleteRole(roleName);
-    } catch (AuthException e) {
-      assertEquals("Role role does not exist", e.getMessage());
-    }
-    /*
-     * role permission
-     */
-    try {
-      authorizer.createRole(roleName);
-      authorizer.grantPrivilegeToRole(roleName, nodeName, 1);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    try {
-      authorizer.grantPrivilegeToRole(roleName, nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("Role role already has INSERT_TIMESERIES on root.laptop.d1", e.getMessage());
-    }
-
-    try {
-      authorizer.revokePrivilegeFromRole(roleName, nodeName, 1);
-    } catch (AuthException e1) {
-      fail(e1.getMessage());
-    }
-    try {
-      authorizer.revokePrivilegeFromRole(roleName, nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("Role role does not have INSERT_TIMESERIES on root.laptop.d1", e.getMessage());
-    }
-
-    try {
-      authorizer.deleteRole(roleName);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-
-    try {
-      authorizer.revokePrivilegeFromRole(roleName, nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("No such role role", e.getMessage());
-    }
-    try {
-      authorizer.grantPrivilegeToRole(roleName, nodeName, 1);
-    } catch (AuthException e) {
-      assertEquals("No such role role", e.getMessage());
-    }
-
-    /*
-     * user role
-     */
-    try {
-      authorizer.createUser(user.getName(), user.getPassword());
-      authorizer.createRole(roleName);
-      authorizer.grantRoleToUser(roleName, user.getName());
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.grantPrivilegeToUser(user.getName(), nodeName, 1);
-      authorizer.grantPrivilegeToRole(roleName, nodeName, 2);
-      authorizer.grantPrivilegeToRole(roleName, nodeName, 3);
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      Set<Integer> permisssions = authorizer.getPrivileges(user.getName(), nodeName);
-      assertEquals(3, permisssions.size());
-      assertTrue(permisssions.contains(1));
-      assertTrue(permisssions.contains(2));
-      assertTrue(permisssions.contains(3));
-      assertFalse(permisssions.contains(4));
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.revokeRoleFromUser(roleName, user.getName());
-      Set<Integer> permisssions = authorizer.getPrivileges(user.getName(), nodeName);
-      assertEquals(1, permisssions.size());
-      assertTrue(permisssions.contains(1));
-      assertFalse(permisssions.contains(2));
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.checkUserPrivileges(user.getName(), nodeName, 1);
-    } catch (AuthException e) {
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.checkUserPrivileges(user.getName(), nodeName, 2);
-    } catch (AuthException e) {
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.updateUserPassword(user.getName(), "newPassword");
-      authorizer.login(user.getName(), "newPassword");
-    } catch (AuthException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    try {
-      authorizer.deleteUser(user.getName());
-      authorizer.deleteRole(roleName);
-    } catch (AuthException e) {
-      e.printStackTrace();
-    }
-  }
-
-  @Test
-  public void testListUser() throws AuthException {
-    IAuthorizer authorizer = BasicAuthorizer.getInstance();
-    List<String> userList = authorizer.listAllUsers();
-    assertEquals(1, userList.size());
-    assertEquals(IoTDBConstant.ADMIN_NAME, userList.get(0));
-
-    int userCnt = 10;
-    for (int i = 0; i < userCnt; i++) {
-      authorizer.createUser("newUser" + i, "password" + i);
-    }
-    userList = authorizer.listAllUsers();
-    assertEquals(11, userList.size());
-    for (int i = 0; i < userCnt; i++) {
-      assertEquals("newUser" + i, userList.get(i));
-    }
-
-    for (int i = 0; i < userCnt; i++) {
-      if (i % 2 == 0) {
-        authorizer.deleteUser("newUser" + i);
-      }
-    }
-    userList = authorizer.listAllUsers();
-    assertEquals(6, userList.size());
-    for (int i = 0; i < userCnt; i++) {
-      if (i % 2 == 1) {
-        assertEquals("newUser" + i, userList.get(i / 2));
-      }
-    }
-  }
-
-  @Test
-  public void testListRole() throws AuthException {
-    IAuthorizer authorizer = BasicAuthorizer.getInstance();
-    List<String> roleList = authorizer.listAllRoles();
-    assertEquals(0, roleList.size());
-
-    int roleCnt = 10;
-    for (int i = 0; i < roleCnt; i++) {
-      authorizer.createRole("newRole" + i);
-    }
-    roleList = authorizer.listAllRoles();
-    assertEquals(10, roleList.size());
-    for (int i = 0; i < roleCnt; i++) {
-      assertEquals("newRole" + i, roleList.get(i));
-    }
-
-    for (int i = 0; i < roleCnt; i++) {
-      if (i % 2 == 0) {
-        authorizer.deleteRole("newRole" + i);
-      }
-    }
-    roleList = authorizer.listAllRoles();
-    assertEquals(5, roleList.size());
-    for (int i = 0; i < roleCnt; i++) {
-      if (i % 2 == 1) {
-        assertEquals("newRole" + i, roleList.get(i / 2));
-      }
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleAccessorTest.java b/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleAccessorTest.java
deleted file mode 100644
index 29b8223..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleAccessorTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.auth.entity.PathPrivilege;
-import org.apache.iotdb.db.auth.entity.Role;
-import org.apache.iotdb.db.auth.role.LocalFileRoleAccessor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LocalFileRoleAccessorTest {
-
-  private File testFolder;
-  private LocalFileRoleAccessor accessor;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    testFolder = new File(TestConstant.BASE_OUTPUT_PATH.concat("test"));
-    testFolder.mkdirs();
-    accessor = new LocalFileRoleAccessor(testFolder.getPath());
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    FileUtils.deleteDirectory(testFolder);
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void test() throws IOException {
-    Role[] roles = new Role[5];
-    for (int i = 0; i < roles.length; i++) {
-      roles[i] = new Role("role" + i);
-      for (int j = 0; j <= i; j++) {
-        PathPrivilege pathPrivilege = new PathPrivilege("root.a.b.c" + j);
-        pathPrivilege.getPrivileges().add(j);
-        roles[i].getPrivilegeList().add(pathPrivilege);
-      }
-    }
-
-    // save
-    for (Role role : roles) {
-      accessor.saveRole(role);
-    }
-
-    // load
-    for (Role role : roles) {
-      Role loadedRole = accessor.loadRole(role.getName());
-      assertEquals(role, loadedRole);
-    }
-    assertEquals(null, accessor.loadRole("not a role"));
-
-    // delete
-    assertEquals(true, accessor.deleteRole(roles[roles.length - 1].getName()));
-    assertEquals(false, accessor.deleteRole(roles[roles.length - 1].getName()));
-    assertEquals(null, accessor.loadRole(roles[roles.length - 1].getName()));
-
-    // list
-    List<String> roleNames = accessor.listAllRoles();
-    roleNames.sort(null);
-    for (int i = 0; i < roleNames.size(); i++) {
-      assertEquals(roles[i].getName(), roleNames.get(i));
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleManagerTest.java b/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleManagerTest.java
deleted file mode 100644
index 9bb836f..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileRoleManagerTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.auth.entity.PathPrivilege;
-import org.apache.iotdb.db.auth.entity.Role;
-import org.apache.iotdb.db.auth.role.LocalFileRoleManager;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LocalFileRoleManagerTest {
-
-  private File testFolder;
-  private LocalFileRoleManager manager;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    testFolder = new File(TestConstant.BASE_OUTPUT_PATH.concat("test"));
-    testFolder.mkdirs();
-    manager = new LocalFileRoleManager(testFolder.getPath());
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    FileUtils.deleteDirectory(testFolder);
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void test() throws AuthException {
-    Role[] roles = new Role[5];
-    for (int i = 0; i < roles.length; i++) {
-      roles[i] = new Role("role" + i);
-      for (int j = 0; j <= i; j++) {
-        PathPrivilege pathPrivilege = new PathPrivilege("root.a.b.c" + j);
-        pathPrivilege.getPrivileges().add(j);
-        roles[i].getPrivilegeList().add(pathPrivilege);
-      }
-    }
-
-    // create
-    Role role = manager.getRole(roles[0].getName());
-    assertEquals(null, role);
-    for (Role role1 : roles) {
-      assertEquals(true, manager.createRole(role1.getName()));
-    }
-    for (Role role1 : roles) {
-      role = manager.getRole(role1.getName());
-      assertEquals(role1.getName(), role.getName());
-    }
-
-    assertEquals(false, manager.createRole(roles[0].getName()));
-    boolean caught = false;
-    try {
-      manager.createRole("too");
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // delete
-    assertEquals(false, manager.deleteRole("not a role"));
-    assertEquals(true, manager.deleteRole(roles[roles.length - 1].getName()));
-    assertEquals(null, manager.getRole(roles[roles.length - 1].getName()));
-    assertEquals(false, manager.deleteRole(roles[roles.length - 1].getName()));
-
-    // grant privilege
-    role = manager.getRole(roles[0].getName());
-    String path = "root.a.b.c";
-    int privilegeId = 0;
-    assertEquals(false, role.hasPrivilege(path, privilegeId));
-    assertEquals(true, manager.grantPrivilegeToRole(role.getName(), path, privilegeId));
-    assertEquals(true, manager.grantPrivilegeToRole(role.getName(), path, privilegeId + 1));
-    assertEquals(false, manager.grantPrivilegeToRole(role.getName(), path, privilegeId));
-    role = manager.getRole(roles[0].getName());
-    assertEquals(true, role.hasPrivilege(path, privilegeId));
-    caught = false;
-    try {
-      manager.grantPrivilegeToRole("not a role", path, privilegeId);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-    caught = false;
-    try {
-      manager.grantPrivilegeToRole(role.getName(), path, -1);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // revoke privilege
-    role = manager.getRole(roles[0].getName());
-    assertEquals(true, manager.revokePrivilegeFromRole(role.getName(), path, privilegeId));
-    assertEquals(false, manager.revokePrivilegeFromRole(role.getName(), path, privilegeId));
-    caught = false;
-    try {
-      manager.revokePrivilegeFromRole("not a role", path, privilegeId);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-    caught = false;
-    try {
-      manager.revokePrivilegeFromRole(role.getName(), path, -1);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // list roles
-    List<String> rolenames = manager.listAllRoles();
-    rolenames.sort(null);
-    for (int i = 0; i < roles.length - 1; i++) {
-      assertEquals(roles[i].getName(), rolenames.get(i));
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserAccessorTest.java b/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserAccessorTest.java
deleted file mode 100644
index 18c636e..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserAccessorTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.auth.entity.PathPrivilege;
-import org.apache.iotdb.db.auth.entity.User;
-import org.apache.iotdb.db.auth.user.LocalFileUserAccessor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LocalFileUserAccessorTest {
-
-  private File testFolder;
-  private LocalFileUserAccessor accessor;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    testFolder = new File(TestConstant.BASE_OUTPUT_PATH.concat("test"));
-    testFolder.mkdirs();
-    accessor = new LocalFileUserAccessor(testFolder.getPath());
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    FileUtils.deleteDirectory(testFolder);
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void test() throws IOException {
-    User[] users = new User[5];
-    for (int i = 0; i < users.length; i++) {
-      users[i] = new User("user" + i, "password" + i);
-      for (int j = 0; j <= i; j++) {
-        PathPrivilege pathPrivilege = new PathPrivilege("root.a.b.c" + j);
-        pathPrivilege.getPrivileges().add(j);
-        users[i].getPrivilegeList().add(pathPrivilege);
-        users[i].getRoleList().add("role" + j);
-      }
-    }
-
-    // save
-    for (User user : users) {
-      try {
-        accessor.saveUser(user);
-      } catch (IOException e) {
-        fail(e.getMessage());
-      }
-    }
-
-    // load
-    for (User user : users) {
-      try {
-        User loadedUser = accessor.loadUser(user.getName());
-        assertEquals(user, loadedUser);
-      } catch (IOException e) {
-        fail(e.getMessage());
-      }
-    }
-    assertEquals(null, accessor.loadUser("not a user"));
-
-    // list
-    List<String> usernames = accessor.listAllUsers();
-    usernames.sort(null);
-    for (int i = 0; i < users.length; i++) {
-      assertEquals(users[i].getName(), usernames.get(i));
-    }
-
-    // delete
-    assertEquals(false, accessor.deleteUser("not a user"));
-    assertEquals(true, accessor.deleteUser(users[users.length - 1].getName()));
-    usernames = accessor.listAllUsers();
-    assertEquals(users.length - 1, usernames.size());
-    usernames.sort(null);
-    for (int i = 0; i < users.length - 1; i++) {
-      assertEquals(users[i].getName(), usernames.get(i));
-    }
-    User nullUser = accessor.loadUser(users[users.length - 1].getName());
-    assertEquals(null, nullUser);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserManagerTest.java b/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserManagerTest.java
deleted file mode 100644
index 919c17c..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/LocalFileUserManagerTest.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.auth.entity.PathPrivilege;
-import org.apache.iotdb.db.auth.entity.User;
-import org.apache.iotdb.db.auth.user.LocalFileUserManager;
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.utils.AuthUtils;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class LocalFileUserManagerTest {
-
-  private File testFolder;
-  private LocalFileUserManager manager;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    testFolder = new File(TestConstant.BASE_OUTPUT_PATH.concat("test"));
-    testFolder.mkdirs();
-    manager = new LocalFileUserManager(testFolder.getPath());
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    FileUtils.deleteDirectory(testFolder);
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void test() throws AuthException {
-    User[] users = new User[5];
-    for (int i = 0; i < users.length; i++) {
-      users[i] = new User("user" + i, "password" + i);
-      for (int j = 0; j <= i; j++) {
-        PathPrivilege pathPrivilege = new PathPrivilege("root.a.b.c" + j);
-        pathPrivilege.getPrivileges().add(j);
-        users[i].getPrivilegeList().add(pathPrivilege);
-        users[i].getRoleList().add("role" + j);
-      }
-    }
-
-    // create
-    User user = manager.getUser(users[0].getName());
-    assertEquals(null, user);
-    for (User user1 : users) {
-      assertEquals(true, manager.createUser(user1.getName(), user1.getPassword()));
-    }
-    for (User user1 : users) {
-      user = manager.getUser(user1.getName());
-      assertEquals(user1.getName(), user.getName());
-      assertEquals(AuthUtils.encryptPassword(user1.getPassword()), user.getPassword());
-    }
-
-    assertEquals(false, manager.createUser(users[0].getName(), users[0].getPassword()));
-    boolean caught = false;
-    try {
-      manager.createUser("too", "short");
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-    caught = false;
-    try {
-      manager.createUser("short", "too");
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // delete
-    assertEquals(false, manager.deleteUser("not a user"));
-    assertEquals(true, manager.deleteUser(users[users.length - 1].getName()));
-    assertEquals(null, manager.getUser(users[users.length - 1].getName()));
-    assertEquals(false, manager.deleteUser(users[users.length - 1].getName()));
-
-    // grant privilege
-    user = manager.getUser(users[0].getName());
-    String path = "root.a.b.c";
-    int privilegeId = 0;
-    assertEquals(false, user.hasPrivilege(path, privilegeId));
-    assertEquals(true, manager.grantPrivilegeToUser(user.getName(), path, privilegeId));
-    assertEquals(true, manager.grantPrivilegeToUser(user.getName(), path, privilegeId + 1));
-    assertEquals(false, manager.grantPrivilegeToUser(user.getName(), path, privilegeId));
-    user = manager.getUser(users[0].getName());
-    assertEquals(true, user.hasPrivilege(path, privilegeId));
-    caught = false;
-    try {
-      manager.grantPrivilegeToUser("not a user", path, privilegeId);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-    caught = false;
-    try {
-      manager.grantPrivilegeToUser(user.getName(), path, -1);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // revoke privilege
-    user = manager.getUser(users[0].getName());
-    assertEquals(true, manager.revokePrivilegeFromUser(user.getName(), path, privilegeId));
-    assertEquals(false, manager.revokePrivilegeFromUser(user.getName(), path, privilegeId));
-    caught = false;
-    try {
-      manager.revokePrivilegeFromUser("not a user", path, privilegeId);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-    caught = false;
-    try {
-      manager.revokePrivilegeFromUser(user.getName(), path, -1);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // update password
-    String newPassword = "newPassword";
-    String illegalPW = "new";
-    assertEquals(true, manager.updateUserPassword(user.getName(), newPassword));
-    assertEquals(false, manager.updateUserPassword(user.getName(), illegalPW));
-    user = manager.getUser(user.getName());
-    assertEquals(AuthUtils.encryptPassword(newPassword), user.getPassword());
-    caught = false;
-    try {
-      manager.updateUserPassword("not a user", newPassword);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // grant role
-    String roleName = "newrole";
-    assertEquals(true, manager.grantRoleToUser(roleName, user.getName()));
-    assertEquals(false, manager.grantRoleToUser(roleName, user.getName()));
-    user = manager.getUser(user.getName());
-    assertEquals(true, user.hasRole(roleName));
-    caught = false;
-    try {
-      manager.grantRoleToUser("not a user", roleName);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // revoke role
-    assertEquals(true, manager.revokeRoleFromUser(roleName, user.getName()));
-    assertEquals(false, manager.revokeRoleFromUser(roleName, user.getName()));
-    user = manager.getUser(user.getName());
-    assertEquals(false, user.hasRole(roleName));
-    caught = false;
-    try {
-      manager.revokeRoleFromUser("not a user", roleName);
-    } catch (AuthException e) {
-      caught = true;
-    }
-    assertEquals(true, caught);
-
-    // list users
-    List<String> usernames = manager.listAllUsers();
-    usernames.sort(null);
-    assertEquals(IoTDBConstant.ADMIN_NAME, usernames.get(0));
-    for (int i = 0; i < users.length - 1; i++) {
-      assertEquals(users[i].getName(), usernames.get(i + 1));
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/auth/authorizer/OpenIdAuthorizerTest.java b/server/src/test/java/org/apache/iotdb/db/auth/authorizer/OpenIdAuthorizerTest.java
deleted file mode 100644
index aa373ca..0000000
--- a/server/src/test/java/org/apache/iotdb/db/auth/authorizer/OpenIdAuthorizerTest.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.auth.authorizer;
-
-import com.nimbusds.oauth2.sdk.ParseException;
-import com.nimbusds.oauth2.sdk.util.JSONObjectUtils;
-import org.apache.iotdb.db.auth.AuthException;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class OpenIdAuthorizerTest {
-
-    private static final String OPEN_ID_PUBLIC_JWK = "{\"kty\":\"RSA\",\"x5t#S256\":\"TZFbbj6HsRU28HYvrcVnDs03KreV3DE24-Cxb9EPdS4\",\"e\":\"AQAB\",\"use\":\"sig\",\"x5t\":\"l_N2UlC_a624iu5eYFypnB1Wr20\",\"kid\":\"q1-Wm0ozQ5O0mQH8-SJap2ZcN4MmucWwnQWKYxZJ4ow\",\"x5c\":[\"MIICmTCCAYECBgFyRdXW2DANBgkqhkiG9w0BAQsFADAQMQ4wDAYDVQQDDAVJb1REQjAeFw0yMDA1MjQwODM3MjJaFw0zMDA1MjQwODM5MDJaMBAxDjAMBgNVBAMMBUlvVERCMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAozDCZTVc9946VvhZ6E\\/OP8Yx6tJe0i9GR2Q9jR9S3jQo [...]
-
-    @Test
-    public void loginWithJWT() throws AuthException, ParseException, IOException, URISyntaxException {
-        String jwt = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxMS1XbTBvelE1TzBtUUg4LVNKYXAyWmNONE1tdWNXd25RV0tZeFpKNG93In0.eyJleHAiOjE1OTAzMTcxNzYsImlhdCI6MTU5MDMxNjg3NiwianRpIjoiY2MyNWQ3MDAtYjc5NC00OTA4LTg0OGUtOTRhNzYzNmM5YzQxIiwiaXNzIjoiaHR0cDovL2F1dGguZGVtby5wcmFnbWF0aWNpbmR1c3RyaWVzLmRlL2F1dGgvcmVhbG1zL0lvVERCIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6Ijg2YWRmNGIzLWE4ZTUtNDc1NC1iNWEwLTQ4OGI0OWY0M2VkMiIsInR5cCI6IkJlYXJlciIsImF6cCI6ImlvdGRiIiwic2Vzc2lvbl9zdGF0ZSI6Ijk0ZmI5NGZjLTg3YTMtND [...]
-
-        OpenIdAuthorizer authorizer = new OpenIdAuthorizer(JSONObjectUtils.parse(OPEN_ID_PUBLIC_JWK));
-        boolean login = authorizer.login(jwt, null);
-
-        assertTrue(login);
-    }
-
-    @Test
-    public void isAdmin_hasAccess() throws AuthException, ParseException, IOException, URISyntaxException {
-        // IOTDB_ADMIN = true
-        String jwt = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxMS1XbTBvelE1TzBtUUg4LVNKYXAyWmNONE1tdWNXd25RV0tZeFpKNG93In0.eyJleHAiOjE1OTAzMjM5MjgsImlhdCI6MTU5MDMyMzYyOCwianRpIjoiZGQ5ZDZhNmItZjgzOC00Mjk3LTg5YWUtMjdlZTgxNzVhMThiIiwiaXNzIjoiaHR0cDovL2F1dGguZGVtby5wcmFnbWF0aWNpbmR1c3RyaWVzLmRlL2F1dGgvcmVhbG1zL0lvVERCIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6ImJhMzJlNDcxLWM3NzItNGIzMy04ZGE2LTZmZThhY2RhMDA3MyIsInR5cCI6IkJlYXJlciIsImF6cCI6ImlvdGRiIiwic2Vzc2lvbl9zdGF0ZSI6IjViZDRhNmM5LTBmYzItNG [...]
-
-        OpenIdAuthorizer authorizer = new OpenIdAuthorizer(JSONObjectUtils.parse(OPEN_ID_PUBLIC_JWK));
-        boolean admin = authorizer.isAdmin(jwt);
-
-        assertTrue(admin);
-    }
-
-    @Test
-    public void isAdmin_noAdminClaim() throws AuthException, ParseException, IOException, URISyntaxException {
-        // IOTDB_ADMIN = false
-        String jwt = "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxMS1XbTBvelE1TzBtUUg4LVNKYXAyWmNONE1tdWNXd25RV0tZeFpKNG93In0.eyJleHAiOjE1OTAzMTcxNzYsImlhdCI6MTU5MDMxNjg3NiwianRpIjoiY2MyNWQ3MDAtYjc5NC00OTA4LTg0OGUtOTRhNzYzNmM5YzQxIiwiaXNzIjoiaHR0cDovL2F1dGguZGVtby5wcmFnbWF0aWNpbmR1c3RyaWVzLmRlL2F1dGgvcmVhbG1zL0lvVERCIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6Ijg2YWRmNGIzLWE4ZTUtNDc1NC1iNWEwLTQ4OGI0OWY0M2VkMiIsInR5cCI6IkJlYXJlciIsImF6cCI6ImlvdGRiIiwic2Vzc2lvbl9zdGF0ZSI6Ijk0ZmI5NGZjLTg3YTMtND [...]
-
-        OpenIdAuthorizer authorizer = new OpenIdAuthorizer(JSONObjectUtils.parse(OPEN_ID_PUBLIC_JWK));
-        boolean admin = authorizer.isAdmin(jwt);
-
-        assertFalse(admin);
-    }
-
-    /**
-     * Can be run manually as long as the site below is active...
-     */
-    @Test
-    @Ignore("We have to find a way to test this against a defined OIDC Provider")
-    public void fetchMetadata() throws ParseException, IOException, URISyntaxException, AuthException {
-        OpenIdAuthorizer openIdAuthorizer = new OpenIdAuthorizer("https://auth.demo.pragmaticindustries.de/auth/realms/IoTDB/");
-        final boolean login = openIdAuthorizer.login("eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxMS1XbTBvelE1TzBtUUg4LVNKYXAyWmNONE1tdWNXd25RV0tZeFpKNG93In0.eyJleHAiOjE1OTAzMTcxNzYsImlhdCI6MTU5MDMxNjg3NiwianRpIjoiY2MyNWQ3MDAtYjc5NC00OTA4LTg0OGUtOTRhNzYzNmM5YzQxIiwiaXNzIjoiaHR0cDovL2F1dGguZGVtby5wcmFnbWF0aWNpbmR1c3RyaWVzLmRlL2F1dGgvcmVhbG1zL0lvVERCIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6Ijg2YWRmNGIzLWE4ZTUtNDc1NC1iNWEwLTQ4OGI0OWY0M2VkMiIsInR5cCI6IkJlYXJlciIsImF6cCI6ImlvdGRiIiwic2Vzc2lvbl [...]
-
-        assertTrue(login);
-    }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBDefaultThreadExceptionHandlerTest.java b/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBDefaultThreadExceptionHandlerTest.java
deleted file mode 100644
index 0e1997a..0000000
--- a/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBDefaultThreadExceptionHandlerTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.concurrent;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.concurrent.atomic.AtomicInteger;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IoTDBDefaultThreadExceptionHandlerTest {
-
-  private final String message = "Expected!";
-  private Thread.UncaughtExceptionHandler handler;
-  private AtomicInteger count;
-
-  @Before
-  public void setUp() throws Exception {
-    handler = Thread.getDefaultUncaughtExceptionHandler();
-    Thread.setDefaultUncaughtExceptionHandler(new TestExceptionHandler(message));
-    count = new AtomicInteger(0);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    Thread.setDefaultUncaughtExceptionHandler(handler);
-  }
-
-  @Test
-  public void test() throws InterruptedException {
-    int num = 10;
-    for (int i = 0; i < num; i++) {
-      TestThread thread = new TestThread();
-      thread.start();
-    }
-    Thread.sleep(500);
-    assertEquals(num, count.get());
-  }
-
-  class TestThread extends Thread {
-
-    public void run() {
-      throw new RuntimeException(message);
-    }
-  }
-
-  class TestExceptionHandler implements Thread.UncaughtExceptionHandler {
-
-    private String name;
-
-    public TestExceptionHandler(String name) {
-      this.name = name;
-    }
-
-    @Override
-    public void uncaughtException(Thread t, Throwable e) {
-      assertEquals(name, e.getMessage());
-      count.addAndGet(1);
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBThreadPoolFactoryTest.java b/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBThreadPoolFactoryTest.java
deleted file mode 100644
index 9d4fe89..0000000
--- a/server/src/test/java/org/apache/iotdb/db/concurrent/IoTDBThreadPoolFactoryTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.concurrent;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.server.TThreadPoolServer.Args;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IoTDBThreadPoolFactoryTest {
-
-  private final String POOL_NAME = "test";
-  private AtomicInteger count;
-  private CountDownLatch latch;
-
-  @Before
-  public void setUp() throws Exception {
-    count = new AtomicInteger(0);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-  }
-
-  @Test
-  public void testNewFixedThreadPool() throws InterruptedException, ExecutionException {
-    String reason = "(can be ignored in Tests) NewFixedThreadPool";
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 4;
-    latch = new CountDownLatch(threadCount);
-    ExecutorService exec = IoTDBThreadPoolFactory
-        .newFixedThreadPool(threadCount / 2, POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      exec.execute(task);
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testNewSingleThreadExecutor() throws InterruptedException {
-    String reason = "(can be ignored in Tests)NewSingleThreadExecutor";
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 2;
-    latch = new CountDownLatch(threadCount);
-    ExecutorService exec = IoTDBThreadPoolFactory.newSingleThreadExecutor(POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      exec.execute(task);
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testNewCachedThreadPool() throws InterruptedException {
-    String reason = "(can be ignored in Tests) NewCachedThreadPool";
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 4;
-    latch = new CountDownLatch(threadCount);
-    ExecutorService exec = IoTDBThreadPoolFactory.newCachedThreadPool(POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      exec.execute(task);
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testNewSingleThreadScheduledExecutor() throws InterruptedException {
-    String reason = "(can be ignored in Tests) NewSingleThreadScheduledExecutor";
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 2;
-    latch = new CountDownLatch(threadCount);
-    ScheduledExecutorService exec = IoTDBThreadPoolFactory
-        .newSingleThreadScheduledExecutor(POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      ScheduledFuture<?> future = exec.scheduleAtFixedRate(task, 0, 1, TimeUnit.SECONDS);
-      try {
-        future.get();
-      } catch (ExecutionException e) {
-        assertEquals(reason, e.getCause().getMessage());
-        count.addAndGet(1);
-        latch.countDown();
-      }
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testNewScheduledThreadPool() throws InterruptedException {
-    String reason = "(can be ignored in Tests) NewScheduledThreadPool";
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 4;
-    latch = new CountDownLatch(threadCount);
-    ScheduledExecutorService exec = IoTDBThreadPoolFactory
-        .newScheduledThreadPool(threadCount / 2, POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      ScheduledFuture<?> future = exec.scheduleAtFixedRate(task, 0, 1, TimeUnit.SECONDS);
-      try {
-        future.get();
-      } catch (ExecutionException e) {
-        assertEquals(reason, e.getCause().getMessage());
-        count.addAndGet(1);
-        latch.countDown();
-      }
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  @Test
-  public void testCreateJDBCClientThreadPool() throws InterruptedException {
-    String reason = "(can be ignored in Tests) CreateJDBCClientThreadPool";
-    TThreadPoolServer.Args args = new Args(null);
-    args.maxWorkerThreads = 4;
-    args.minWorkerThreads = 2;
-    args.stopTimeoutVal = 10;
-    args.stopTimeoutUnit = TimeUnit.SECONDS;
-    Thread.UncaughtExceptionHandler handler = new TestExceptionHandler(reason);
-    int threadCount = 4;
-    latch = new CountDownLatch(threadCount);
-    ExecutorService exec = IoTDBThreadPoolFactory
-        .createThriftRpcClientThreadPool(args, POOL_NAME, handler);
-    for (int i = 0; i < threadCount; i++) {
-      Runnable task = new TestThread(reason);
-      exec.execute(task);
-    }
-    try {
-      latch.await();
-      assertEquals(count.get(), threadCount);
-    } catch (InterruptedException E) {
-      fail();
-    }
-  }
-
-  class TestExceptionHandler implements Thread.UncaughtExceptionHandler {
-
-    private String name;
-
-    public TestExceptionHandler(String name) {
-      this.name = name;
-    }
-
-    @Override
-    public void uncaughtException(Thread t, Throwable e) {
-      assertEquals(name, e.getMessage());
-      count.addAndGet(1);
-      latch.countDown();
-    }
-  }
-
-  class TestThread extends WrappedRunnable {
-
-    private String name;
-
-    public TestThread(String name) {
-      this.name = name;
-    }
-
-    @Override
-    public void runMayThrow() {
-      throw new RuntimeException(name);
-    }
-
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/IoTDBDescriptorTest.java b/server/src/test/java/org/apache/iotdb/db/conf/IoTDBDescriptorTest.java
deleted file mode 100644
index 14f2514..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/IoTDBDescriptorTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.net.URL;
-
-public class IoTDBDescriptorTest {
-  private final String confPath = System.getProperty(IoTDBConstant.IOTDB_CONF, null);
-
-  @Before
-  public void init() {
-    org.apache.catalina.webresources.TomcatURLStreamHandlerFactory.getInstance();
-  }
-
-  @After
-  public void clear() {
-    if (confPath != null) {
-      System.setProperty(IoTDBConstant.IOTDB_CONF, confPath);
-    } else {
-      System.clearProperty(IoTDBConstant.IOTDB_CONF);
-    }
-  }
-
-  @Test
-  public void testConfigURLWithFileProtocol() {
-    IoTDBDescriptor desc = IoTDBDescriptor.getInstance();
-    String pathString = "file:/usr/local/bin";
-
-    System.setProperty(IoTDBConstant.IOTDB_CONF, pathString);
-    URL confURL = desc.getPropsUrl();
-    Assert.assertTrue(confURL.toString().startsWith(pathString));
-  }
-
-  @Test
-  public void testConfigURLWithClasspathProtocol() {
-    IoTDBDescriptor desc = IoTDBDescriptor.getInstance();
-
-    String pathString = "classpath:/root/path";
-    System.setProperty(IoTDBConstant.IOTDB_CONF, pathString);
-    URL confURL = desc.getPropsUrl();
-    Assert.assertTrue(confURL.toString().startsWith(pathString));
-  }
-
-  @Test
-  public void testConfigURLWithPlainFilePath() {
-    IoTDBDescriptor desc = IoTDBDescriptor.getInstance();
-    URL path = IoTDBConfig.class.getResource("/" + IoTDBConfig.CONFIG_NAME);
-    // filePath is a plain path string
-    String filePath = path.getFile();
-    System.setProperty(IoTDBConstant.IOTDB_CONF, filePath);
-    URL confURL = desc.getPropsUrl();
-    Assert.assertEquals(confURL.toString(), path.toString());
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounterTest.java b/server/src/test/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounterTest.java
deleted file mode 100644
index 0cd020f..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/adapter/ActiveTimeSeriesCounterTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf.adapter;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.apache.iotdb.db.concurrent.WrappedRunnable;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * ActiveTimeSeriesCounter Tester.
- */
-public class ActiveTimeSeriesCounterTest {
-
-  private static final String TEST_SG_PREFIX = "root.sg_";
-  private static int testStorageGroupNum = 10;
-  private static String[] storageGroups = new String[testStorageGroupNum];
-  private static int[] measurementNum = new int[testStorageGroupNum];
-  private static double totalSeriesNum = 0;
-
-  static {
-    for (int i = 0; i < testStorageGroupNum; i++) {
-      storageGroups[i] = TEST_SG_PREFIX + i;
-      measurementNum[i] = i + 1;
-      totalSeriesNum += measurementNum[i];
-    }
-  }
-
-  @Before
-  public void before() throws Exception {
-    ActiveTimeSeriesCounter.clear();
-    for (String storageGroup : storageGroups) {
-      ActiveTimeSeriesCounter.getInstance().init(storageGroup);
-    }
-  }
-
-  @After
-  public void after() throws Exception {
-    for (String storageGroup : storageGroups) {
-      ActiveTimeSeriesCounter.getInstance().delete(storageGroup);
-    }
-  }
-
-  /**
-   * Method: init(String storageGroup)
-   */
-  @Test
-  public void testInit() throws Exception {
-    for (int i = 0; i < testStorageGroupNum; i++) {
-      assertEquals(0D, ActiveTimeSeriesCounter.getInstance().getActiveRatio(storageGroups[i]), 0.0);
-    }
-  }
-
-  /**
-   * Method: updateActiveRatio(String storageGroup)
-   */
-  @Test
-  public void testUpdateActiveRatio() throws Exception {
-    ExecutorService service = Executors.newFixedThreadPool(storageGroups.length);
-    CountDownLatch finished = new CountDownLatch(storageGroups.length);
-    for (int i = 0; i < storageGroups.length; i++) {
-      service.submit(new OfferThreads(storageGroups[i], measurementNum[i], finished));
-    }
-    finished.await();
-    for (String storageGroup : storageGroups) {
-      ActiveTimeSeriesCounter.getInstance().updateActiveRatio(storageGroup);
-      double sum = 0;
-      for (String s : storageGroups) {
-        sum += ActiveTimeSeriesCounter.getInstance().getActiveRatio(s);
-      }
-      assertEquals(1.0, sum, 0.001);
-    }
-    for (int i = 0; i < storageGroups.length; i++) {
-      double r = ActiveTimeSeriesCounter.getInstance().getActiveRatio(storageGroups[i]);
-      assertEquals(measurementNum[i] / totalSeriesNum, r, 0.001);
-    }
-  }
-
-  private static class OfferThreads extends WrappedRunnable {
-    private int sensorNum;
-    private String storageGroup;
-    private CountDownLatch finished;
-
-    private OfferThreads(String storageGroup, int sensorNum, CountDownLatch finished) {
-      this.sensorNum = sensorNum;
-      this.storageGroup = storageGroup;
-      this.finished = finished;
-    }
-
-    @Override
-    public void runMayThrow() {
-      try {
-        for (int j = 0; j < sensorNum; j++) {
-          ActiveTimeSeriesCounter.getInstance().offer(storageGroup, "device_0", "sensor_" + j);
-        }
-      }finally {
-        finished.countDown();
-      }
-    }
-  }
-
-
-} 
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/adapter/CompressionRatioTest.java b/server/src/test/java/org/apache/iotdb/db/conf/adapter/CompressionRatioTest.java
deleted file mode 100644
index 4269f8f..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/adapter/CompressionRatioTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf.adapter;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.db.utils.FilePathUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CompressionRatioTest {
-
-  private static final IoTDBConfig CONFIG = IoTDBDescriptor.getInstance().getConfig();
-
-  private CompressionRatio compressionRatio = CompressionRatio.getInstance();
-
-  private static final String directory = FilePathUtils.regularizePath(CONFIG.getSystemDir())
-      + CompressionRatio.COMPRESSION_RATIO_DIR;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-    FileUtils.forceMkdir(new File(directory));
-    compressionRatio.reset();
-    compressionRatio.restore();
-    IoTDBDescriptor.getInstance().getConfig().setEnableParameterAdapter(true);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void testCompressionRatio() throws IOException {
-    double compressionRatioSum = 0;
-    int calcuTimes = 0;
-    if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-      fail();
-    }
-    double compressionRatio = 10;
-    for(int i = 0; i < 500 ; i+= compressionRatio){
-      this.compressionRatio.updateRatio(compressionRatio);
-      if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-        fail();
-      }
-      calcuTimes++;
-      compressionRatioSum += compressionRatio;
-      if (!new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-        fail();
-      }
-      assertEquals(0, Double
-          .compare(compressionRatioSum / calcuTimes, this.compressionRatio.getRatio()));
-    }
-  }
-
-  @Test
-  public void testRestore() throws IOException {
-    double compressionRatioSum = 0;
-    int calcuTimes = 0;
-    if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-      fail();
-    }
-    int compressionRatio = 10;
-    for(int i = 0; i < 100 ; i+= compressionRatio){
-      this.compressionRatio.updateRatio(compressionRatio);
-      if (new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-        fail();
-      }
-      calcuTimes++;
-      compressionRatioSum += compressionRatio;
-      if (!new File(directory, String.format(Locale.ENGLISH, CompressionRatio.RATIO_FILE_PATH_FORMAT, compressionRatioSum , calcuTimes)).exists()) {
-        fail();
-      }
-      assertEquals(0, Double
-          .compare(compressionRatioSum / calcuTimes, this.compressionRatio.getRatio()));
-    }
-    this.compressionRatio.restore();
-    assertEquals(10, this.compressionRatio.getCalcTimes());
-    assertEquals(0, Double
-        .compare(compressionRatioSum / calcuTimes, this.compressionRatio.getRatio()));
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/adapter/HyperLogLogTest.java b/server/src/test/java/org/apache/iotdb/db/conf/adapter/HyperLogLogTest.java
deleted file mode 100644
index 09da1b1..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/adapter/HyperLogLogTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf.adapter;
-
-import static org.junit.Assert.assertEquals;
-
-import com.clearspring.analytics.stream.cardinality.HyperLogLog;
-import com.clearspring.analytics.stream.cardinality.ICardinality;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Random;
-import java.util.Set;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class HyperLogLogTest {
-
-  @Test
-  public void testStreamLibHll() {
-    final int seed = 12345;
-    // data on which to calculate distinct count
-    Random random = new Random(seed);
-    int sampleSize = 10000;
-    double[] floor = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0};
-    String[] avgErrors = new String[floor.length];
-    int testNum = 1000;
-
-    for (double v : floor) {
-      double errorSum = 0;
-      for (int testIndex = 0; testIndex < testNum; testIndex++) {
-        final ArrayList<Integer> list = new ArrayList<>();
-        for (int i = 0; i < sampleSize; i++) {
-          list.add(random.nextInt((int) (sampleSize * v)));
-        }
-        Set<Integer> set = new HashSet<>();
-        ICardinality card = new HyperLogLog(ActiveTimeSeriesCounter.LOG2M);
-        for (int a : list) {
-          set.add(a);
-          card.offer(a);
-        }
-        double p = (card.cardinality() - set.size()) / (double) set.size();
-        errorSum += Math.abs(p);
-      }
-      // allow average error rate less than 1%
-      assertEquals(0, errorSum / testNum, 0.01);
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java b/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
deleted file mode 100644
index 0b1ba26..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/adapter/IoTDBConfigDynamicAdapterTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf.adapter;
-
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.ConfigAdjusterException;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.apache.iotdb.db.conf.adapter.IoTDBConfigDynamicAdapter.MEMTABLE_NUM_FOR_EACH_PARTITION;
-import static org.junit.Assert.assertEquals;
-
-public class IoTDBConfigDynamicAdapterTest {
-
-  private static final IoTDBConfig CONFIG = IoTDBDescriptor.getInstance().getConfig();
-
-  private long oldTsFileThreshold = CONFIG.getTsFileSizeThreshold();
-
-  private int oldMaxMemTableNumber = CONFIG.getMaxMemtableNumber();
-
-  private long oldGroupSizeInByte = CONFIG.getMemtableSizeThreshold();
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-    IoTDBDescriptor.getInstance().getConfig().setEnableParameterAdapter(true);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    CONFIG.setMaxMemtableNumber(oldMaxMemTableNumber);
-    CONFIG.setTsFileSizeThreshold(oldTsFileThreshold);
-    CONFIG.setMemtableSizeThreshold(oldGroupSizeInByte);
-    IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(0);
-    IoTDBConfigDynamicAdapter.getInstance().reset();
-  }
-
-  @Test
-  public void addOrDeleteStorageGroup() throws ConfigAdjusterException {
-    int memTableNum = IoTDBConfigDynamicAdapter.MEM_TABLE_AVERAGE_QUEUE_LEN;
-    for (int i = 1; i < 100; i++) {
-      IoTDBConfigDynamicAdapter.getInstance().addOrDeleteTimeSeries(1);
-    }
-    IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(100);
-    for (int i = 1; i < 1000000; i++) {
-      try {
-        IoTDBConfigDynamicAdapter.getInstance().addOrDeleteStorageGroup(1);
-        memTableNum += IoTDBDescriptor.getInstance().getConfig().getConcurrentWritingTimePartition() * MEMTABLE_NUM_FOR_EACH_PARTITION + 1;
-        assertEquals(IoTDBConfigDynamicAdapter.getInstance().getCurrentMemTableSize(),
-            CONFIG.getMemtableSizeThreshold());
-        assertEquals(CONFIG.getMaxMemtableNumber(), memTableNum);
-      } catch (ConfigAdjusterException e) {
-        assertEquals(String.format(ConfigAdjusterException.ERROR_MSG_FORMAT,
-            IoTDBConfigDynamicAdapter.CREATE_STORAGE_GROUP), e.getMessage());
-        assertEquals(CONFIG.getMaxMemtableNumber(), memTableNum);
-        break;
-      }
-    }
-  }
-
-  @Test
-  public void addOrDeleteTimeSeries() throws ConfigAdjusterException {
-    int totalTimeseries = 0;
-    for (int i = 1; i < 100; i++) {
-      IoTDBConfigDynamicAdapter.getInstance().addOrDeleteStorageGroup(1);
-    }
-    IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(100);
-    for (int i = 1; i < 1000000; i++) {
-      try {
-        IoTDBConfigDynamicAdapter.getInstance().addOrDeleteTimeSeries(1);
-
-        if (i % 10 == 0) {
-          IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(i);
-        }
-        totalTimeseries += 1;
-        assertEquals(IoTDBConfigDynamicAdapter.getInstance().getCurrentMemTableSize(),
-            CONFIG.getMemtableSizeThreshold());
-        assertEquals(IoTDBConfigDynamicAdapter.getInstance().getTotalTimeseries(),
-            totalTimeseries);
-      } catch (ConfigAdjusterException e) {
-        assertEquals(String.format(ConfigAdjusterException.ERROR_MSG_FORMAT,
-            IoTDBConfigDynamicAdapter.ADD_TIMESERIES), e.getMessage());
-        assertEquals(IoTDBConfigDynamicAdapter.getInstance().getTotalTimeseries(),
-            totalTimeseries);
-        break;
-      }
-    }
-  }
-
-  @Test
-  public void addOrDeleteTimeSeriesSyso() throws ConfigAdjusterException {
-    int sgNum = 1;
-    for (int i = 0; i < 30; i++) {
-      IoTDBConfigDynamicAdapter.getInstance().addOrDeleteStorageGroup(sgNum);
-    }
-    int i = 1;
-    try {
-      for (; i <= 280 * 3200; i++) {
-        IoTDBConfigDynamicAdapter.getInstance().addOrDeleteTimeSeries(1);
-        IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(i / 30 + 1);
-      }
-    } catch (ConfigAdjusterException e) {
-      assertEquals(String.format(ConfigAdjusterException.ERROR_MSG_FORMAT,
-          IoTDBConfigDynamicAdapter.ADD_TIMESERIES), e.getMessage());
-    }
-    try {
-      while (true) {
-        IoTDBConfigDynamicAdapter.getInstance().addOrDeleteTimeSeries(1);
-        IoTDB.metaManager.setMaxSeriesNumberAmongStorageGroup(IoTDB.metaManager.getMaximalSeriesNumberAmongStorageGroups() + 1);
-      }
-    } catch (ConfigAdjusterException e ) {
-      assertEquals(String.format(ConfigAdjusterException.ERROR_MSG_FORMAT,
-          IoTDBConfigDynamicAdapter.ADD_TIMESERIES), e.getMessage());
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategyTest.java b/server/src/test/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategyTest.java
deleted file mode 100644
index 8aaf7bc..0000000
--- a/server/src/test/java/org/apache/iotdb/db/conf/directories/strategy/DirectoryStrategyTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.conf.directories.strategy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.exception.DiskSpaceInsufficientException;
-import org.apache.iotdb.db.utils.CommonUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PowerMockIgnore;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*", "org.w3c.*"})
-@PrepareForTest(CommonUtils.class)
-public class DirectoryStrategyTest {
-
-  List<String> dataDirList;
-  Set<Integer> fullDirIndexSet;
-
-  @Before
-  public void setUp() throws IOException {
-    dataDirList = new ArrayList<>();
-    for (int i = 0; i < 5; i++) {
-      dataDirList.add(TestConstant.OUTPUT_DATA_DIR + i);
-    }
-
-    fullDirIndexSet = new HashSet<>();
-    fullDirIndexSet.add(1);
-    fullDirIndexSet.add(3);
-
-    PowerMockito.mockStatic(CommonUtils.class);
-    for (int i = 0; i < dataDirList.size(); i++) {
-      boolean res = !fullDirIndexSet.contains(i);
-      PowerMockito.when(CommonUtils.hasSpace(dataDirList.get(i))).thenReturn(res);
-      PowerMockito.when(CommonUtils.getUsableSpace(dataDirList.get(i))).thenReturn(res ? (long) (i + 1) : 0L);
-      PowerMockito.when(CommonUtils.getOccupiedSpace(dataDirList.get(i))).thenReturn(res ? (long) (i + 1) : Long.MAX_VALUE);
-    }
-  }
-
-  @After
-  public void tearDown() {
-
-  }
-
-  @Test
-  public void testSequenceStrategy() throws DiskSpaceInsufficientException {
-    SequenceStrategy sequenceStrategy = new SequenceStrategy();
-    sequenceStrategy.setFolders(dataDirList);
-
-    // loop two times of data dir size to fully loop
-    int index = 0;
-    for (int i = 0; i < dataDirList.size() * 2; i++, index++) {
-      index = index % dataDirList.size();
-      while (fullDirIndexSet.contains(index)) {
-        index = (index + 1) % dataDirList.size();
-      }
-      assertEquals(index, sequenceStrategy.nextFolderIndex());
-    }
-  }
-
-  @Test
-  public void testMaxDiskUsableSpaceFirstStrategy() throws DiskSpaceInsufficientException {
-    MaxDiskUsableSpaceFirstStrategy maxDiskUsableSpaceFirstStrategy = new MaxDiskUsableSpaceFirstStrategy();
-    maxDiskUsableSpaceFirstStrategy.setFolders(dataDirList);
-
-    int maxIndex = getIndexOfMaxSpace();
-    for (int i = 0; i < dataDirList.size(); i++) {
-      assertEquals(maxIndex, maxDiskUsableSpaceFirstStrategy.nextFolderIndex());
-    }
-
-    PowerMockito.when(CommonUtils.getUsableSpace(dataDirList.get(maxIndex))).thenReturn(0L);
-    maxIndex = getIndexOfMaxSpace();
-    for (int i = 0; i < dataDirList.size(); i++) {
-      assertEquals(maxIndex, maxDiskUsableSpaceFirstStrategy.nextFolderIndex());
-    }
-  }
-
-  private int getIndexOfMaxSpace() {
-    int index = -1;
-    long maxSpace = -1;
-    for (int i = 0; i < dataDirList.size(); i++) {
-      long space = CommonUtils.getUsableSpace(dataDirList.get(i));
-      if (maxSpace < space) {
-        index = i;
-        maxSpace = space;
-      }
-    }
-    return index;
-  }
-
-  @Test
-  public void testMinFolderOccupiedSpaceFirstStrategy()
-      throws DiskSpaceInsufficientException, IOException {
-    MinFolderOccupiedSpaceFirstStrategy minFolderOccupiedSpaceFirstStrategy = new MinFolderOccupiedSpaceFirstStrategy();
-    minFolderOccupiedSpaceFirstStrategy.setFolders(dataDirList);
-
-    int minIndex = getIndexOfMinOccupiedSpace();
-    for (int i = 0; i < dataDirList.size(); i++) {
-      assertEquals(minIndex, minFolderOccupiedSpaceFirstStrategy.nextFolderIndex());
-    }
-
-    PowerMockito.when(CommonUtils.getOccupiedSpace(dataDirList.get(minIndex))).thenReturn(Long.MAX_VALUE);
-    minIndex = getIndexOfMinOccupiedSpace();
-    for (int i = 0; i < dataDirList.size(); i++) {
-      assertEquals(minIndex, minFolderOccupiedSpaceFirstStrategy.nextFolderIndex());
-    }
-  }
-
-  private int getIndexOfMinOccupiedSpace() throws IOException {
-    int index = -1;
-    long minOccupied = Long.MAX_VALUE;
-    for (int i = 0; i < dataDirList.size(); i++) {
-      long space = CommonUtils.getOccupiedSpace(dataDirList.get(i));
-      if (minOccupied > space) {
-        index = i;
-        minOccupied = space;
-      }
-    }
-    return index;
-  }
-
-  @Test
-  public void testRandomOnDiskUsableSpaceStrategy()
-      throws DiskSpaceInsufficientException {
-    RandomOnDiskUsableSpaceStrategy randomOnDiskUsableSpaceStrategy = new RandomOnDiskUsableSpaceStrategy();
-    randomOnDiskUsableSpaceStrategy.setFolders(dataDirList);
-
-    for (int i = 0; i < dataDirList.size(); i++) {
-      assertFalse(fullDirIndexSet.contains(randomOnDiskUsableSpaceStrategy.nextFolderIndex()));
-    }
-
-    int newFullIndex = randomOnDiskUsableSpaceStrategy.nextFolderIndex();
-    PowerMockito.when(CommonUtils.getUsableSpace(dataDirList.get(newFullIndex))).thenReturn(0L);
-    for (int i = 0; i < dataDirList.size(); i++) {
-      int index = randomOnDiskUsableSpaceStrategy.nextFolderIndex();
-      assertFalse(fullDirIndexSet.contains(index));
-      assertTrue(newFullIndex != index);
-    }
-  }
-
-  @Test
-  public void testAllDiskFull() {
-    for (int i = 0; i < dataDirList.size(); i++) {
-      PowerMockito.when(CommonUtils.hasSpace(dataDirList.get(i))).thenReturn(false);
-    }
-
-    SequenceStrategy sequenceStrategy = new SequenceStrategy();
-    try {
-      sequenceStrategy.setFolders(dataDirList);
-      fail();
-    } catch (DiskSpaceInsufficientException e) {
-    }
-
-    MaxDiskUsableSpaceFirstStrategy maxDiskUsableSpaceFirstStrategy = new MaxDiskUsableSpaceFirstStrategy();
-    try {
-      maxDiskUsableSpaceFirstStrategy.setFolders(dataDirList);
-      fail();
-    } catch (DiskSpaceInsufficientException e) {
-    }
-
-    MinFolderOccupiedSpaceFirstStrategy minFolderOccupiedSpaceFirstStrategy = new MinFolderOccupiedSpaceFirstStrategy();
-    try {
-      minFolderOccupiedSpaceFirstStrategy.setFolders(dataDirList);
-      fail();
-    } catch (DiskSpaceInsufficientException e) {
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/cost/statistic/PerformanceStatTest.java b/server/src/test/java/org/apache/iotdb/db/cost/statistic/PerformanceStatTest.java
deleted file mode 100644
index 8381eb4..0000000
--- a/server/src/test/java/org/apache/iotdb/db/cost/statistic/PerformanceStatTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.cost.statistic;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.StartupException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PerformanceStatTest {
-
-  private static final Logger LOGGER = LoggerFactory.getLogger(PerformanceStatTest.class);
-
-  @Before
-  public void setUp() {
-    IoTDBDescriptor.getInstance().getConfig().setEnablePerformanceStat(true);
-  }
-
-  @After
-  public void tearDown() {
-    IoTDBDescriptor.getInstance().getConfig().setEnablePerformanceStat(false);
-  }
-
-  @Test
-  public void test() {
-    Measurement measurement = Measurement.INSTANCE;
-    Operation operation = Operation.EXECUTE_JDBC_BATCH;
-    measurement.addOperationLatency(operation, System.currentTimeMillis());
-    measurement.addOperationLatency(operation,
-        System.currentTimeMillis() - 8000000);
-
-    long batchOpCnt = measurement.getOperationCnt()[operation.ordinal()];
-    Assert.assertEquals(0L, batchOpCnt);
-    try {
-      measurement.start();
-      measurement.startContinuousPrintStatistics();
-      measurement.addOperationLatency(operation, System.currentTimeMillis());
-      measurement
-          .addOperationLatency(operation, System.currentTimeMillis() - 8000000);
-      Thread.currentThread().sleep(1000);
-      batchOpCnt = measurement.getOperationCnt()[operation.ordinal()];
-      Assert.assertEquals(2L, batchOpCnt);
-      measurement.stopPrintStatistic();
-      measurement.stopPrintStatistic();
-      measurement.stopPrintStatistic();
-      LOGGER.info("After stopPrintStatistic!");
-      Thread.currentThread().sleep(1000);
-      measurement.clearStatisticalState();
-      batchOpCnt = measurement.getOperationCnt()[operation.ordinal()];
-      Assert.assertEquals(0L, batchOpCnt);
-      measurement.startContinuousPrintStatistics();
-      LOGGER.info("ReStart!");
-      Thread.currentThread().sleep(1000);
-      measurement.startContinuousPrintStatistics();
-      LOGGER.info("ReStart2!");
-      Thread.currentThread().sleep(1000);
-      measurement.stopPrintStatistic();
-      LOGGER.info("After stopStatistic2!");
-    } catch (Exception e) {
-      LOGGER.error("find error in stat performance, the message is {}", e.getMessage());
-    } finally {
-      measurement.stop();
-    }
-  }
-
-  @Test
-  public void testSwitch() {
-    Measurement measurement = Measurement.INSTANCE;
-    try {
-      measurement.start();
-      measurement.startStatistics();
-      measurement.startStatistics();
-      measurement.startContinuousPrintStatistics();
-      measurement.stopPrintStatistic();
-      measurement.stopStatistic();
-      measurement.clearStatisticalState();
-      measurement.startPrintStatisticsOnce();
-      measurement.startContinuousPrintStatistics();
-      measurement.startStatistics();
-    } catch (StartupException e) {
-      e.printStackTrace();
-    } finally {
-      measurement.stop();
-    }
-
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java b/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java
deleted file mode 100644
index f4d9a08..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/MetadataManagerHelper.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine;
-
-import org.apache.iotdb.db.metadata.MManager;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.service.IoTDB;
-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 java.util.Collections;
-
-public class MetadataManagerHelper {
-
-  public static void initMetadata() {
-    MManager mmanager = IoTDB.metaManager;
-    mmanager.init();
-    try {
-      mmanager.setStorageGroup(new PartialPath("root.vehicle.d0"));
-      mmanager.setStorageGroup(new PartialPath("root.vehicle.d1"));
-      mmanager.setStorageGroup(new PartialPath("root.vehicle.d2"));
-
-      CompressionType compressionType = TSFileDescriptor.getInstance().getConfig().getCompressor();
-
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s0"), TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s1"), TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s2"), TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s3"), TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s4"), TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d0.s5"), TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN, compressionType,
-          Collections.emptyMap());
-
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s0"), TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s1"), TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s2"), TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s3"), TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s4"), TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d1.s5"), TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s0"), TSDataType.valueOf("INT32"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s1"), TSDataType.valueOf("INT64"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s2"), TSDataType.valueOf("FLOAT"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s3"), TSDataType.valueOf("DOUBLE"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s4"), TSDataType.valueOf("BOOLEAN"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-      mmanager.createTimeseries(new PartialPath("root.vehicle.d2.s5"), TSDataType.valueOf("TEXT"),
-          TSEncoding.PLAIN, compressionType, Collections.emptyMap());
-
-    } catch (Exception e) {
-      throw new RuntimeException("Initialize the metadata manager failed", e);
-    }
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java b/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
deleted file mode 100644
index 1b1135e..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/cache/ChunkMetadataCacheTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.cache;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.conf.adapter.ActiveTimeSeriesCounter;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.MetadataManagerHelper;
-import org.apache.iotdb.db.engine.flush.TsFileFlushPolicy.DirectFlushPolicy;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.engine.storagegroup.StorageGroupProcessor;
-import org.apache.iotdb.db.engine.storagegroup.TsFileProcessor;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.metadata.mnode.MNode;
-import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.control.FileReaderManager;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ChunkMetadataCacheTest {
-
-  private QueryContext context = EnvironmentUtils.TEST_QUERY_CONTEXT;
-
-  private String storageGroup = "root.vehicle.d0";
-  private String measurementId0 = "s0";
-  private String measurementId1 = "s1";
-  private String measurementId2 = "s2";
-  private String measurementId3 = "s3";
-  private String measurementId4 = "s4";
-  private String measurementId5 = "s5";
-  private StorageGroupProcessor storageGroupProcessor;
-  private String systemDir = TestConstant.BASE_OUTPUT_PATH.concat("data")
-      .concat(File.separator).concat("info");
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    MetadataManagerHelper.initMetadata();
-    ActiveTimeSeriesCounter.getInstance().init(storageGroup);
-    storageGroupProcessor = new StorageGroupProcessor(systemDir, storageGroup,
-        new DirectFlushPolicy());
-    insertData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    FileReaderManager.getInstance().closeAndRemoveAllOpenedReaders();
-    storageGroupProcessor.syncDeleteDataFiles();
-    EnvironmentUtils.cleanEnv();
-    EnvironmentUtils.cleanDir(systemDir);
-  }
-
-  private void insertOneRecord(long time, int num)
-      throws WriteProcessException, IllegalPathException {
-    TSRecord record = new TSRecord(time, storageGroup);
-    record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId0, String.valueOf(num)));
-    record.addTuple(DataPoint.getDataPoint(TSDataType.INT64, measurementId1, String.valueOf(num)));
-    record.addTuple(DataPoint.getDataPoint(TSDataType.FLOAT, measurementId2, String.valueOf(num)));
-    record.addTuple(DataPoint.getDataPoint(TSDataType.DOUBLE, measurementId3, String.valueOf(num)));
-    record.addTuple(DataPoint.getDataPoint(TSDataType.BOOLEAN, measurementId4, "True"));
-    InsertRowPlan insertRowPlan = new InsertRowPlan(record);
-    storageGroupProcessor.insert(insertRowPlan);
-  }
-
-  protected void insertData() throws IOException, WriteProcessException, IllegalPathException {
-    for (int j = 1; j <= 100; j++) {
-      insertOneRecord(j, j);
-    }
-    for (TsFileProcessor tsFileProcessor : storageGroupProcessor
-        .getWorkSequenceTsFileProcessors()) {
-      tsFileProcessor.syncFlush();
-    }
-
-    for (int j = 10; j >= 1; j--) {
-      insertOneRecord(j, j);
-    }
-    for (int j = 11; j <= 20; j++) {
-      insertOneRecord(j, j);
-    }
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 21; j <= 30; j += 2) {
-      insertOneRecord(j, 0); // will be covered when read
-    }
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 21; j <= 30; j += 2) {
-      insertOneRecord(j, j);
-    }
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-
-    insertOneRecord(2, 100);
-  }
-
-  @Test
-  public void test1() throws IOException, QueryProcessException, IllegalPathException {
-    IoTDBDescriptor.getInstance().getConfig().setMetaDataCacheEnable(false);
-    QueryDataSource queryDataSource = storageGroupProcessor
-        .query(new PartialPath(storageGroup), measurementId5, context, null, null);
-
-    List<TsFileResource> seqResources = queryDataSource.getSeqResources();
-    List<TsFileResource> unseqResources = queryDataSource.getUnseqResources();
-
-    Assert.assertEquals(1, seqResources.size());
-    Assert.assertEquals(3, unseqResources.size());
-    Assert.assertTrue(seqResources.get(0).isClosed());
-    Assert.assertTrue(unseqResources.get(0).isClosed());
-    Assert.assertTrue(unseqResources.get(1).isClosed());
-    Assert.assertTrue(unseqResources.get(2).isClosed());
-
-    List<ChunkMetadata> metaDataList = ChunkMetadataCache.getInstance()
-        .get(seqResources.get(0).getTsFilePath(), new Path(storageGroup, measurementId5));
-    Assert.assertEquals(0, metaDataList.size());
-  }
-
-  @Test
-  public void test2() throws IOException, QueryProcessException, IllegalPathException {
-    IoTDBDescriptor.getInstance().getConfig().setMetaDataCacheEnable(true);
-    QueryDataSource queryDataSource = storageGroupProcessor
-        .query(new PartialPath(storageGroup), measurementId5, context, null, null);
-
-    List<TsFileResource> seqResources = queryDataSource.getSeqResources();
-    List<TsFileResource> unseqResources = queryDataSource.getUnseqResources();
-
-    Assert.assertEquals(1, seqResources.size());
-    Assert.assertEquals(3, unseqResources.size());
-    Assert.assertTrue(seqResources.get(0).isClosed());
-    Assert.assertTrue(unseqResources.get(0).isClosed());
-    Assert.assertTrue(unseqResources.get(1).isClosed());
-    Assert.assertTrue(unseqResources.get(2).isClosed());
-
-    List<ChunkMetadata> metaDataList = ChunkMetadataCache.getInstance()
-        .get(seqResources.get(0).getTsFilePath(), new Path(storageGroup, measurementId5));
-    Assert.assertEquals(0, metaDataList.size());
-  }
-
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
deleted file mode 100644
index 3dc173a..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableFlushTaskTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.memtable;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import org.apache.iotdb.db.conf.adapter.ActiveTimeSeriesCounter;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.MetadataManagerHelper;
-import org.apache.iotdb.db.engine.flush.MemTableFlushTask;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
-import org.apache.iotdb.tsfile.fileSystem.FSFactoryProducer;
-import org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MemTableFlushTaskTest {
-
-  private RestorableTsFileIOWriter writer;
-  private String storageGroup = "storage_group1";
-  private String filePath = TestConstant.OUTPUT_DATA_DIR
-      .concat("testUnsealedTsFileProcessor.tsfile");
-  private IMemTable memTable;
-  private long startTime = 1;
-  private long endTime = 100;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    MetadataManagerHelper.initMetadata();
-    ActiveTimeSeriesCounter.getInstance().init(storageGroup);
-    writer = new RestorableTsFileIOWriter(FSFactoryProducer.getFSFactory().getFile(filePath));
-    memTable = new PrimitiveMemTable();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    writer.close();
-    EnvironmentUtils.cleanEnv();
-    EnvironmentUtils.cleanDir(TestConstant.OUTPUT_DATA_DIR);
-  }
-
-  @Test
-  public void testFlushMemTable() throws ExecutionException, InterruptedException, IOException {
-    MemTableTestUtils.produceData(memTable, startTime, endTime, MemTableTestUtils.deviceId0,
-        MemTableTestUtils.measurementId0,
-        MemTableTestUtils.dataType0);
-    MemTableFlushTask memTableFlushTask = new MemTableFlushTask(memTable, writer, storageGroup);
-    assertTrue(writer
-        .getVisibleMetadataList(MemTableTestUtils.deviceId0, MemTableTestUtils.measurementId0,
-            MemTableTestUtils.dataType0).isEmpty());
-    memTableFlushTask.syncFlushMemTable();
-    writer.makeMetadataVisible();
-    assertEquals(1, writer
-        .getVisibleMetadataList(MemTableTestUtils.deviceId0, MemTableTestUtils.measurementId0,
-            MemTableTestUtils.dataType0).size());
-    ChunkMetadata chunkMetaData = writer
-        .getVisibleMetadataList(MemTableTestUtils.deviceId0, MemTableTestUtils.measurementId0,
-            MemTableTestUtils.dataType0).get(0);
-    assertEquals(MemTableTestUtils.measurementId0, chunkMetaData.getMeasurementUid());
-    assertEquals(startTime, chunkMetaData.getStartTime());
-    assertEquals(endTime, chunkMetaData.getEndTime());
-    assertEquals(MemTableTestUtils.dataType0, chunkMetaData.getDataType());
-    assertEquals(endTime - startTime + 1, chunkMetaData.getNumOfPoints());
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTablePoolTest.java b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTablePoolTest.java
deleted file mode 100644
index 5c59d54..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTablePoolTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.memtable;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import org.apache.iotdb.db.rescon.MemTablePool;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MemTablePoolTest {
-
-  private ConcurrentLinkedQueue<IMemTable> memTables;
-  private Thread thread = new ReturnThread();
-  private volatile boolean isFinished = false;
-
-  @Before
-  public void setUp() throws Exception {
-    memTables = new ConcurrentLinkedQueue();
-    thread.start();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    isFinished = true;
-    thread.join();
-  }
-
-  @Test
-  public void testGetAndRelease() {
-    long time = System.currentTimeMillis();
-    for (int i = 0; i < 10; i++) {
-      IMemTable memTable = MemTablePool.getInstance().getAvailableMemTable("test case");
-      memTables.add(memTable);
-    }
-    time -= System.currentTimeMillis();
-    System.out.println("memtable pool use deque and synchronized consume:" + time);
-  }
-
-  class ReturnThread extends Thread {
-
-    @Override
-    public void run() {
-      while (true) {
-        if (isInterrupted()) {
-          break;
-        }
-        IMemTable memTable = memTables.poll();
-        if (memTable == null) {
-          if (isFinished) {
-            break;
-          }
-          try {
-            Thread.sleep(10);
-          } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-          }
-          continue;
-        }
-        memTables.remove(memTable);
-        MemTablePool.getInstance().putBack(memTable, "test case");
-      }
-    }
-  }
-
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableTestUtils.java b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableTestUtils.java
deleted file mode 100644
index 06cf241..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemTableTestUtils.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.memtable;
-
-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.write.schema.Schema;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-
-public class MemTableTestUtils {
-
-  public static String deviceId0 = "d0";
-
-  public static String measurementId0 = "s0";
-
-  public static TSDataType dataType0 = TSDataType.INT32;
-  private static Schema schema = new Schema();
-
-  static {
-    schema
-        .registerTimeseries(new Path(deviceId0, measurementId0), 
-            new MeasurementSchema(measurementId0, dataType0, TSEncoding.PLAIN));
-  }
-
-  public static void produceData(IMemTable iMemTable, long startTime, long endTime, String deviceId,
-      String measurementId, TSDataType dataType) {
-    if (startTime > endTime) {
-      throw new RuntimeException(String.format("start time %d > end time %d", startTime, endTime));
-    }
-    for (long l = startTime; l <= endTime; l++) {
-      iMemTable.write(deviceId, measurementId, new MeasurementSchema(measurementId, dataType, TSEncoding.PLAIN), l, (int)l);
-    }
-  }
-
-  public static Schema getSchema() {
-    return schema;
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemtableBenchmark.java b/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemtableBenchmark.java
deleted file mode 100644
index 5d0e640..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/memtable/MemtableBenchmark.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.memtable;
-
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-
-/**
- * Memtable insert benchmark. Bench the Memtable and get its performance.
- */
-public class MemtableBenchmark {
-
-  private static String deviceId = "d0";
-  private static int numOfMeasurement = 10000;
-  private static int numOfPoint = 1000;
-
-  private static String[] measurementId = new String[numOfMeasurement];
-  private static TSDataType tsDataType = TSDataType.INT64;
-
-  static {
-    for (int i = 0; i < numOfMeasurement; i++) {
-      measurementId[i] = "m" + i;
-    }
-  }
-
-  public static void main(String[] args) {
-    IMemTable memTable = new PrimitiveMemTable();
-    final long startTime = System.currentTimeMillis();
-    // cpu not locality
-    for (int i = 0; i < numOfPoint; i++) {
-      for (int j = 0; j < numOfMeasurement; j++) {
-        memTable.write(deviceId, measurementId[j], new MeasurementSchema(measurementId[j], tsDataType, TSEncoding.PLAIN), System.nanoTime(),
-            String.valueOf(System.currentTimeMillis()));
-      }
-    }
-
-    final long endTime = System.currentTimeMillis();
-    System.out.println(String.format(
-        "Num of time series: %d, " + "Num of points for each time series: %d, "
-            + "The total time: %d ms. ",
-        numOfMeasurement, numOfPoint, endTime - startTime));
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/memtable/PrimitiveMemTableTest.java b/server/src/test/java/org/apache/iotdb/db/engine/memtable/PrimitiveMemTableTest.java
deleted file mode 100644
index 22fad69..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/memtable/PrimitiveMemTableTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.memtable;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Random;
-import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.utils.MathUtils;
-import org.apache.iotdb.db.utils.datastructure.TVList;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.reader.IPointReader;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.utils.Binary;
-import org.apache.iotdb.tsfile.utils.TsPrimitiveType;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class PrimitiveMemTableTest {
-
-  double delta;
-
-  @Before
-  public void setUp() {
-    delta = Math.pow(0.1, TSFileDescriptor.getInstance().getConfig().getFloatPrecision());
-  }
-
-  @Test
-  public void memSeriesSortIteratorTest() throws IOException {
-    TSDataType dataType = TSDataType.INT32;
-    WritableMemChunk series = new WritableMemChunk(new MeasurementSchema("s1", dataType, TSEncoding.PLAIN), TVList.newList(dataType));
-    int count = 1000;
-    for (int i = 0; i < count; i++) {
-      series.write(i, i);
-    }
-    IPointReader it = series.getSortedTVList().getIterator();
-    int i = 0;
-    while (it.hasNextTimeValuePair()) {
-      Assert.assertEquals(i, it.nextTimeValuePair().getTimestamp());
-      i++;
-    }
-    Assert.assertEquals(count, i);
-  }
-
-  @Test
-  public void simpleTest() throws IOException, QueryProcessException {
-    IMemTable memTable = new PrimitiveMemTable();
-    int count = 10;
-    String deviceId = "d1";
-    String measurementId[] = new String[count];
-    for (int i = 0; i < measurementId.length; i++) {
-      measurementId[i] = "s" + i;
-    }
-
-    int dataSize = 10000;
-    for (int i = 0; i < dataSize; i++) {
-      memTable.write(deviceId, measurementId[0], new MeasurementSchema(measurementId[0], TSDataType.INT32, TSEncoding.PLAIN), dataSize - i - 1,
-          i + 10);
-    }
-    for (int i = 0; i < dataSize; i++) {
-      memTable.write(deviceId, measurementId[0], new MeasurementSchema(measurementId[0], TSDataType.INT32, TSEncoding.PLAIN), i, i);
-    }
-    ReadOnlyMemChunk memChunk = memTable
-        .query(deviceId, measurementId[0], TSDataType.INT32, TSEncoding.RLE, Collections.emptyMap(),
-            Long.MIN_VALUE);
-    IPointReader iterator = memChunk.getPointReader();
-    for (int i = 0; i < dataSize; i++) {
-      iterator.hasNextTimeValuePair();
-      TimeValuePair timeValuePair = iterator.nextTimeValuePair();
-      Assert.assertEquals(i, timeValuePair.getTimestamp());
-      Assert.assertEquals(i, timeValuePair.getValue().getValue());
-    }
-  }
-
-  private void write(IMemTable memTable, String deviceId, String sensorId, TSDataType dataType,
-      TSEncoding encoding, int size) throws IOException, QueryProcessException {
-    TimeValuePair[] ret = genTimeValuePair(size, dataType);
-
-    for (TimeValuePair aRet : ret) {
-      memTable.write(deviceId, sensorId, new MeasurementSchema(sensorId, dataType, encoding), aRet.getTimestamp(),
-          aRet.getValue().getValue());
-    }
-    IPointReader tvPair = memTable
-        .query(deviceId, sensorId, dataType, encoding, Collections.emptyMap(), Long.MIN_VALUE)
-        .getPointReader();
-    Arrays.sort(ret);
-    TimeValuePair last = null;
-    for (int i = 0; i < ret.length; i++) {
-      while (last != null && (i < ret.length && last.getTimestamp() == ret[i].getTimestamp())) {
-        i++;
-      }
-      if (i >= ret.length) {
-        break;
-      }
-      TimeValuePair pair = ret[i];
-      last = pair;
-      tvPair.hasNextTimeValuePair();
-      TimeValuePair next = tvPair.nextTimeValuePair();
-      Assert.assertEquals(pair.getTimestamp(), next.getTimestamp());
-      if (dataType == TSDataType.DOUBLE) {
-        Assert.assertEquals(pair.getValue().getDouble(),
-            MathUtils.roundWithGivenPrecision(next.getValue().getDouble()), delta);
-      } else if (dataType == TSDataType.FLOAT) {
-        float expected = pair.getValue().getFloat();
-        float actual = MathUtils.roundWithGivenPrecision(next.getValue().getFloat());
-        Assert.assertEquals(expected, actual, delta + Float.MIN_NORMAL);
-      } else {
-        Assert.assertEquals(pair.getValue(), next.getValue());
-      }
-    }
-  }
-
-  @Test
-  public void testFloatType() throws IOException, QueryProcessException {
-    IMemTable memTable = new PrimitiveMemTable();
-    String deviceId = "d1";
-    int size = 100;
-    write(memTable, deviceId, "s1", TSDataType.FLOAT, TSEncoding.RLE, size);
-  }
-
-  @Test
-  public void testAllType() throws IOException, QueryProcessException {
-    IMemTable memTable = new PrimitiveMemTable();
-    int count = 10;
-    String deviceId = "d1";
-    String measurementId[] = new String[count];
-    for (int i = 0; i < measurementId.length; i++) {
-      measurementId[i] = "s" + i;
-    }
-    int index = 0;
-
-    int size = 10000;
-    write(memTable, deviceId, measurementId[index++], TSDataType.BOOLEAN, TSEncoding.RLE, size);
-    write(memTable, deviceId, measurementId[index++], TSDataType.INT32, TSEncoding.RLE, size);
-    write(memTable, deviceId, measurementId[index++], TSDataType.INT64, TSEncoding.RLE, size);
-    write(memTable, deviceId, measurementId[index++], TSDataType.FLOAT, TSEncoding.RLE, size);
-    write(memTable, deviceId, measurementId[index++], TSDataType.DOUBLE, TSEncoding.RLE, size);
-    write(memTable, deviceId, measurementId[index++], TSDataType.TEXT, TSEncoding.PLAIN, size);
-  }
-
-  private TimeValuePair[] genTimeValuePair(int size, TSDataType dataType) {
-    TimeValuePair[] ret = new TimeValuePair[size];
-    Random rand = new Random();
-    for (int i = 0; i < size; i++) {
-      switch (dataType) {
-        case BOOLEAN:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, true));
-          break;
-        case INT32:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, rand.nextInt()));
-          break;
-        case INT64:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, rand.nextLong()));
-          break;
-        case FLOAT:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, rand.nextFloat()));
-          break;
-        case DOUBLE:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, rand.nextDouble()));
-          break;
-        case TEXT:
-          ret[i] = new TimeValuePair(rand.nextLong(),
-              TsPrimitiveType.getByType(dataType, new Binary("a" + rand.nextDouble())));
-          break;
-        default:
-          throw new UnSupportedDataTypeException("Unsupported data type:" + dataType);
-      }
-    }
-    return ret;
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java
deleted file mode 100644
index 1e50590..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxFileMergeFileSelectorTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.List;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.selector.MaxFileMergeFileSelector;
-import org.apache.iotdb.db.engine.merge.selector.IMergeFileSelector;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.MergeException;
-import org.junit.Test;
-
-public class MaxFileMergeFileSelectorTest extends MergeTest {
-
-  @Test
-  public void testFullSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources, seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    resource.clear();
-
-    resource = new MergeResource(seqResources.subList(0, 1), unseqResources);
-    mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    resource.clear();
-
-    resource = new MergeResource(seqResources, unseqResources.subList(0, 1));
-    mergeFileSelector = new MaxFileMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources.subList(0, 1), unseqSelected);
-    resource.clear();
-  }
-
-  @Test
-  public void testNonSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, 1);
-    List[] result = mergeFileSelector.select();
-    assertEquals(0, result.length);
-    resource.clear();
-  }
-
-  @Test
-  public void testRestrictedSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    IMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource, 400000);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 3), seqSelected);
-    assertEquals(unseqResources.subList(0, 3), unseqSelected);
-    resource.clear();
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxSeriesMergeFileSelectorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxSeriesMergeFileSelectorTest.java
deleted file mode 100644
index 2a876d1..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MaxSeriesMergeFileSelectorTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.util.List;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.selector.MaxSeriesMergeFileSelector;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.MergeException;
-import org.junit.Test;
-
-public class MaxSeriesMergeFileSelectorTest extends MergeTest {
-
-  @Test
-  public void testFullSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    MaxSeriesMergeFileSelector mergeFileSelector = new MaxSeriesMergeFileSelector(resource,
-        Long.MAX_VALUE);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources, seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    assertEquals(MaxSeriesMergeFileSelector.MAX_SERIES_NUM,
-        mergeFileSelector.getConcurrentMergeNum());
-    resource.clear();
-
-    resource = new MergeResource(seqResources.subList(0, 1), unseqResources);
-    mergeFileSelector = new MaxSeriesMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources, unseqSelected);
-    assertEquals(MaxSeriesMergeFileSelector.MAX_SERIES_NUM,
-        mergeFileSelector.getConcurrentMergeNum());
-    resource.clear();
-
-    resource = new MergeResource(seqResources, unseqResources.subList(0, 1));
-    mergeFileSelector = new MaxSeriesMergeFileSelector(resource, Long.MAX_VALUE);
-    result = mergeFileSelector.select();
-    seqSelected = result[0];
-    unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources.subList(0, 1), unseqSelected);
-    assertEquals(MaxSeriesMergeFileSelector.MAX_SERIES_NUM,
-        mergeFileSelector.getConcurrentMergeNum());
-    resource.clear();
-  }
-
-  @Test
-  public void testNonSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    MaxSeriesMergeFileSelector mergeFileSelector = new MaxSeriesMergeFileSelector(resource, 1);
-    List[] result = mergeFileSelector.select();
-    assertEquals(0, result.length);
-    assertEquals(0, mergeFileSelector.getConcurrentMergeNum());
-    resource.clear();
-  }
-
-  @Test
-  public void testRestrictedSelection() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    MaxSeriesMergeFileSelector mergeFileSelector = new MaxSeriesMergeFileSelector(resource, 400000);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 3), seqSelected);
-    assertEquals(unseqResources.subList(0, 3), unseqSelected);
-    assertEquals(MaxSeriesMergeFileSelector.MAX_SERIES_NUM,
-        mergeFileSelector.getConcurrentMergeNum());
-    resource.clear();
-  }
-
-  @Test
-  public void testRestrictedSelection2() throws MergeException, IOException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    MaxSeriesMergeFileSelector mergeFileSelector = new MaxSeriesMergeFileSelector(resource,
-        100000);
-    List[] result = mergeFileSelector.select();
-    List<TsFileResource> seqSelected = result[0];
-    List<TsFileResource> unseqSelected = result[1];
-    assertEquals(seqResources.subList(0, 1), seqSelected);
-    assertEquals(unseqResources.subList(0, 1), unseqSelected);
-    resource.clear();
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeLogTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeLogTest.java
deleted file mode 100644
index 6633ae6..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeLogTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.task.MergeTask;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MergeLogTest extends MergeTest {
-
-  File tempSGDir;
-
-  @Before
-  public void setUp() throws IOException, WriteProcessException, MetadataException {
-    super.setUp();
-    tempSGDir = new File(TestConstant.BASE_OUTPUT_PATH.concat("tempSG"));
-    tempSGDir.mkdirs();
-  }
-
-  @After
-  public void tearDown() throws IOException, StorageEngineException {
-    super.tearDown();
-    FileUtils.deleteDirectory(tempSGDir);FileUtils.deleteDirectory(tempSGDir);
-  }
-
-  @Test
-  public void testMergeLog() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setChunkMergePointThreshold(Integer.MAX_VALUE);
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources.subList(0, 1), unseqResources.subList(0, 1)),
-            tempSGDir.getPath(), this::testCallBack, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-  }
-
-  private void testCallBack(List<TsFileResource> seqFiles, List<TsFileResource> unseqFiles,
-      File mergeLog) {
-    int lineCnt = 0;
-    try (BufferedReader bufferedReader = new BufferedReader(new FileReader(mergeLog))) {
-      while (bufferedReader.readLine() != null) {
-        lineCnt ++;
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-    assertEquals(309, lineCnt);
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeManagerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeManagerTest.java
deleted file mode 100644
index efd4b68..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeManagerTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.google.common.util.concurrent.RateLimiter;
-import java.util.PriorityQueue;
-import org.apache.iotdb.db.engine.merge.manage.MergeManager;
-import org.apache.iotdb.db.engine.merge.task.MergeMultiChunkTask;
-import org.apache.iotdb.db.engine.merge.task.MergeTask;
-import org.junit.Test;
-
-public class MergeManagerTest extends MergeTest {
-
-  @Test
-  public void testRateLimiter() {
-    RateLimiter compactionRateLimiter = MergeManager.getINSTANCE().getMergeRateLimiter();
-    long startTime = System.currentTimeMillis();
-    MergeManager.mergeRateLimiterAcquire(compactionRateLimiter, 160 * 1024 * 1024L);
-    assertTrue((System.currentTimeMillis() - startTime) < 1000);
-    MergeManager.mergeRateLimiterAcquire(compactionRateLimiter, 16 * 1024 * 1024L);
-    assertTrue((System.currentTimeMillis() - startTime) > 9000);
-  }
-
-
-  @Test
-  public void testGenMergeReport() {
-    FakedMergeMultiChunkTask chunkTask = new FakedMergeMultiChunkTask();
-    for (int i = 0; i < 5; i++) {
-      MergeManager.getINSTANCE().submitMainTask(new FakedMainMergeTask(i));
-      MergeManager.getINSTANCE().submitChunkSubTask(chunkTask.createSubTask(i));
-    }
-
-    String report = MergeManager.getINSTANCE().genMergeTaskReport();
-    checkReport(report);
-  }
-
-  @Test
-  public void testAbortMerge() {
-    FakedMergeMultiChunkTask chunkTask = new FakedMergeMultiChunkTask();
-    for (int i = 0; i < 5; i++) {
-      MergeManager.getINSTANCE().submitMainTask(new FakedMainMergeTask(i));
-      MergeManager.getINSTANCE().submitChunkSubTask(chunkTask.createSubTask(i));
-    }
-
-    MergeManager.getINSTANCE().abortMerge("non-exist");
-    String report = MergeManager.getINSTANCE().genMergeTaskReport();
-
-    checkReport(report);
-
-    MergeManager.getINSTANCE().abortMerge("test");
-    report = MergeManager.getINSTANCE().genMergeTaskReport();
-    assertEquals(String.format("Main tasks:%n"
-        + "Sub tasks:%n"), report);
-  }
-
-  private void checkReport(String report) {
-    String[] split = report.split(System.lineSeparator());
-    assertEquals("Main tasks:", split[0]);
-    assertEquals("\tStorage group: test", split[1]);
-    for (int i = 0; i < 5; i++) {
-      assertTrue(split[2 + i].contains("task" + i));
-      assertTrue(split[2 + i].contains("0,"));
-      assertTrue(split[2 + i].contains("done:false"));
-      assertTrue(split[2 + i].contains("cancelled:false"));
-    }
-    assertEquals("Sub tasks:", split[7]);
-    assertEquals("\tStorage group: test", split[8]);
-    for (int i = 0; i < 5; i++) {
-      assertTrue(split[9 + i].contains("task" + i));
-      assertTrue(split[9 + i].contains("0,"));
-      assertTrue(split[9 + i].contains("done:false"));
-      assertTrue(split[9 + i].contains("cancelled:false"));
-    }
-  }
-
-  static class FakedMainMergeTask extends MergeTask {
-
-    private int serialNum;
-    private String progress = "0";
-
-    public FakedMainMergeTask(int serialNum) {
-      super(null, null, null, null, false,
-          0,
-          null);
-      this.serialNum = serialNum;
-    }
-
-    @Override
-    public Void call() {
-      while (!Thread.currentThread().isInterrupted()) {
-        // wait until interrupt
-      }
-      progress = "1";
-      return null;
-    }
-
-    @Override
-    public String getStorageGroupName() {
-      return "test";
-    }
-
-    @Override
-    public String getProgress() {
-      return progress;
-    }
-
-    @Override
-    public String getTaskName() {
-      return "task" + serialNum;
-    }
-  }
-
-  static class FakedMergeMultiChunkTask extends MergeMultiChunkTask {
-
-    public FakedMergeMultiChunkTask() {
-      super(null, null, null, null, false, null,
-          0, null);
-    }
-
-    public MergeChunkHeapTask createSubTask(int serialNum) {
-      return new FakedSubMergeTask(serialNum);
-    }
-
-    class FakedSubMergeTask extends MergeChunkHeapTask {
-
-      private int serialNum;
-      private String progress = "0";
-
-      public FakedSubMergeTask(int serialNum) {
-        super(new PriorityQueue<>(), null, null, null, null, null, null, false, serialNum);
-        this.serialNum = serialNum;
-      }
-
-      @Override
-      public Void call() {
-        while (!Thread.currentThread().isInterrupted()) {
-          // wait until interrupt
-        }
-        progress = "1";
-        return null;
-      }
-
-      @Override
-      public String getStorageGroupName() {
-        return "test";
-      }
-
-      @Override
-      public String getProgress() {
-        return progress;
-      }
-
-      @Override
-      public String getTaskName() {
-        return "task" + serialNum;
-      }
-    }
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeOverLapTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeOverLapTest.java
deleted file mode 100644
index d841fd0..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeOverLapTest.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.task.MergeTask;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-import org.apache.iotdb.tsfile.read.common.BatchData;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
-import org.apache.iotdb.tsfile.write.TsFileWriter;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MergeOverLapTest extends MergeTest {
-
-  private File tempSGDir;
-
-  @Before
-  public void setUp()
-      throws IOException, WriteProcessException, MetadataException {
-    ptNum = 1000;
-    super.setUp();
-    tempSGDir = new File(TestConstant.BASE_OUTPUT_PATH.concat("tempSG"));
-    tempSGDir.mkdirs();
-  }
-
-  @After
-  public void tearDown() throws IOException, StorageEngineException {
-    super.tearDown();
-    FileUtils.deleteDirectory(tempSGDir);
-  }
-
-  @Override
-  void prepareFiles(int seqFileNum, int unseqFileNum) throws IOException, WriteProcessException {
-    for (int i = 0; i < seqFileNum; i++) {
-      File file = new File(TestConstant.BASE_OUTPUT_PATH.concat(
-          i + "seq" + IoTDBConstant.FILE_NAME_SEPARATOR + i + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-              + ".tsfile"));
-      TsFileResource tsFileResource = new TsFileResource(file);
-      tsFileResource.setClosed(true);
-      tsFileResource.setHistoricalVersions(Collections.singleton((long) i));
-      seqResources.add(tsFileResource);
-      prepareFile(tsFileResource, i * ptNum, ptNum, 0);
-    }
-    for (int i = 0; i < unseqFileNum; i++) {
-      File file = new File(TestConstant.BASE_OUTPUT_PATH.concat(
-          i + "unseq" + IoTDBConstant.FILE_NAME_SEPARATOR + i
-              + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-              + ".tsfile"));
-      TsFileResource tsFileResource = new TsFileResource(file);
-      tsFileResource.setClosed(true);
-      tsFileResource.setHistoricalVersions(Collections.singleton((long) (i + seqFileNum)));
-      unseqResources.add(tsFileResource);
-      prepareUnseqFile(tsFileResource, i * ptNum, ptNum * (i + 1) / unseqFileNum, 10000);
-    }
-    File file = new File(TestConstant.BASE_OUTPUT_PATH.concat(
-        unseqFileNum + "unseq" + IoTDBConstant.FILE_NAME_SEPARATOR + unseqFileNum
-            + IoTDBConstant.FILE_NAME_SEPARATOR + unseqFileNum
-            + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-            + ".tsfile"));
-    TsFileResource tsFileResource = new TsFileResource(file);
-    tsFileResource.setClosed(true);
-    tsFileResource.setHistoricalVersions(Collections.singleton((long) (seqFileNum + unseqFileNum)));
-    unseqResources.add(tsFileResource);
-    prepareUnseqFile(tsFileResource, 0, ptNum * unseqFileNum, 20000);
-  }
-
-  private void prepareUnseqFile(TsFileResource tsFileResource, long timeOffset, long ptNum,
-      long valueOffset)
-      throws IOException, WriteProcessException {
-    TsFileWriter fileWriter = new TsFileWriter(tsFileResource.getTsFile());
-    for (String deviceId : deviceIds) {
-      for (MeasurementSchema measurementSchema : measurementSchemas) {
-        fileWriter.registerTimeseries(
-            new Path(deviceId, measurementSchema.getMeasurementId()), measurementSchema);
-      }
-    }
-    for (long i = timeOffset; i < timeOffset + ptNum; i++) {
-      for (int j = 0; j < deviceNum; j++) {
-        TSRecord record = new TSRecord(i, deviceIds[j]);
-        for (int k = 0; k < measurementNum; k++) {
-          record.addTuple(DataPoint.getDataPoint(measurementSchemas[k].getType(),
-              measurementSchemas[k].getMeasurementId(), String.valueOf(i + valueOffset)));
-        }
-        fileWriter.write(record);
-        tsFileResource.updateStartTime(deviceIds[j], i);
-        tsFileResource.updateEndTime(deviceIds[j], i);
-      }
-      // insert overlapping tuples
-      if ((i + 1) % 100 == 0) {
-        for (int j = 0; j < deviceNum; j++) {
-          TSRecord record = new TSRecord(i, deviceIds[j]);
-          for (int k = 0; k < measurementNum; k++) {
-            record.addTuple(DataPoint.getDataPoint(measurementSchemas[k].getType(),
-                measurementSchemas[k].getMeasurementId(), String.valueOf(i + valueOffset)));
-          }
-          fileWriter.write(record);
-          tsFileResource.updateStartTime(deviceIds[j], i);
-          tsFileResource.updateEndTime(deviceIds[j], i);
-        }
-      }
-      if ((i + 1) % flushInterval == 0) {
-        fileWriter.flushAllChunkGroups();
-      }
-    }
-    fileWriter.close();
-  }
-
-  @Test
-  public void testFullMerge() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources), tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test",
-            true, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> resources = new ArrayList<>();
-    resources.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        resources, new ArrayList<>(), null, null, true);
-    int cnt = 0;
-    try {
-      while (tsFilesReader.hasNextBatch()) {
-        BatchData batchData = tsFilesReader.nextBatch();
-        for (int i = 0; i < batchData.length(); i++) {
-          cnt++;
-          assertEquals(batchData.getTimeByIndex(i) + 20000.0, batchData.getDoubleByIndex(i), 0.001);
-        }
-      }
-      assertEquals(1000, cnt);
-    } finally {
-      tsFilesReader.close();
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergePerfTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergePerfTest.java
deleted file mode 100644
index 3fd59ef..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergePerfTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.task.MergeTask;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MergePerfTest extends MergeTest{
-
-  private long timeConsumption;
-  private boolean fullMerge;
-  private File tempSGDir;
-
-  public void test() throws Exception {
-    IoTDB.metaManager.init();
-    tempSGDir = new File(TestConstant.BASE_OUTPUT_PATH.concat("tempSG"));
-    tempSGDir.mkdirs();
-    setUp();
-    timeConsumption = System.currentTimeMillis();
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    resource.setCacheDeviceMeta(true);
-    MergeTask mergeTask =
-        new MergeTask(resource, tempSGDir.getPath(), (k, v
-            , l) -> {}, "test", fullMerge, 100, MERGE_TEST_SG);
-    mergeTask.call();
-    timeConsumption = System.currentTimeMillis() - timeConsumption;
-    tearDown();
-    FileUtils.deleteDirectory(tempSGDir);
-  }
-
-  public static void main(String[] args) throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setChunkMergePointThreshold(-1);
-
-    List<Long> timeConsumptions = new ArrayList<>();
-    MergePerfTest perfTest = new MergePerfTest();
-
-    perfTest.seqFileNum = 5;
-    perfTest.unseqFileNum = 5;
-    perfTest.measurementNum = 100;
-    perfTest.deviceNum = 10;
-    perfTest.ptNum = 5000;
-    perfTest.flushInterval = 1000;
-    perfTest.fullMerge = true;
-    perfTest.encoding = TSEncoding.PLAIN;
-
-    for (int i = 0; i < 1; i++) {
-      // cache warm-up
-      perfTest.test();
-    }
-
-//    int[] intParameters = new int[10];
-//    for (int i = 1; i <= 10; i++) {
-//      intParameters[i-1] = i;
-//    }
-//    for (int param : intParameters) {
-//      perfTest.unseqFileNum = param;
-//      perfTest.test();
-//      timeConsumptions.add(perfTest.timeConsumption);
-//    }
-//    long[] longParameters = new long[10];
-//    for (int i = 1; i <= 10; i++) {
-//      longParameters[i-1] = i * 200;
-//    }
-//    for (long param : longParameters) {
-//      perfTest.flushInterval = param;
-//      perfTest.test();
-//      timeConsumptions.add(perfTest.timeConsumption);
-//    }
-//    double[] doubleParameters = new double[10];
-//    for (int i = 1; i <= 10; i++) {
-//      doubleParameters[i-1] = 0.1 * i;
-//    }
-//    for (double param : doubleParameters) {
-//      perfTest.unseqRatio = param;
-//      perfTest.test();
-//      timeConsumptions.add(perfTest.timeConsumption);
-//    }
-
-    System.out.println(timeConsumptions);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTaskTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTaskTest.java
deleted file mode 100644
index 8f4f691..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTaskTest.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.task.MergeTask;
-import org.apache.iotdb.db.engine.modification.Deletion;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-import org.apache.iotdb.tsfile.read.common.BatchData;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MergeTaskTest extends MergeTest {
-
-  private File tempSGDir;
-
-  @Before
-  public void setUp() throws IOException, WriteProcessException, MetadataException, MetadataException {
-    super.setUp();
-    tempSGDir = new File(TestConstant.BASE_OUTPUT_PATH.concat("tempSG"));
-    tempSGDir.mkdirs();
-  }
-
-  @After
-  public void tearDown() throws IOException, StorageEngineException {
-    super.tearDown();
-    FileUtils.deleteDirectory(tempSGDir);
-  }
-
-  @Test
-  public void testMerge() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources), tempSGDir.getPath(), (k, v
-            , l) -> {
-        }, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> list = new ArrayList<>();
-    list.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        list, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        assertEquals(batchData.getTimeByIndex(i) + 20000.0, batchData.getDoubleByIndex(i), 0.001);
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void testFullMerge() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources), tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test",
-            true, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> list = new ArrayList<>();
-    list.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        list, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        assertEquals(batchData.getTimeByIndex(i) + 20000.0, batchData.getDoubleByIndex(i), 0.001);
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void testChunkNumThreshold() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig().setChunkMergePointThreshold(Integer.MAX_VALUE);
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources), tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test",
-            false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> resources = new ArrayList<>();
-    resources.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        resources, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        assertEquals(batchData.getTimeByIndex(i) + 20000.0, batchData.getDoubleByIndex(i), 0.001);
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void testPartialMerge1() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources.subList(0, 1)),
-            tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> list = new ArrayList<>();
-    list.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        list, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        if (batchData.getTimeByIndex(i) < 20) {
-          assertEquals(batchData.getTimeByIndex(i) + 10000.0, batchData.getDoubleByIndex(i), 0.001);
-        } else {
-          assertEquals(batchData.getTimeByIndex(i) + 0.0, batchData.getDoubleByIndex(i), 0.001);
-        }
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void testPartialMerge2() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources.subList(5, 6)),
-            tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> list = new ArrayList<>();
-    list.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        list, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        assertEquals(batchData.getTimeByIndex(i) + 20000.0, batchData.getDoubleByIndex(i), 0.001);
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void testPartialMerge3() throws Exception {
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources.subList(0, 5)),
-            tempSGDir.getPath(),
-            (k, v, l) -> {
-            }, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> list = new ArrayList<>();
-    list.add(seqResources.get(2));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        list, new ArrayList<>(), null, null, true);
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        if (batchData.getTimeByIndex(i) < 260) {
-          assertEquals(batchData.getTimeByIndex(i) + 10000.0, batchData.getDoubleByIndex(i), 0.001);
-        } else {
-          assertEquals(batchData.getTimeByIndex(i) + 0.0, batchData.getDoubleByIndex(i), 0.001);
-        }
-      }
-    }
-    tsFilesReader.close();
-  }
-
-  @Test
-  public void mergeWithDeletionTest() throws Exception {
-    try {
-      PartialPath device = new PartialPath(deviceIds[0]);
-      seqResources.get(0).getModFile().write(new Deletion(device.concatNode(measurementSchemas[0].getMeasurementId()), 10000, 0, 49));
-    } finally {
-      seqResources.get(0).getModFile().close();
-    }
-
-    MergeTask mergeTask =
-        new MergeTask(new MergeResource(seqResources, unseqResources.subList(0, 1)),
-            tempSGDir.getPath(),
-            (k, v, l) -> {
-              try {
-                seqResources.get(0).removeModFile();
-              } catch (IOException e) {
-                e.printStackTrace();
-              }
-            }, "test", false, 1, MERGE_TEST_SG);
-    mergeTask.call();
-
-    QueryContext context = new QueryContext();
-    PartialPath path = new PartialPath(deviceIds[0] + TsFileConstant.PATH_SEPARATOR + measurementSchemas[0].getMeasurementId());
-    List<TsFileResource> resources = new ArrayList<>();
-    resources.add(seqResources.get(0));
-    IBatchReader tsFilesReader = new SeriesRawDataBatchReader(path, measurementSchemas[0].getType(), context,
-        resources, new ArrayList<>(), null, null, true);
-    int count = 0;
-    while (tsFilesReader.hasNextBatch()) {
-      BatchData batchData = tsFilesReader.nextBatch();
-      for (int i = 0; i < batchData.length(); i++) {
-        if (batchData.getTimeByIndex(i) <= 20) {
-          assertEquals(batchData.getTimeByIndex(i) + 10000.0, batchData.getDoubleByIndex(i), 0.001);
-        } else {
-          assertEquals(batchData.getTimeByIndex(i), batchData.getDoubleByIndex(i), 0.001);
-        }
-        count++;
-      }
-    }
-    assertEquals(70, count);
-    tsFilesReader.close();
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTest.java
deleted file mode 100644
index 9baeb48..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeTest.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.cache.ChunkMetadataCache;
-import org.apache.iotdb.db.engine.merge.manage.MergeManager;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.query.control.FileReaderManager;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-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.write.TsFileWriter;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.After;
-import org.junit.Before;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import static org.apache.iotdb.db.conf.IoTDBConstant.PATH_SEPARATOR;
-
-abstract class MergeTest {
-
-  static final String MERGE_TEST_SG = "root.mergeTest";
-
-  int seqFileNum = 5;
-  int unseqFileNum = 5;
-  int measurementNum = 10;
-  int deviceNum = 10;
-  long ptNum = 100;
-  long flushInterval = 20;
-  TSEncoding encoding = TSEncoding.PLAIN;
-
-  String[] deviceIds;
-  MeasurementSchema[] measurementSchemas;
-
-  List<TsFileResource> seqResources = new ArrayList<>();
-  List<TsFileResource> unseqResources = new ArrayList<>();
-
-  private int prevMergeChunkThreshold;
-
-  @Before
-  public void setUp() throws IOException, WriteProcessException, MetadataException {
-    IoTDB.metaManager.init();
-    prevMergeChunkThreshold =
-        IoTDBDescriptor.getInstance().getConfig().getChunkMergePointThreshold();
-    IoTDBDescriptor.getInstance().getConfig().setChunkMergePointThreshold(-1);
-    prepareSeries();
-    prepareFiles(seqFileNum, unseqFileNum);
-    MergeManager.getINSTANCE().start();
-  }
-
-  @After
-  public void tearDown() throws IOException, StorageEngineException {
-    removeFiles();
-    seqResources.clear();
-    unseqResources.clear();
-    IoTDBDescriptor.getInstance().getConfig().setChunkMergePointThreshold(prevMergeChunkThreshold);
-    ChunkMetadataCache.getInstance().clear();
-    IoTDB.metaManager.clear();
-    EnvironmentUtils.cleanAllDir();
-    MergeManager.getINSTANCE().stop();
-  }
-
-  private void prepareSeries() throws MetadataException, MetadataException {
-    measurementSchemas = new MeasurementSchema[measurementNum];
-    for (int i = 0; i < measurementNum; i++) {
-      measurementSchemas[i] = new MeasurementSchema("sensor" + i, TSDataType.DOUBLE,
-          encoding, CompressionType.UNCOMPRESSED);
-    }
-    deviceIds = new String[deviceNum];
-    for (int i = 0; i < deviceNum; i++) {
-      deviceIds[i] = MERGE_TEST_SG + PATH_SEPARATOR + "device" + i;
-    }
-    IoTDB.metaManager.setStorageGroup(new PartialPath(MERGE_TEST_SG));
-    for (String device : deviceIds) {
-      for (MeasurementSchema measurementSchema : measurementSchemas) {
-        PartialPath devicePath = new PartialPath(device);
-        IoTDB.metaManager.createTimeseries(
-            devicePath.concatNode(measurementSchema.getMeasurementId()), measurementSchema
-                .getType(), measurementSchema.getEncodingType(), measurementSchema.getCompressor(),
-            Collections.emptyMap());
-      }
-    }
-  }
-
-  void prepareFiles(int seqFileNum, int unseqFileNum)
-      throws IOException, WriteProcessException {
-    for (int i = 0; i < seqFileNum; i++) {
-      File file = new File(TestConstant.BASE_OUTPUT_PATH.concat(
-          i + "seq" + IoTDBConstant.FILE_NAME_SEPARATOR + i + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-              + ".tsfile"));
-      TsFileResource tsFileResource = new TsFileResource(file);
-      tsFileResource.setClosed(true);
-      tsFileResource.setHistoricalVersions(Collections.singleton((long) i));
-      seqResources.add(tsFileResource);
-      prepareFile(tsFileResource, i * ptNum, ptNum, 0);
-    }
-    for (int i = 0; i < unseqFileNum; i++) {
-      File file = new File(TestConstant.BASE_OUTPUT_PATH.concat(
-          i + "unseq" + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-              + ".tsfile"));
-      TsFileResource tsFileResource = new TsFileResource(file);
-      tsFileResource.setClosed(true);
-      tsFileResource.setHistoricalVersions(Collections.singleton((long) (i + seqFileNum)));
-      unseqResources.add(tsFileResource);
-      prepareFile(tsFileResource, i * ptNum, ptNum * (i + 1) / unseqFileNum, 10000);
-    }
-
-    File file = new File(TestConstant.BASE_OUTPUT_PATH
-        .concat(unseqFileNum + "unseq" + IoTDBConstant.FILE_NAME_SEPARATOR + unseqFileNum
-            + IoTDBConstant.FILE_NAME_SEPARATOR + unseqFileNum
-            + IoTDBConstant.FILE_NAME_SEPARATOR + 0 + ".tsfile"));
-    TsFileResource tsFileResource = new TsFileResource(file);
-    tsFileResource.setClosed(true);
-    tsFileResource.setHistoricalVersions(Collections.singleton((long) (seqFileNum + unseqFileNum)));
-    unseqResources.add(tsFileResource);
-    prepareFile(tsFileResource, 0, ptNum * unseqFileNum, 20000);
-  }
-
-  private void removeFiles() throws IOException {
-    for (TsFileResource tsFileResource : seqResources) {
-      tsFileResource.remove();
-    }
-    for (TsFileResource tsFileResource : unseqResources) {
-      tsFileResource.remove();
-    }
-
-    FileReaderManager.getInstance().closeAndRemoveAllOpenedReaders();
-    FileReaderManager.getInstance().stop();
-  }
-
-  void prepareFile(TsFileResource tsFileResource, long timeOffset, long ptNum,
-      long valueOffset)
-      throws IOException, WriteProcessException {
-    TsFileWriter fileWriter = new TsFileWriter(tsFileResource.getTsFile());
-    for (String deviceId : deviceIds) {
-      for (MeasurementSchema measurementSchema : measurementSchemas) {
-        fileWriter.registerTimeseries(
-            new Path(deviceId, measurementSchema.getMeasurementId()), measurementSchema);
-      }
-    }
-    for (long i = timeOffset; i < timeOffset + ptNum; i++) {
-      for (int j = 0; j < deviceNum; j++) {
-        TSRecord record = new TSRecord(i, deviceIds[j]);
-        for (int k = 0; k < measurementNum; k++) {
-          record.addTuple(DataPoint.getDataPoint(measurementSchemas[k].getType(),
-              measurementSchemas[k].getMeasurementId(), String.valueOf(i + valueOffset)));
-        }
-        fileWriter.write(record);
-        tsFileResource.updateStartTime(deviceIds[j], i);
-        tsFileResource.updateEndTime(deviceIds[j], i);
-      }
-      if ((i + 1) % flushInterval == 0) {
-        fileWriter.flushAllChunkGroups();
-      }
-    }
-    fileWriter.close();
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeUpgradeTest.java b/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeUpgradeTest.java
deleted file mode 100644
index b49756d..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/merge/MergeUpgradeTest.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.merge;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.merge.manage.MergeResource;
-import org.apache.iotdb.db.engine.merge.selector.MaxFileMergeFileSelector;
-import org.apache.iotdb.db.engine.storagegroup.TsFileResource;
-import org.apache.iotdb.db.exception.MergeException;
-import org.apache.iotdb.tsfile.common.conf.TSFileConfig;
-import org.apache.iotdb.tsfile.exception.write.WriteProcessException;
-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.fileSystem.FSFactoryProducer;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.apache.iotdb.tsfile.write.TsFileWriter;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class MergeUpgradeTest {
-
-  private List<TsFileResource> seqResources = new ArrayList<>();
-  private List<TsFileResource> unseqResources = new ArrayList<>();
-
-  private int seqFileNum = 2;
-  private TSEncoding encoding = TSEncoding.RLE;
-  private MeasurementSchema[] measurementSchemas;
-  private int timeseriesNum = 5;
-  private long ptNum = 10;
-  private boolean changeVersion = true;
-  private String deviceName = "root.MergeUpgrade.device0";
-
-
-  @Before
-  public void setUp() throws IOException, WriteProcessException {
-    prepareSeries();
-    prepareFiles();
-  }
-
-  @After
-  public void tearDown() {
-    removeFiles();
-    seqResources.clear();
-    unseqResources.clear();
-  }
-
-  @Test
-  public void testMergeUpgradeSelect() throws MergeException {
-    MergeResource resource = new MergeResource(seqResources, unseqResources);
-    MaxFileMergeFileSelector mergeFileSelector = new MaxFileMergeFileSelector(resource,
-        Long.MAX_VALUE);
-    List[] result = mergeFileSelector.select();
-    assertEquals(0, result.length);
-  }
-
-  private void prepareFiles() throws IOException, WriteProcessException {
-    // prepare seqFiles
-    for (int i = 0; i < seqFileNum; i++) {
-      File seqfile = FSFactoryProducer.getFSFactory().getFile(TestConstant.BASE_OUTPUT_PATH.concat(
-              "seq" + IoTDBConstant.FILE_NAME_SEPARATOR + i + IoTDBConstant.FILE_NAME_SEPARATOR
-              + i + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-              + ".tsfile"));
-      TsFileResource seqTsFileResource = new TsFileResource(seqfile);
-      seqResources.add(seqTsFileResource);
-      prepareOldFile(seqTsFileResource, i * ptNum, ptNum, 0);
-    }
-    // prepare unseqFile
-    File unseqfile = FSFactoryProducer.getFSFactory().getFile(TestConstant.BASE_OUTPUT_PATH.concat(
-            "unseq" + IoTDBConstant.FILE_NAME_SEPARATOR + 0 + IoTDBConstant.FILE_NAME_SEPARATOR
-            + 0 + IoTDBConstant.FILE_NAME_SEPARATOR + 0
-            + ".tsfile"));
-    TsFileResource unseqTsFileResource = new TsFileResource(unseqfile);
-    unseqResources.add(unseqTsFileResource);
-    prepareFile(unseqTsFileResource, 0, 2 * ptNum, 10);
-  }
-
-  private void prepareSeries() {
-    measurementSchemas = new MeasurementSchema[timeseriesNum];
-    for (int i = 0; i < timeseriesNum; i++) {
-      measurementSchemas[i] = new MeasurementSchema("sensor" + i, TSDataType.DOUBLE,
-          encoding, CompressionType.UNCOMPRESSED);
-    }
-  }
-
-  private void prepareOldFile(TsFileResource tsFileResource, long timeOffset, long ptNum,
-      long valueOffset)
-      throws IOException, WriteProcessException {
-    TsFileWriter fileWriter = new TsFileWriter(tsFileResource.getTsFile());
-    prepareData(tsFileResource, fileWriter, timeOffset, ptNum, valueOffset);
-    fileWriter.close();
-    if (changeVersion) {
-      try (RandomAccessFile oldTsfile = new RandomAccessFile(tsFileResource.getTsFile(), "rw")) {
-        oldTsfile.seek(TSFileConfig.MAGIC_STRING.length());
-        oldTsfile.write(TSFileConfig.VERSION_NUMBER_V1.getBytes());
-      }
-      changeVersion = false;
-    }
-  }
-
-  private void prepareFile(TsFileResource tsFileResource, long timeOffset, long ptNum,
-      long valueOffset) throws IOException, WriteProcessException {
-    TsFileWriter fileWriter = new TsFileWriter(tsFileResource.getTsFile());
-    prepareData(tsFileResource, fileWriter, timeOffset, ptNum, valueOffset);
-    fileWriter.close();
-  }
-
-  private void removeFiles() {
-    for (TsFileResource tsFileResource : seqResources) {
-      tsFileResource.remove();
-    }
-    for (TsFileResource tsFileResource : unseqResources) {
-      tsFileResource.remove();
-    }
-  }
-
-  private void prepareData(TsFileResource tsFileResource, TsFileWriter fileWriter, long timeOffset,
-      long ptNum, long valueOffset) throws WriteProcessException, IOException {
-    for (MeasurementSchema MeasurementSchema : measurementSchemas) {
-      fileWriter.registerTimeseries(new Path(deviceName, MeasurementSchema.getMeasurementId()), MeasurementSchema);
-    }
-    for (long i = timeOffset; i < timeOffset + ptNum; i++) {
-      TSRecord record = new TSRecord(i, deviceName);
-      for (int k = 0; k < timeseriesNum; k++) {
-        record.addTuple(DataPoint.getDataPoint(measurementSchemas[k].getType(),
-            measurementSchemas[k].getMeasurementId(), String.valueOf(i + valueOffset)));
-      }
-      fileWriter.write(record);
-      tsFileResource.updateStartTime(deviceName, i);
-      tsFileResource.updateEndTime(deviceName, i);
-    }
-  }
-}
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
deleted file mode 100644
index 5d0ad9e..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionFileNodeTest.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.modification;
-
-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;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-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.engine.querycontext.ReadOnlyMemChunk;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.metadata.mnode.MNode;
-import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.query.control.QueryResourceManager;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.expression.impl.SingleSeriesExpression;
-import org.apache.iotdb.tsfile.read.reader.IPointReader;
-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.Test;
-
-
-public class DeletionFileNodeTest {
-
-  private String processorName = "root.test";
-
-  private static String[] measurements = new String[10];
-  private TSDataType dataType = TSDataType.DOUBLE;
-  private TSEncoding encoding = TSEncoding.PLAIN;
-
-  static {
-    for (int i = 0; i < 10; i++) {
-      measurements[i] = "m" + i;
-    }
-  }
-
-  @Before
-  public void setup() throws MetadataException {
-    EnvironmentUtils.envSetUp();
-
-    IoTDB.metaManager.setStorageGroup(new PartialPath(processorName));
-    for (int i = 0; i < 10; i++) {
-      IoTDB.metaManager.createTimeseries(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[i]), dataType,
-          encoding, TSFileDescriptor.getInstance().getConfig().getCompressor(), Collections.emptyMap());
-    }
-  }
-
-  @After
-  public void teardown() throws IOException, StorageEngineException {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  private void insertToStorageEngine(TSRecord record)
-      throws StorageEngineException, IllegalPathException {
-    InsertRowPlan insertRowPlan = new InsertRowPlan(record);
-    StorageEngine.getInstance().insert(insertRowPlan);
-  }
-
-  @Test
-  public void testDeleteInBufferWriteCache() throws
-      StorageEngineException, QueryProcessException, IOException, IllegalPathException {
-
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    SingleSeriesExpression expression = new SingleSeriesExpression(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR +
-        measurements[5]), null);
-    QueryDataSource dataSource = QueryResourceManager.getInstance()
-        .getQueryDataSource((PartialPath) expression.getSeriesPath(), TEST_QUERY_CONTEXT, null);
-
-    List<ReadOnlyMemChunk> timeValuePairs =
-        dataSource.getSeqResources().get(0).getReadOnlyMemChunk();
-    int count = 0;
-    for (ReadOnlyMemChunk chunk : timeValuePairs) {
-      IPointReader iterator = chunk.getPointReader();
-      while (iterator.hasNextTimeValuePair()) {
-        iterator.nextTimeValuePair();
-        count++;
-      }
-    }
-    assertEquals(50, count);
-    QueryResourceManager.getInstance().endQuery(TEST_QUERY_JOB_ID);
-  }
-
-  @Test
-  public void testDeleteInBufferWriteFile()
-      throws StorageEngineException, IOException, IllegalPathException {
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 40);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 30);
-
-    Modification[] realModifications = new Modification[]{
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]), 201, 50),
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]), 202, 40),
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]), 203, 30),
-    };
-
-    File fileNodeDir = new File(DirectoryManager.getInstance().getSequenceFileFolder(0),
-        processorName);
-    List<File> modFiles = new ArrayList<>();
-    for (File directory : fileNodeDir.listFiles()) {
-      assertTrue(directory.isDirectory());
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(ModificationFile.FILE_SUFFIX)) {
-            modFiles.add(file);
-          }
-        }
-      }
-    }
-
-    assertEquals(1, modFiles.size());
-
-    LocalTextModificationAccessor accessor =
-        new LocalTextModificationAccessor(modFiles.get(0).getPath());
-    try {
-      Collection<Modification> modifications = accessor.read();
-      assertEquals(3, modifications.size());
-      int i = 0;
-      for (Modification modification : modifications) {
-        assertEquals(modification.path, realModifications[i].path);
-        assertEquals(modification.type, realModifications[i].type);
-        i++;
-      }
-    } finally {
-      accessor.close();
-    }
-  }
-
-  @Test
-  public void testDeleteInOverflowCache()
-      throws StorageEngineException, QueryProcessException, IOException, IllegalPathException {
-    // insert sequence data
-    for (int i = 101; i <= 200; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    // insert unsequence data
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    SingleSeriesExpression expression = new SingleSeriesExpression(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR +
-        measurements[5]), null);
-
-    QueryDataSource dataSource = QueryResourceManager.getInstance()
-        .getQueryDataSource((PartialPath) expression.getSeriesPath(), TEST_QUERY_CONTEXT, null);
-
-    List<ReadOnlyMemChunk> timeValuePairs =
-        dataSource.getUnseqResources().get(0).getReadOnlyMemChunk();
-    int count = 0;
-    for (ReadOnlyMemChunk chunk : timeValuePairs) {
-      IPointReader iterator = chunk.getPointReader();
-      while (iterator.hasNextTimeValuePair()) {
-        iterator.nextTimeValuePair();
-        count++;
-      }
-    }
-    assertEquals(50, count);
-
-    QueryResourceManager.getInstance().endQuery(TEST_QUERY_JOB_ID);
-  }
-
-  @Test
-  public void testDeleteInOverflowFile()
-      throws StorageEngineException, QueryProcessException, IllegalPathException {
-    // insert into BufferWrite
-    for (int i = 101; i <= 200; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    // insert into Overflow
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 40);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 30);
-
-    Modification[] realModifications = new Modification[]{
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]), 301, 50),
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]), 302, 40),
-        new Deletion(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]), 303, 30),
-    };
-
-    File fileNodeDir = new File(DirectoryManager.getInstance().getNextFolderForUnSequenceFile(),
-        processorName);
-    List<File> modFiles = new ArrayList<>();
-    for (File directory : fileNodeDir.listFiles()) {
-      assertTrue(directory.isDirectory());
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(ModificationFile.FILE_SUFFIX)) {
-            modFiles.add(file);
-          }
-        }
-      }
-    }
-    assertEquals(1, modFiles.size());
-
-    LocalTextModificationAccessor accessor =
-        new LocalTextModificationAccessor(modFiles.get(0).getPath());
-    Collection<Modification> modifications = accessor.read();
-    assertEquals(3, modifications.size());
-    int i = 0;
-    for (Modification modification : modifications) {
-      assertEquals(modification.path, realModifications[i].path);
-      assertEquals(modification.type, realModifications[i].type);
-      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
deleted file mode 100644
index be99831..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/modification/DeletionQueryTest.java
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.modification;
-
-import static org.apache.iotdb.db.utils.EnvironmentUtils.TEST_QUERY_CONTEXT;
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-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.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.metadata.mnode.MNode;
-import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.qp.physical.crud.RawDataQueryPlan;
-import org.apache.iotdb.db.query.executor.QueryRouter;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-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.Test;
-
-public class DeletionQueryTest {
-
-  private String processorName = "root.test";
-
-  private static String[] measurements = new String[10];
-  private TSDataType dataType = TSDataType.DOUBLE;
-  private TSEncoding encoding = TSEncoding.PLAIN;
-  private QueryRouter router = new QueryRouter();
-
-
-  static {
-    for (int i = 0; i < 10; i++) {
-      measurements[i] = "m" + i;
-    }
-  }
-
-  @Before
-  public void setup() throws MetadataException {
-    EnvironmentUtils.envSetUp();
-    IoTDB.metaManager.setStorageGroup(new PartialPath(processorName));
-    for (int i = 0; i < 10; i++) {
-      IoTDB.metaManager.createTimeseries(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[i]), dataType,
-          encoding, TSFileDescriptor.getInstance().getConfig().getCompressor(), Collections.emptyMap());
-    }
-  }
-
-  @After
-  public void teardown() throws IOException, StorageEngineException {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  private void insertToStorageEngine(TSRecord record)
-      throws StorageEngineException, IllegalPathException {
-    InsertRowPlan insertRowPlan = new InsertRowPlan(record);
-    StorageEngine.getInstance().insert(insertRowPlan);
-  }
-
-  @Test
-  public void testDeleteInBufferWriteCache() throws
-      StorageEngineException, IOException, QueryProcessException, IllegalPathException {
-
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
-    List<TSDataType> dataTypes = new ArrayList<>();
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-
-    RawDataQueryPlan queryPlan = new RawDataQueryPlan();
-    queryPlan.setDeduplicatedDataTypes(dataTypes);
-    queryPlan.setDeduplicatedPaths(pathList);
-    QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
-
-    int count = 0;
-    while (dataSet.hasNext()) {
-      dataSet.next();
-      count++;
-    }
-    assertEquals(50, count);
-  }
-
-  @Test
-  public void testDeleteInBufferWriteFile()
-      throws StorageEngineException, IOException, QueryProcessException, IllegalPathException {
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 40);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 30);
-
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
-
-    List<TSDataType> dataTypes = new ArrayList<>();
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-
-    RawDataQueryPlan queryPlan = new RawDataQueryPlan();
-    queryPlan.setDeduplicatedDataTypes(dataTypes);
-    queryPlan.setDeduplicatedPaths(pathList);
-    QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
-
-    int count = 0;
-    while (dataSet.hasNext()) {
-      dataSet.next();
-      count++;
-    }
-    assertEquals(70, count);
-  }
-
-  @Test
-  public void testDeleteInOverflowCache()
-      throws StorageEngineException, IOException, QueryProcessException, IllegalPathException {
-    // insert into BufferWrite
-    for (int i = 101; i <= 200; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    // insert into Overflow
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
-    List<TSDataType> dataTypes = new ArrayList<>();
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-
-    RawDataQueryPlan queryPlan = new RawDataQueryPlan();
-    queryPlan.setDeduplicatedDataTypes(dataTypes);
-    queryPlan.setDeduplicatedPaths(pathList);
-    QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
-
-    int count = 0;
-    while (dataSet.hasNext()) {
-      dataSet.next();
-      count++;
-    }
-    assertEquals(150, count);
-  }
-
-  @Test
-  public void testDeleteInOverflowFile()
-      throws StorageEngineException, IOException, QueryProcessException, IllegalPathException {
-    // insert into BufferWrite
-    for (int i = 101; i <= 200; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    // insert into Overflow
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 40);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 30);
-
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
-
-    List<TSDataType> dataTypes = new ArrayList<>();
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-
-    RawDataQueryPlan queryPlan = new RawDataQueryPlan();
-    queryPlan.setDeduplicatedDataTypes(dataTypes);
-    queryPlan.setDeduplicatedPaths(pathList);
-    QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
-
-    int count = 0;
-    while (dataSet.hasNext()) {
-      dataSet.next();
-      count++;
-    }
-    assertEquals(170, count);
-  }
-
-  @Test
-  public void testSuccessiveDeletion()
-      throws StorageEngineException, IOException, QueryProcessException, IllegalPathException {
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    for (int i = 101; i <= 200; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 250);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 250);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 230);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 230, 250);
-
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    for (int i = 201; i <= 300; i++) {
-      TSRecord record = new TSRecord(i, processorName);
-      for (int j = 0; j < 10; j++) {
-        record.addTuple(new DoubleDataPoint(measurements[j], i * 1.0));
-      }
-      insertToStorageEngine(record);
-    }
-
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[3], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[4], 0, 50);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 0, 30);
-    StorageEngine.getInstance().delete(new PartialPath(processorName), measurements[5], 30, 50);
-
-    StorageEngine.getInstance().syncCloseAllProcessor();
-
-    List<PartialPath> pathList = new ArrayList<>();
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[3]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[4]));
-    pathList.add(new PartialPath(processorName + TsFileConstant.PATH_SEPARATOR + measurements[5]));
-    List<TSDataType> dataTypes = new ArrayList<>();
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-    dataTypes.add(dataType);
-
-    RawDataQueryPlan queryPlan = new RawDataQueryPlan();
-    queryPlan.setDeduplicatedDataTypes(dataTypes);
-    queryPlan.setDeduplicatedPaths(pathList);
-    QueryDataSet dataSet = router.rawDataQuery(queryPlan, TEST_QUERY_CONTEXT);
-
-    int count = 0;
-    while (dataSet.hasNext()) {
-      dataSet.next();
-      count++;
-    }
-    assertEquals(100, count);
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/modification/ModificationFileTest.java b/server/src/test/java/org/apache/iotdb/db/engine/modification/ModificationFileTest.java
deleted file mode 100644
index edeb36f..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/modification/ModificationFileTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.modification;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ModificationFileTest {
-
-  @Test
-  public void readMyWrite() {
-    String tempFileName = TestConstant.BASE_OUTPUT_PATH.concat("mod.temp");
-    Modification[] modifications = new Modification[]{
-        new Deletion(new PartialPath(new String[]{"d1", "s1"}), 1, 1),
-        new Deletion(new PartialPath(new String[]{"d1", "s2"}), 2, 2),
-        new Deletion(new PartialPath(new String[]{"d1", "s3"}), 3, 3, 4),
-        new Deletion(new PartialPath(new String[]{"d1", "s41"}), 4, 4, 5)
-    };
-    try (ModificationFile mFile = new ModificationFile(tempFileName)) {
-      for (int i = 0; i < 2; i++) {
-        mFile.write(modifications[i]);
-      }
-      List<Modification> modificationList = (List<Modification>) mFile.getModifications();
-      for (int i = 0; i < 2; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-
-      for (int i = 2; i < 4; i++) {
-        mFile.write(modifications[i]);
-      }
-      modificationList = (List<Modification>) mFile.getModifications();
-      for (int i = 0; i < 4; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-    } catch (IOException e) {
-      fail(e.getMessage());
-    } finally {
-      new File(tempFileName).delete();
-    }
-  }
-
-  @Test
-  public void testAbort() {
-    String tempFileName = TestConstant.BASE_OUTPUT_PATH.concat("mod.temp");
-    Modification[] modifications = new Modification[]{
-        new Deletion(new PartialPath(new String[]{"d1", "s1"}), 1, 1),
-        new Deletion(new PartialPath(new String[]{"d1", "s2"}), 2, 2),
-        new Deletion(new PartialPath(new String[]{"d1", "s3"}), 3, 3, 4),
-        new Deletion(new PartialPath(new String[]{"d1", "s4"}), 4, 4, 5),
-    };
-    try (ModificationFile mFile = new ModificationFile(tempFileName)) {
-      for (int i = 0; i < 2; i++) {
-        mFile.write(modifications[i]);
-      }
-      List<Modification> modificationList = (List<Modification>) mFile.getModifications();
-      for (int i = 0; i < 2; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-
-      for (int i = 2; i < 4; i++) {
-        mFile.write(modifications[i]);
-      }
-      modificationList = (List<Modification>) mFile.getModifications();
-      mFile.abort();
-
-      for (int i = 0; i < 3; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-    } catch (IOException e) {
-      fail(e.getMessage());
-    } finally {
-      new File(tempFileName).delete();
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessorTest.java
deleted file mode 100644
index 8289d48..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/modification/io/LocalTextModificationAccessorTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.modification.io;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.modification.Deletion;
-import org.apache.iotdb.db.engine.modification.Modification;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.tsfile.read.common.Path;
-import org.junit.Test;
-
-public class LocalTextModificationAccessorTest {
-
-  @Test
-  public void readMyWrite() {
-    String tempFileName = TestConstant.BASE_OUTPUT_PATH.concat("mod.temp");
-    Modification[] modifications = new Modification[]{
-        new Deletion(new PartialPath(new String[]{"d1","s1"}), 1, 1),
-        new Deletion(new PartialPath(new String[]{"d1", "s2"}), 2, 2),
-        new Deletion(new PartialPath(new String[]{"d1", "s3"}), 3, 3),
-        new Deletion(new PartialPath(new String[]{"d1", "s4"}), 4, 4),
-    };
-    try (LocalTextModificationAccessor accessor = new LocalTextModificationAccessor(tempFileName)) {
-      for (int i = 0; i < 2; i++) {
-        accessor.write(modifications[i]);
-      }
-      List<Modification> modificationList = (List<Modification>) accessor.read();
-      for (int i = 0; i < 2; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-
-      for (int i = 2; i < 4; i++) {
-        accessor.write(modifications[i]);
-      }
-      modificationList = (List<Modification>) accessor.read();
-      for (int i = 0; i < 4; i++) {
-        assertEquals(modifications[i], modificationList.get(i));
-      }
-    } catch (IOException e) {
-      fail(e.getMessage());
-    } finally {
-      new File(tempFileName).delete();
-    }
-  }
-
-  @Test
-  public void readNull() throws IOException {
-    String tempFileName = TestConstant.BASE_OUTPUT_PATH.concat("mod.temp");
-    LocalTextModificationAccessor accessor;
-    accessor = new LocalTextModificationAccessor(tempFileName);
-    new File(tempFileName).delete();
-    Collection<Modification> modifications = accessor.read();
-    assertEquals(new ArrayList<>(), modifications);
-  }
-}
\ No newline at end of file
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
deleted file mode 100644
index 298a4a0..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/FileNodeManagerBenchmark.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.storagegroup;
-
-import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.metadata.MManager;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.db.utils.RandomNum;
-import org.apache.iotdb.tsfile.common.conf.TSFileDescriptor;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.LongDataPoint;
-
-import java.io.IOException;
-import java.util.Collections;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Bench The storage group manager with mul-thread and get its performance.
- */
-public class FileNodeManagerBenchmark {
-
-  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(numOfWorker);
-  private static AtomicLong atomicLong = new AtomicLong();
-
-  private static String[] devices = new String[numOfDevice];
-  private static String prefix = "root.bench";
-  private static String[] measurements = new String[numOfMeasurement];
-
-  static {
-    for (int i = 0; i < numOfDevice; i++) {
-      devices[i] = prefix + TsFileConstant.PATH_SEPARATOR + "device_" + i;
-    }
-  }
-
-  static {
-    for (int i = 0; i < numOfMeasurement; i++) {
-      measurements[i] = "measurement_" + i;
-    }
-  }
-
-  private static void prepare()
-      throws MetadataException {
-    MManager manager = IoTDB.metaManager;
-    manager.setStorageGroup(new PartialPath(prefix));
-    for (String device : devices) {
-      for (String measurement : measurements) {
-        manager.createTimeseries(new PartialPath(device + "." + measurement), TSDataType.INT64,
-            TSEncoding.PLAIN, TSFileDescriptor.getInstance().getConfig().getCompressor(), Collections
-                .emptyMap());
-      }
-    }
-  }
-
-  private static void tearDown() throws IOException, StorageEngineException {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  public static void main(String[] args)
-      throws InterruptedException, IOException,
-      MetadataException, StorageEngineException {
-    tearDown();
-    prepare();
-    long startTime = System.currentTimeMillis();
-    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();
-  }
-
-  private static TSRecord getRecord(String deltaObjectId, long timestamp) {
-    TSRecord tsRecord = new TSRecord(timestamp, deltaObjectId);
-    for (String measurement : measurements) {
-      tsRecord.addTuple(new LongDataPoint(measurement, timestamp));
-    }
-    return tsRecord;
-  }
-
-  private static class Worker extends Thread {
-
-    @Override
-    public void run() {
-      try {
-        while (true) {
-          long seed = atomicLong.addAndGet(1);
-          if (seed > numOfTotalLine) {
-            break;
-          }
-          long time = RandomNum.getRandomLong(1, seed);
-          String deltaObject = devices[(int) (time % numOfDevice)];
-          TSRecord tsRecord = getRecord(deltaObject, time);
-          StorageEngine.getInstance().insert(new InsertRowPlan(tsRecord));
-        }
-      } catch (StorageEngineException | IllegalPathException e) {
-        e.printStackTrace();
-      } finally {
-        latch.countDown();
-      }
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java
deleted file mode 100644
index cfa7c64..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/StorageGroupProcessorTest.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.storagegroup;
-
-import static org.junit.Assert.assertFalse;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-import org.apache.iotdb.db.conf.IoTDBConfig;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.conf.adapter.ActiveTimeSeriesCounter;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.MetadataManagerHelper;
-import org.apache.iotdb.db.engine.flush.TsFileFlushPolicy;
-import org.apache.iotdb.db.engine.merge.manage.MergeManager;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
-import org.apache.iotdb.db.engine.tsfilemanagement.TsFileManagementStrategy;
-import org.apache.iotdb.db.exception.StorageGroupProcessorException;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.qp.physical.crud.InsertTabletPlan;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.read.reader.IPointReader;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class StorageGroupProcessorTest {
-
-  private String storageGroup = "root.vehicle.d0";
-  private String systemDir = TestConstant.OUTPUT_DATA_DIR.concat("info");
-  private String deviceId = "root.vehicle.d0";
-  private String measurementId = "s0";
-  private StorageGroupProcessor processor;
-  private QueryContext context = EnvironmentUtils.TEST_QUERY_CONTEXT;
-  private AtomicLong mergeLock;
-
-  @Before
-  public void setUp() throws Exception {
-    IoTDBDescriptor.getInstance().getConfig()
-        .setTsFileManagementStrategy(TsFileManagementStrategy.NORMAL_STRATEGY);
-    MetadataManagerHelper.initMetadata();
-    EnvironmentUtils.envSetUp();
-    ActiveTimeSeriesCounter.getInstance().init(storageGroup);
-    processor = new DummySGP(systemDir, storageGroup);
-    MergeManager.getINSTANCE().start();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    processor.syncDeleteDataFiles();
-    EnvironmentUtils.cleanEnv();
-    EnvironmentUtils.cleanDir(TestConstant.OUTPUT_DATA_DIR);
-    MergeManager.getINSTANCE().stop();
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig()
-        .setTsFileManagementStrategy(TsFileManagementStrategy.LEVEL_STRATEGY);
-  }
-
-  private void insertToStorageGroupProcessor(TSRecord record)
-      throws WriteProcessException, IllegalPathException {
-    InsertRowPlan insertRowPlan = new InsertRowPlan(record);
-    processor.insert(insertRowPlan);
-  }
-
-  @Test
-  public void testUnseqUnsealedDelete()
-      throws WriteProcessException, IOException, IllegalPathException {
-    TSRecord record = new TSRecord(10000, deviceId);
-    record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(1000)));
-    insertToStorageGroupProcessor(record);
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 1; j <= 10; j++) {
-      record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-    }
-
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor.syncFlush();
-    }
-
-    for (int j = 11; j <= 20; j++) {
-      record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-    }
-
-    processor.delete(new PartialPath(deviceId), measurementId, 0, 15L);
-
-    List<TsFileResource> tsfileResourcesForQuery = new ArrayList<>();
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor
-          .query(deviceId, measurementId, TSDataType.INT32, TSEncoding.RLE, Collections.emptyMap(),
-              new QueryContext(), tsfileResourcesForQuery);
-    }
-
-    Assert.assertEquals(1, tsfileResourcesForQuery.size());
-    Assert.assertEquals(0, tsfileResourcesForQuery.get(0).getChunkMetadataList().size());
-    List<ReadOnlyMemChunk> memChunks = tsfileResourcesForQuery.get(0).getReadOnlyMemChunk();
-    long time = 16;
-    for (ReadOnlyMemChunk memChunk : memChunks) {
-      IPointReader iterator = memChunk.getPointReader();
-      while (iterator.hasNextTimeValuePair()) {
-        TimeValuePair timeValuePair = iterator.nextTimeValuePair();
-        Assert.assertEquals(time++, timeValuePair.getTimestamp());
-      }
-    }
-  }
-
-  @Test
-  public void testSequenceSyncClose()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-    for (int j = 1; j <= 10; j++) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-
-    try {
-      Thread.sleep(1000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    processor.syncCloseAllWorkingTsFileProcessors();
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-    Assert.assertEquals(10, queryDataSource.getSeqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-  }
-
-  @Test
-  public void testIoTDBTabletWriteAndSyncClose()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-
-    String[] measurements = new String[2];
-    measurements[0] = "s0";
-    measurements[1] = "s1";
-    List<Integer> dataTypes = new ArrayList<>();
-    dataTypes.add(TSDataType.INT32.ordinal());
-    dataTypes.add(TSDataType.INT64.ordinal());
-
-
-    MeasurementMNode[] measurementMNodes = new MeasurementMNode[2];
-    measurementMNodes[0] = new MeasurementMNode(null, "s0",
-        new MeasurementSchema("s0", TSDataType.INT32, TSEncoding.PLAIN), null);
-    measurementMNodes[1] = new MeasurementMNode(null, "s1",
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null);
-
-
-    InsertTabletPlan insertTabletPlan1 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-    insertTabletPlan1.setMeasurementMNodes(measurementMNodes);
-
-    long[] times = new long[100];
-    Object[] columns = new Object[2];
-    columns[0] = new int[100];
-    columns[1] = new long[100];
-
-    for (int r = 0; r < 100; r++) {
-      times[r] = r;
-      ((int[]) columns[0])[r] = 1;
-      ((long[]) columns[1])[r] = 1;
-    }
-    insertTabletPlan1.setTimes(times);
-    insertTabletPlan1.setColumns(columns);
-    insertTabletPlan1.setRowCount(times.length);
-
-    processor.insertTablet(insertTabletPlan1);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-
-    InsertTabletPlan insertTabletPlan2 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-    insertTabletPlan2.setMeasurementMNodes(measurementMNodes);
-
-    for (int r = 50; r < 149; r++) {
-      times[r - 50] = r;
-      ((int[]) columns[0])[r - 50] = 1;
-      ((long[]) columns[1])[r - 50] = 1;
-    }
-    insertTabletPlan2.setTimes(times);
-    insertTabletPlan2.setColumns(columns);
-    insertTabletPlan2.setRowCount(times.length);
-
-    processor.insertTablet(insertTabletPlan2);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-
-    Assert.assertEquals(2, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(1, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-  }
-
-
-  @Test
-  public void testSeqAndUnSeqSyncClose()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-
-    for (int j = 21; j <= 30; j++) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 10; j >= 1; j--) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-    Assert.assertEquals(10, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(10, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-    for (TsFileResource resource : queryDataSource.getUnseqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-  }
-
-  @Test
-  public void testEnableDiscardOutOfOrderDataForInsertRowPlan()
-      throws WriteProcessException, QueryProcessException, IllegalPathException, IOException {
-    IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
-    boolean defaultValue = config.isEnableDiscardOutOfOrderData();
-    config.setEnableDiscardOutOfOrderData(true);
-
-    for (int j = 21; j <= 30; j++) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 10; j >= 1; j--) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor.syncFlush();
-    }
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-    Assert.assertEquals(10, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-    for (TsFileResource resource : queryDataSource.getUnseqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-
-    config.setEnableDiscardOutOfOrderData(defaultValue);
-  }
-
-  @Test
-  public void testEnableDiscardOutOfOrderDataForInsertTablet1()
-      throws QueryProcessException, IllegalPathException, IOException {
-    IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
-    boolean defaultEnableDiscard = config.isEnableDiscardOutOfOrderData();
-    long defaultTimePartition = config.getPartitionInterval();
-    boolean defaultEnablePartition = config.isEnablePartition();
-    config.setEnableDiscardOutOfOrderData(true);
-    config.setEnablePartition(true);
-    config.setPartitionInterval(100);
-
-    String[] measurements = new String[2];
-    measurements[0] = "s0";
-    measurements[1] = "s1";
-    List<Integer> dataTypes = new ArrayList<>();
-    dataTypes.add(TSDataType.INT32.ordinal());
-    dataTypes.add(TSDataType.INT64.ordinal());
-
-    MeasurementMNode[] measurementMNodes = new MeasurementMNode[2];
-    measurementMNodes[0] = new MeasurementMNode(null, "s0",
-        new MeasurementSchema("s0", TSDataType.INT32, TSEncoding.PLAIN), null);
-    measurementMNodes[1] = new MeasurementMNode(null, "s1",
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null);
-
-    InsertTabletPlan insertTabletPlan1 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    long[] times = new long[100];
-    Object[] columns = new Object[2];
-    columns[0] = new int[100];
-    columns[1] = new long[100];
-
-    for (int r = 0; r < 100; r++) {
-      times[r] = r;
-      ((int[]) columns[0])[r] = 1;
-      ((long[]) columns[1])[r] = 1;
-    }
-    insertTabletPlan1.setTimes(times);
-    insertTabletPlan1.setColumns(columns);
-    insertTabletPlan1.setRowCount(times.length);
-    insertTabletPlan1.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan1);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-
-    InsertTabletPlan insertTabletPlan2 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    for (int r = 149; r >= 50; r--) {
-      times[r - 50] = r;
-      ((int[]) columns[0])[r - 50] = 1;
-      ((long[]) columns[1])[r - 50] = 1;
-    }
-    insertTabletPlan2.setTimes(times);
-    insertTabletPlan2.setColumns(columns);
-    insertTabletPlan2.setRowCount(times.length);
-    insertTabletPlan2.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan2);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor.syncFlush();
-    }
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-
-    Assert.assertEquals(2, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-
-    config.setEnableDiscardOutOfOrderData(defaultEnableDiscard);
-    config.setPartitionInterval(defaultTimePartition);
-    config.setEnablePartition(defaultEnablePartition);
-  }
-
-  @Test
-  public void testEnableDiscardOutOfOrderDataForInsertTablet2()
-      throws QueryProcessException, IllegalPathException, IOException {
-    IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
-    boolean defaultEnableDiscard = config.isEnableDiscardOutOfOrderData();
-    long defaultTimePartition = config.getPartitionInterval();
-    boolean defaultEnablePartition = config.isEnablePartition();
-    config.setEnableDiscardOutOfOrderData(true);
-    config.setEnablePartition(true);
-    config.setPartitionInterval(1200);
-
-    String[] measurements = new String[2];
-    measurements[0] = "s0";
-    measurements[1] = "s1";
-    List<Integer> dataTypes = new ArrayList<>();
-    dataTypes.add(TSDataType.INT32.ordinal());
-    dataTypes.add(TSDataType.INT64.ordinal());
-
-    MeasurementMNode[] measurementMNodes = new MeasurementMNode[2];
-    measurementMNodes[0] = new MeasurementMNode(null, "s0",
-        new MeasurementSchema("s0", TSDataType.INT32, TSEncoding.PLAIN), null);
-    measurementMNodes[1] = new MeasurementMNode(null, "s1",
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null);
-
-    InsertTabletPlan insertTabletPlan1 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    long[] times = new long[1200];
-    Object[] columns = new Object[2];
-    columns[0] = new int[1200];
-    columns[1] = new long[1200];
-
-    for (int r = 0; r < 1200; r++) {
-      times[r] = r;
-      ((int[]) columns[0])[r] = 1;
-      ((long[]) columns[1])[r] = 1;
-    }
-    insertTabletPlan1.setTimes(times);
-    insertTabletPlan1.setColumns(columns);
-    insertTabletPlan1.setRowCount(times.length);
-    insertTabletPlan1.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan1);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-
-    InsertTabletPlan insertTabletPlan2 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    for (int r = 1249; r >= 50; r--) {
-      times[r - 50] = r;
-      ((int[]) columns[0])[r - 50] = 1;
-      ((long[]) columns[1])[r - 50] = 1;
-    }
-    insertTabletPlan2.setTimes(times);
-    insertTabletPlan2.setColumns(columns);
-    insertTabletPlan2.setRowCount(times.length);
-    insertTabletPlan2.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan2);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor.syncFlush();
-    }
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-
-    Assert.assertEquals(2, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-
-    config.setEnableDiscardOutOfOrderData(defaultEnableDiscard);
-    config.setPartitionInterval(defaultTimePartition);
-    config.setEnablePartition(defaultEnablePartition);
-  }
-
-  @Test
-  public void testEnableDiscardOutOfOrderDataForInsertTablet3()
-      throws QueryProcessException, IllegalPathException, IOException {
-    IoTDBConfig config = IoTDBDescriptor.getInstance().getConfig();
-    boolean defaultEnableDiscard = config.isEnableDiscardOutOfOrderData();
-    long defaultTimePartition = config.getPartitionInterval();
-    boolean defaultEnablePartition = config.isEnablePartition();
-    config.setEnableDiscardOutOfOrderData(true);
-    config.setEnablePartition(true);
-    config.setPartitionInterval(1000);
-
-    String[] measurements = new String[2];
-    measurements[0] = "s0";
-    measurements[1] = "s1";
-    List<Integer> dataTypes = new ArrayList<>();
-    dataTypes.add(TSDataType.INT32.ordinal());
-    dataTypes.add(TSDataType.INT64.ordinal());
-
-    MeasurementMNode[] measurementMNodes = new MeasurementMNode[2];
-    measurementMNodes[0] = new MeasurementMNode(null, "s0",
-        new MeasurementSchema("s0", TSDataType.INT32, TSEncoding.PLAIN), null);
-    measurementMNodes[1] = new MeasurementMNode(null, "s1",
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null);
-
-    InsertTabletPlan insertTabletPlan1 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    long[] times = new long[1200];
-    Object[] columns = new Object[2];
-    columns[0] = new int[1200];
-    columns[1] = new long[1200];
-
-    for (int r = 0; r < 1200; r++) {
-      times[r] = r;
-      ((int[]) columns[0])[r] = 1;
-      ((long[]) columns[1])[r] = 1;
-    }
-    insertTabletPlan1.setTimes(times);
-    insertTabletPlan1.setColumns(columns);
-    insertTabletPlan1.setRowCount(times.length);
-    insertTabletPlan1.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan1);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-
-    InsertTabletPlan insertTabletPlan2 = new InsertTabletPlan(new PartialPath("root.vehicle.d0"), measurements,
-        dataTypes);
-
-    for (int r = 1249; r >= 50; r--) {
-      times[r - 50] = r;
-      ((int[]) columns[0])[r - 50] = 1;
-      ((long[]) columns[1])[r - 50] = 1;
-    }
-    insertTabletPlan2.setTimes(times);
-    insertTabletPlan2.setColumns(columns);
-    insertTabletPlan2.setRowCount(times.length);
-    insertTabletPlan2.setMeasurementMNodes(measurementMNodes);
-
-    processor.insertTablet(insertTabletPlan2);
-    processor.asyncCloseAllWorkingTsFileProcessors();
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (TsFileProcessor tsfileProcessor : processor.getWorkUnsequenceTsFileProcessor()) {
-      tsfileProcessor.syncFlush();
-    }
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-
-    Assert.assertEquals(2, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-
-    config.setEnableDiscardOutOfOrderData(defaultEnableDiscard);
-    config.setPartitionInterval(defaultTimePartition);
-    config.setEnablePartition(defaultEnablePartition);
-  }
-
-  @Test
-  public void testMerge() throws WriteProcessException, QueryProcessException, IllegalPathException {
-
-    mergeLock = new AtomicLong(0);
-    for (int j = 21; j <= 30; j++) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-    processor.syncCloseAllWorkingTsFileProcessors();
-
-    for (int j = 10; j >= 1; j--) {
-      TSRecord record = new TSRecord(j, deviceId);
-      record.addTuple(DataPoint.getDataPoint(TSDataType.INT32, measurementId, String.valueOf(j)));
-      insertToStorageGroupProcessor(record);
-      processor.asyncCloseAllWorkingTsFileProcessors();
-    }
-
-    processor.syncCloseAllWorkingTsFileProcessors();
-    processor.merge(true);
-    while (mergeLock.get() == 0) {
-      // wait
-    }
-
-    QueryDataSource queryDataSource = processor.query(new PartialPath(deviceId), measurementId, context,
-        null, null);
-    Assert.assertEquals(10, queryDataSource.getSeqResources().size());
-    Assert.assertEquals(0, queryDataSource.getUnseqResources().size());
-    for (TsFileResource resource : queryDataSource.getSeqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-    for (TsFileResource resource : queryDataSource.getUnseqResources()) {
-      Assert.assertTrue(resource.isClosed());
-    }
-  }
-
-  class DummySGP extends StorageGroupProcessor {
-
-    DummySGP(String systemInfoDir, String storageGroupName) throws StorageGroupProcessorException {
-      super(systemInfoDir, storageGroupName, new TsFileFlushPolicy.DirectFlushPolicy());
-    }
-
-    @Override
-    protected void mergeEndAction(List<TsFileResource> seqFiles, List<TsFileResource> unseqFiles,
-        File mergeLog) {
-      super.mergeEndAction(seqFiles, unseqFiles, mergeLog);
-      mergeLock.incrementAndGet();
-      assertFalse(mergeLog.exists());
-    }
-  }
-}
\ No newline at end of file
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
deleted file mode 100644
index 01c4ea8..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TTLTest.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.iotdb.db.engine.storagegroup;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import org.apache.iotdb.db.conf.IoTDBConstant;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.conf.directories.DirectoryManager;
-import org.apache.iotdb.db.engine.flush.TsFileFlushPolicy.DirectFlushPolicy;
-import org.apache.iotdb.db.engine.querycontext.QueryDataSource;
-import org.apache.iotdb.db.exception.StartupException;
-import org.apache.iotdb.db.exception.StorageEngineException;
-import org.apache.iotdb.db.exception.StorageGroupProcessorException;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.exception.metadata.MetadataException;
-import org.apache.iotdb.db.exception.query.OutOfTTLException;
-import org.apache.iotdb.db.exception.query.QueryProcessException;
-import org.apache.iotdb.db.metadata.PartialPath;
-import org.apache.iotdb.db.metadata.mnode.MeasurementMNode;
-import org.apache.iotdb.db.metadata.mnode.StorageGroupMNode;
-import org.apache.iotdb.db.qp.Planner;
-import org.apache.iotdb.db.qp.executor.PlanExecutor;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.qp.physical.sys.SetTTLPlan;
-import org.apache.iotdb.db.qp.physical.sys.ShowTTLPlan;
-import org.apache.iotdb.db.query.control.QueryResourceManager;
-import org.apache.iotdb.db.query.reader.series.SeriesRawDataBatchReader;
-import org.apache.iotdb.db.service.IoTDB;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.common.constant.TsFileConstant;
-import org.apache.iotdb.tsfile.exception.filter.QueryFilterOptimizationException;
-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.BatchData;
-import org.apache.iotdb.tsfile.read.common.RowRecord;
-import org.apache.iotdb.tsfile.read.query.dataset.QueryDataSet;
-import org.apache.iotdb.tsfile.read.reader.IBatchReader;
-import org.apache.iotdb.tsfile.write.schema.MeasurementSchema;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TTLTest {
-
-  private String sg1 = "root.TTL_SG1";
-  private String sg2 = "root.TTL_SG2";
-  private long ttl = 12345;
-  private StorageGroupProcessor storageGroupProcessor;
-  private String s1 = "s1";
-  private String g1s1 = sg1 + IoTDBConstant.PATH_SEPARATOR + s1;
-  private long prevPartitionInterval;
-
-
-  @Before
-  public void setUp()
-      throws MetadataException, IOException, StartupException, StorageGroupProcessorException {
-    prevPartitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(86400);
-    EnvironmentUtils.envSetUp();
-    createSchemas();
-  }
-
-  @After
-  public void tearDown() throws IOException, StorageEngineException {
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(prevPartitionInterval);
-  }
-
-  private void insertToStorageGroupProcessor(InsertRowPlan insertPlan)
-      throws WriteProcessException {
-    storageGroupProcessor.insert(insertPlan);
-  }
-
-  private void createSchemas()
-      throws MetadataException, StorageGroupProcessorException {
-    IoTDB.metaManager.setStorageGroup(new PartialPath(sg1));
-    IoTDB.metaManager.setStorageGroup(new PartialPath(sg2));
-    storageGroupProcessor = new StorageGroupProcessor(IoTDBDescriptor.getInstance().getConfig()
-        .getSystemDir(), sg1, new DirectFlushPolicy());
-    IoTDB.metaManager.createTimeseries(new PartialPath(g1s1), TSDataType.INT64, TSEncoding.PLAIN,
-        CompressionType.UNCOMPRESSED, Collections.emptyMap());
-  }
-
-  @Test
-  public void testSetMetaTTL() throws IOException, MetadataException {
-    // exception is expected when setting ttl to a non-exist storage group
-    boolean caught = false;
-
-    try {
-      IoTDB.metaManager.setTTL(new PartialPath(sg1 + ".notExist"), ttl);
-    } catch (MetadataException e) {
-      caught = true;
-    }
-    assertTrue(caught);
-
-    // normally set ttl
-    IoTDB.metaManager.setTTL(new PartialPath(sg1), ttl);
-    StorageGroupMNode mNode = IoTDB.metaManager.getStorageGroupNodeByStorageGroupPath(new PartialPath(sg1));
-    assertEquals(ttl, mNode.getDataTTL());
-
-    // default ttl
-    mNode = IoTDB.metaManager.getStorageGroupNodeByStorageGroupPath(new PartialPath(sg2));
-    assertEquals(Long.MAX_VALUE, mNode.getDataTTL());
-  }
-
-  @Test
-  public void testTTLWrite()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-    InsertRowPlan plan = new InsertRowPlan();
-    plan.setDeviceId(new PartialPath(sg1));
-    plan.setTime(System.currentTimeMillis());
-    plan.setMeasurements(new String[]{"s1"});
-    plan.setDataTypes(new TSDataType[]{TSDataType.INT64});
-    plan.setValues(new Object[]{1L});
-    plan.setMeasurementMNodes(new MeasurementMNode[]{new MeasurementMNode(null, null,
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null)});
-    plan.transferType();
-
-    // ok without ttl
-    insertToStorageGroupProcessor(plan);
-
-    storageGroupProcessor.setDataTTL(1000);
-    // with ttl
-    plan.setTime(System.currentTimeMillis() - 1001);
-    boolean caught = false;
-    try {
-      storageGroupProcessor.insert(plan);
-    } catch (OutOfTTLException e) {
-      caught = true;
-    }
-    assertTrue(caught);
-    plan.setTime(System.currentTimeMillis() - 900);
-    storageGroupProcessor.insert(plan);
-  }
-
-  private void prepareData()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-    InsertRowPlan plan = new InsertRowPlan();
-    plan.setDeviceId(new PartialPath(sg1));
-    plan.setTime(System.currentTimeMillis());
-    plan.setMeasurements(new String[]{"s1"});
-    plan.setDataTypes(new TSDataType[]{TSDataType.INT64});
-    plan.setValues(new Object[]{1L});
-    plan.setMeasurementMNodes(new MeasurementMNode[]{new MeasurementMNode(null, null,
-        new MeasurementSchema("s1", TSDataType.INT64, TSEncoding.PLAIN), null)});
-    plan.transferType();
-
-    long initTime = System.currentTimeMillis();
-    // sequence data
-    for (int i = 1000; i < 2000; i++) {
-      plan.setTime(initTime - 2000 + i);
-      insertToStorageGroupProcessor(plan);
-      if ((i + 1) % 300 == 0) {
-        storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-      }
-    }
-    // unsequence data
-    for (int i = 0; i < 1000; i++) {
-      plan.setTime(initTime - 2000 + i);
-      insertToStorageGroupProcessor(plan);
-      if ((i + 1) % 300 == 0) {
-        storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-      }
-    }
-  }
-
-  @Test
-  public void testTTLRead()
-      throws IOException, WriteProcessException, StorageEngineException, QueryProcessException, IllegalPathException {
-    prepareData();
-
-    // files before ttl
-    QueryDataSource dataSource = storageGroupProcessor
-        .query(new PartialPath(sg1), s1, EnvironmentUtils.TEST_QUERY_CONTEXT, null, null);
-    List<TsFileResource> seqResource = dataSource.getSeqResources();
-    List<TsFileResource> unseqResource = dataSource.getUnseqResources();
-    assertEquals(4, seqResource.size());
-    assertEquals(4, unseqResource.size());
-
-    storageGroupProcessor.setDataTTL(500);
-
-    // files after ttl
-    dataSource = storageGroupProcessor
-        .query(new PartialPath(sg1), s1, EnvironmentUtils.TEST_QUERY_CONTEXT, null, null);
-    seqResource = dataSource.getSeqResources();
-    unseqResource = dataSource.getUnseqResources();
-    assertTrue(seqResource.size() < 4);
-    assertEquals(0, unseqResource.size());
-    PartialPath path = new PartialPath(sg1 + TsFileConstant.PATH_SEPARATOR + s1);
-    Set<String> allSensors = new HashSet<>();
-    allSensors.add(s1);
-    IBatchReader reader = new SeriesRawDataBatchReader(path, allSensors, TSDataType.INT64,
-        EnvironmentUtils.TEST_QUERY_CONTEXT, dataSource, null, null, null, true);
-
-    int cnt = 0;
-    while (reader.hasNextBatch()) {
-      BatchData batchData = reader.nextBatch();
-      while (batchData.hasCurrent()) {
-        batchData.next();
-        cnt++;
-      }
-    }
-    reader.close();
-    // we cannot offer the exact number since when exactly ttl will be checked is unknown
-    assertTrue(cnt <= 1000);
-
-    storageGroupProcessor.setDataTTL(0);
-    dataSource = storageGroupProcessor.query(new PartialPath(sg1), s1, EnvironmentUtils.TEST_QUERY_CONTEXT
-        , null, null);
-    seqResource = dataSource.getSeqResources();
-    unseqResource = dataSource.getUnseqResources();
-    assertEquals(0, seqResource.size());
-    assertEquals(0, unseqResource.size());
-
-    QueryResourceManager.getInstance().endQuery(EnvironmentUtils.TEST_QUERY_JOB_ID);
-  }
-
-  @Test
-  public void testTTLRemoval()
-      throws StorageEngineException, WriteProcessException, QueryProcessException, IllegalPathException {
-    prepareData();
-
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-
-    // files before ttl
-    File seqDir = new File(DirectoryManager.getInstance().getNextFolderForSequenceFile(), sg1);
-    File unseqDir = new File(DirectoryManager.getInstance().getNextFolderForUnSequenceFile(), sg1);
-
-    List<File> seqFiles = new ArrayList<>();
-    for (File directory : seqDir.listFiles()) {
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(TsFileConstant.TSFILE_SUFFIX)) {
-            seqFiles.add(file);
-          }
-        }
-      }
-    }
-
-    List<File> unseqFiles = new ArrayList<>();
-    for (File directory : unseqDir.listFiles()) {
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(TsFileConstant.TSFILE_SUFFIX)) {
-            unseqFiles.add(file);
-          }
-        }
-      }
-    }
-
-    assertEquals(4, seqFiles.size());
-    assertEquals(4, unseqFiles.size());
-
-    try {
-      Thread.sleep(500);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    storageGroupProcessor.setDataTTL(500);
-    storageGroupProcessor.checkFilesTTL();
-
-    // files after ttl
-    seqFiles = new ArrayList<>();
-    for (File directory : seqDir.listFiles()) {
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(TsFileConstant.TSFILE_SUFFIX)) {
-            seqFiles.add(file);
-          }
-        }
-      }
-    }
-
-    unseqFiles = new ArrayList<>();
-    for (File directory : unseqDir.listFiles()) {
-      if (directory.isDirectory()) {
-        for (File file : directory.listFiles()) {
-          if (file.getPath().endsWith(TsFileConstant.TSFILE_SUFFIX)) {
-            unseqFiles.add(file);
-          }
-        }
-      }
-    }
-
-    assertTrue(seqFiles.size() <= 2);
-    assertEquals(0, unseqFiles.size());
-  }
-
-  @Test
-  public void testParseSetTTL() throws QueryProcessException {
-    Planner planner = new Planner();
-    SetTTLPlan plan = (SetTTLPlan) planner
-        .parseSQLToPhysicalPlan("SET TTL TO " + sg1 + " 10000");
-    assertEquals(sg1, plan.getStorageGroup().getFullPath());
-    assertEquals(10000, plan.getDataTTL());
-
-    plan = (SetTTLPlan) planner.parseSQLToPhysicalPlan("UNSET TTL TO " + sg2);
-    assertEquals(sg2, plan.getStorageGroup().getFullPath());
-    assertEquals(Long.MAX_VALUE, plan.getDataTTL());
-  }
-
-  @Test
-  public void testParseShowTTL() throws QueryProcessException {
-    Planner planner = new Planner();
-    ShowTTLPlan plan = (ShowTTLPlan) planner.parseSQLToPhysicalPlan("SHOW ALL TTL");
-    assertTrue(plan.getStorageGroups().isEmpty());
-
-    List<String> sgs = new ArrayList<>();
-    sgs.add("root.sg1");
-    sgs.add("root.sg2");
-    sgs.add("root.sg3");
-    plan = (ShowTTLPlan) planner
-        .parseSQLToPhysicalPlan("SHOW TTL ON root.sg1,root.sg2,root.sg3");
-    assertEquals(sgs, plan.getStorageGroups().stream().map(PartialPath::getFullPath).collect(Collectors.toList()));
-  }
-
-  @Test
-  public void testShowTTL()
-      throws IOException, QueryProcessException, QueryFilterOptimizationException,
-      StorageEngineException, MetadataException {
-    IoTDB.metaManager.setTTL(new PartialPath(sg1), ttl);
-
-    ShowTTLPlan plan = new ShowTTLPlan(Collections.emptyList());
-    PlanExecutor executor = new PlanExecutor();
-    QueryDataSet queryDataSet = executor.processQuery(plan, EnvironmentUtils.TEST_QUERY_CONTEXT);
-    RowRecord rowRecord = queryDataSet.next();
-    assertEquals(sg1, rowRecord.getFields().get(0).getStringValue());
-    assertEquals(ttl, rowRecord.getFields().get(1).getLongV());
-
-    rowRecord = queryDataSet.next();
-    assertEquals(sg2, rowRecord.getFields().get(0).getStringValue());
-    assertNull(rowRecord.getFields().get(1));
-  }
-
-  @Test
-  public void testTTLCleanFile()
-      throws WriteProcessException, QueryProcessException, IllegalPathException {
-    prepareData();
-    storageGroupProcessor.syncCloseAllWorkingTsFileProcessors();
-
-    assertEquals(4, storageGroupProcessor.getSequenceFileTreeSet().size());
-    assertEquals(4, storageGroupProcessor.getUnSequenceFileList().size());
-
-    storageGroupProcessor.setDataTTL(0);
-    assertEquals(0, storageGroupProcessor.getSequenceFileTreeSet().size());
-    assertEquals(0, storageGroupProcessor.getUnSequenceFileList().size());
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java b/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
deleted file mode 100644
index adaf93c..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/storagegroup/TsFileProcessorTest.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.engine.storagegroup;
-
-import static junit.framework.TestCase.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import org.apache.iotdb.db.conf.adapter.ActiveTimeSeriesCounter;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.apache.iotdb.db.engine.MetadataManagerHelper;
-import org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
-import org.apache.iotdb.db.engine.querycontext.ReadOnlyMemChunk;
-import org.apache.iotdb.db.engine.version.SysTimeVersionController;
-import org.apache.iotdb.db.exception.TsFileProcessorException;
-import org.apache.iotdb.db.exception.WriteProcessException;
-import org.apache.iotdb.db.exception.metadata.IllegalPathException;
-import org.apache.iotdb.db.qp.physical.crud.InsertRowPlan;
-import org.apache.iotdb.db.query.context.QueryContext;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.tsfile.file.metadata.ChunkMetadata;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
-import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
-import org.apache.iotdb.tsfile.read.TimeValuePair;
-import org.apache.iotdb.tsfile.read.reader.IPointReader;
-import org.apache.iotdb.tsfile.write.record.TSRecord;
-import org.apache.iotdb.tsfile.write.record.datapoint.DataPoint;
-import org.apache.iotdb.tsfile.write.writer.RestorableTsFileIOWriter;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TsFileProcessorTest {
-
-  private TsFileProcessor processor;
-  private String storageGroup = "storage_group1";
-  private String filePath = TestConstant.OUTPUT_DATA_DIR
-      .concat("testUnsealedTsFileProcessor.tsfile");
-  private String deviceId = "root.vehicle.d0";
-  private String measurementId = "s0";
-  private TSDataType dataType = TSDataType.INT32;
-  private TSEncoding encoding = TSEncoding.RLE;
-  private Map<String, String> props = Collections.emptyMap();
-  private QueryContext context;
-  private static Logger logger = LoggerFactory.getLogger(TsFileProcessorTest.class);
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.envSetUp();
-    MetadataManagerHelper.initMetadata();
-    ActiveTimeSeriesCounter.getInstance().init(storageGroup);
-    context = EnvironmentUtils.TEST_QUERY_CONTEXT;
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    EnvironmentUtils.cleanDir(TestConstant.OUTPUT_DATA_DIR);
-  }
-
-  @Test
-  public void testWriteAndFlush() throws IOException, WriteProcessException, IllegalPathException {
-    logger.info("testWriteAndFlush begin..");
-    processor = new TsFileProcessor(storageGroup, SystemFileFactory.INSTANCE.getFile(filePath),
-        SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
-        (tsFileProcessor) -> true, true);
-
-    List<TsFileResource> tsfileResourcesForQuery = new ArrayList<>();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.isEmpty());
-
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, deviceId);
-      record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(new InsertRowPlan(record));
-    }
-
-    // query data in memory
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertFalse(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    int num = 1;
-    List<ReadOnlyMemChunk> memChunks = tsfileResourcesForQuery.get(0).getReadOnlyMemChunk();
-    for (; num <= 100; num++) {
-      for (ReadOnlyMemChunk chunk : memChunks) {
-        IPointReader iterator = chunk.getPointReader();
-        iterator.hasNextTimeValuePair();
-        TimeValuePair timeValuePair = iterator.nextTimeValuePair();
-        assertEquals(num, timeValuePair.getTimestamp());
-        assertEquals(num, timeValuePair.getValue().getInt());
-      }
-    }
-
-    // flush synchronously
-    processor.syncFlush();
-
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    assertEquals(1, tsfileResourcesForQuery.get(0).getChunkMetadataList().size());
-    assertEquals(measurementId,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getMeasurementUid());
-    assertEquals(dataType,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getDataType());
-    processor.syncClose();
-  }
-
-  @Test
-  public void testWriteAndRestoreMetadata()
-      throws IOException, WriteProcessException, IllegalPathException {
-    logger.info("testWriteAndRestoreMetadata begin..");
-    processor = new TsFileProcessor(storageGroup, SystemFileFactory.INSTANCE.getFile(filePath),
-        SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
-        (tsFileProcessor) -> true, true);
-
-    List<TsFileResource> tsfileResourcesForQuery = new ArrayList<>();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.isEmpty());
-
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, deviceId);
-      record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(new InsertRowPlan(record));
-    }
-
-    // query data in memory
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertFalse(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    int num = 1;
-    List<ReadOnlyMemChunk> memChunks = tsfileResourcesForQuery.get(0).getReadOnlyMemChunk();
-    for (ReadOnlyMemChunk chunk : memChunks) {
-      IPointReader iterator = chunk.getPointReader();
-      for (; num <= 100; num++) {
-        iterator.hasNextTimeValuePair();
-        TimeValuePair timeValuePair = iterator.nextTimeValuePair();
-        assertEquals(num, timeValuePair.getTimestamp());
-        assertEquals(num, timeValuePair.getValue().getInt());
-      }
-    }
-    logger.info("syncFlush..");
-    // flush synchronously
-    processor.syncFlush();
-
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    assertEquals(1, tsfileResourcesForQuery.get(0).getChunkMetadataList().size());
-    assertEquals(measurementId,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getMeasurementUid());
-    assertEquals(dataType,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getDataType());
-
-    RestorableTsFileIOWriter tsFileIOWriter = processor.getWriter();
-    Map<String, List<ChunkMetadata>> chunkMetaDataListInChunkGroups =
-        tsFileIOWriter.getDeviceChunkMetadataMap();
-    RestorableTsFileIOWriter restorableTsFileIOWriter = new RestorableTsFileIOWriter(
-        SystemFileFactory.INSTANCE.getFile(filePath));
-    Map<String, List<ChunkMetadata>> restoredChunkMetaDataListInChunkGroups = restorableTsFileIOWriter
-        .getDeviceChunkMetadataMap();
-    assertEquals(chunkMetaDataListInChunkGroups.size(),
-        restoredChunkMetaDataListInChunkGroups.size());
-    for (Map.Entry<String, List<ChunkMetadata>> entry1 : chunkMetaDataListInChunkGroups
-        .entrySet()) {
-      for (Map.Entry<String, List<ChunkMetadata>> entry2
-          : restoredChunkMetaDataListInChunkGroups.entrySet()) {
-        assertEquals(entry1.getKey(), entry2.getKey());
-        assertEquals(entry1.getValue().size(), entry2.getValue().size());
-        for (int i = 0; i < entry1.getValue().size(); i++) {
-          ChunkMetadata chunkMetaData = entry1.getValue().get(i);
-          ChunkMetadata chunkMetadataRestore = entry2.getValue().get(i);
-          assertEquals(chunkMetaData, chunkMetadataRestore);
-        }
-      }
-    }
-    restorableTsFileIOWriter.close();
-    logger.info("syncClose..");
-    processor.syncClose();
-    //we need to close the tsfile writer first and then reopen it.
-  }
-
-
-  @Test
-  public void testMultiFlush() throws IOException, WriteProcessException, IllegalPathException {
-    logger.info("testWriteAndRestoreMetadata begin..");
-    processor = new TsFileProcessor(storageGroup, SystemFileFactory.INSTANCE.getFile(filePath),
-        SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
-        (tsFileProcessor) -> true, true);
-
-    List<TsFileResource> tsfileResourcesForQuery = new ArrayList<>();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.isEmpty());
-
-    for (int flushId = 0; flushId < 10; flushId++) {
-      for (int i = 1; i <= 10; i++) {
-        TSRecord record = new TSRecord(i, deviceId);
-        record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-        processor.insert(new InsertRowPlan(record));
-      }
-      processor.asyncFlush();
-    }
-    processor.syncFlush();
-
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertFalse(tsfileResourcesForQuery.isEmpty());
-    assertTrue(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    assertEquals(10, tsfileResourcesForQuery.get(0).getChunkMetadataList().size());
-    assertEquals(measurementId,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getMeasurementUid());
-    assertEquals(dataType,
-        tsfileResourcesForQuery.get(0).getChunkMetadataList().get(0).getDataType());
-    processor.syncClose();
-  }
-
-  @Test
-  public void testWriteAndClose() throws IOException, WriteProcessException, IllegalPathException {
-    logger.info("testWriteAndRestoreMetadata begin..");
-    processor = new TsFileProcessor(storageGroup, SystemFileFactory.INSTANCE.getFile(filePath),
-        SysTimeVersionController.INSTANCE, this::closeTsFileProcessor,
-        (tsFileProcessor) -> true, true);
-
-    List<TsFileResource> tsfileResourcesForQuery = new ArrayList<>();
-
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertTrue(tsfileResourcesForQuery.isEmpty());
-
-    for (int i = 1; i <= 100; i++) {
-      TSRecord record = new TSRecord(i, deviceId);
-      record.addTuple(DataPoint.getDataPoint(dataType, measurementId, String.valueOf(i)));
-      processor.insert(new InsertRowPlan(record));
-    }
-
-    // query data in memory
-    tsfileResourcesForQuery.clear();
-    processor.query(deviceId, measurementId, dataType, encoding, props, context,
-        tsfileResourcesForQuery);
-    assertFalse(tsfileResourcesForQuery.isEmpty());
-    assertFalse(tsfileResourcesForQuery.get(0).getReadOnlyMemChunk().isEmpty());
-    int num = 1;
-    List<ReadOnlyMemChunk> memChunks = tsfileResourcesForQuery.get(0).getReadOnlyMemChunk();
-    for (; num <= 100; num++) {
-      for (ReadOnlyMemChunk chunk : memChunks) {
-        IPointReader iterator = chunk.getPointReader();
-        iterator.hasNextTimeValuePair();
-        TimeValuePair timeValuePair = iterator.nextTimeValuePair();
-        assertEquals(num, timeValuePair.getTimestamp());
-        assertEquals(num, timeValuePair.getValue().getInt());
-      }
-    }
-
-    // close synchronously
-    processor.syncClose();
-    try {
-      Thread.sleep(1000);
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-
-    assertTrue(processor.getTsFileResource().isClosed());
-
-  }
-
-  private void closeTsFileProcessor(TsFileProcessor unsealedTsFileProcessor)
-      throws TsFileProcessorException {
-    TsFileResource resource = unsealedTsFileProcessor.getTsFileResource();
-    synchronized (resource) {
-      for (Entry<String, Integer> entry : resource.getDeviceToIndexMap().entrySet()) {
-        resource.putEndTime(entry.getKey(), resource.getStartTime(entry.getValue()));
-      }
-      try {
-        resource.close();
-      } catch (IOException e) {
-        throw new TsFileProcessorException(e);
-      }
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/version/SimpleFileVersionControllerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/version/SimpleFileVersionControllerTest.java
deleted file mode 100644
index a514ae9..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/version/SimpleFileVersionControllerTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.version;
-
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-import org.apache.commons.io.FileUtils;
-import org.apache.iotdb.db.constant.TestConstant;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class SimpleFileVersionControllerTest {
-  @Test
-  public void test() throws IOException {
-    String tempFilePath = TestConstant.BASE_OUTPUT_PATH.concat("version.tmp");
-
-    try {
-      if (!new File(tempFilePath).mkdir()) {
-        Assert.fail("can not create version.tmp folder");
-      }
-      VersionController versionController = new SimpleFileVersionController(tempFilePath, 1);
-      assertEquals(SimpleFileVersionController.getSaveInterval(), versionController.currVersion());
-      for (int i = 0; i < 150; i++) {
-        versionController.nextVersion();
-      }
-      assertEquals(SimpleFileVersionController.getSaveInterval() + 150,
-          versionController.currVersion());
-      versionController = new SimpleFileVersionController(tempFilePath, 1);
-      assertEquals(SimpleFileVersionController.getSaveInterval() + 200,
-          versionController.currVersion());
-    } finally {
-      FileUtils.deleteDirectory(new File(tempFilePath));
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/engine/version/SysTimeVersionControllerTest.java b/server/src/test/java/org/apache/iotdb/db/engine/version/SysTimeVersionControllerTest.java
deleted file mode 100644
index 9e7a874..0000000
--- a/server/src/test/java/org/apache/iotdb/db/engine/version/SysTimeVersionControllerTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.engine.version;
-
-import org.junit.Test;
-
-import static org.junit.Assert.assertTrue;
-
-public class SysTimeVersionControllerTest {
-
-  @Test
-  public void test() {
-    VersionController versionController = SysTimeVersionController.INSTANCE;
-    long diff = versionController.currVersion() - System.currentTimeMillis();
-    // to aovid the test failure on a poor machine, we bear 200ms difference here.
-    assertTrue(diff >= -200 && diff <= 200);
-    diff = versionController.nextVersion();
-    try {
-      Thread.sleep(200);
-      diff -= System.currentTimeMillis();
-      assertTrue(diff >= -1000 && diff <= -200);
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
-      //do nothing
-    }
-  }
-}
\ No newline at end of file
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java
deleted file mode 100644
index b008475..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByIT.java
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.integration;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.*;
-
-import static org.apache.iotdb.db.constant.TestConstant.*;
-import static org.junit.Assert.fail;
-
-public class IOTDBGroupByIT {
-
-
-  private static String[] dataSet1 = new String[]{
-      "SET STORAGE GROUP TO root.ln.wf01.wt01",
-      "CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN",
-      "CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN",
-      "CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(1, 1.1, false, 11)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(2, 2.2, true, 22)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(3, 3.3, false, 33 )",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(4, 4.4, false, 44)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(5, 5.5, false, 55)",
-      "flush",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(100, 100.1, false, 110)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(150, 200.2, true, 220)",
-      "flush",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(200, 300.3, false, 330 )",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(250, 400.4, false, 440)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(300, 500.5, false, 550)",
-      "flush",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(10, 10.1, false, 110)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(20, 20.2, true, 220)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(30, 30.3, false, 330 )",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(40, 40.4, false, 440)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(50, 50.5, false, 550)",
-      "flush",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(500, 100.1, false, 110)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(510, 200.2, true, 220)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(520, 300.3, false, 330 )",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(530, 400.4, false, 440)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(540, 500.5, false, 550)",
-      "flush",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(580, 100.1, false, 110)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(590, 200.2, true, 220)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(600, 300.3, false, 330 )",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(610, 400.4, false, 440)",
-      "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(620, 500.5, false, 550)",
-  };
-
-  private static final String TIMESTAMP_STR = "Time";
-  private long prevPartitionInterval;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    prevPartitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(1000);
-    EnvironmentUtils.envSetUp();
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    prepareData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(prevPartitionInterval);
-  }
-
-  @Test
-  public void countSumAvgTest() {
-    String[] retArray1 = new String[]{
-        "5,3,35.8,11.933333333333332",
-        "25,2,70.7,35.35",
-        "45,1,50.5,50.5",
-        "65,0,0.0,null",
-        "85,1,100.1,100.1",
-        "105,0,0.0,null",
-        "125,0,0.0,null",
-        "145,1,200.2,200.2"
-    };
-    String[] retArray2 = new String[]{
-        "50,1,50.5,50.5",
-        "60,0,0.0,null",
-        "70,0,0.0,null",
-        "80,0,0.0,null",
-        "90,0,0.0,null",
-        "100,1,100.1,100.1",
-        "110,0,0.0,null",
-        "120,0,0.0,null",
-        "130,0,0.0,null",
-        "140,0,0.0,null",
-        "150,1,200.2,200.2"
-    };
-    String[] retArray3 = new String[]{
-        "25,2,70.7,35.35",
-        "45,1,50.5,50.5",
-        "65,0,0.0,null",
-        "85,1,100.1,100.1",
-        "105,0,0.0,null",
-        "125,0,0.0,null",
-        "145,1,200.2,200.2",
-        "165,0,0.0,null",
-        "185,1,300.3,300.3",
-        "205,0,0.0,null",
-        "225,0,0.0,null",
-        "245,1,400.4,400.4",
-        "265,0,0.0,null",
-        "285,1,500.5,500.5",
-        "305,0,0.0,null"
-    };
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where time > 3 "
-              + "GROUP BY ([5, 160), 20ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-              .getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-
-      hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([50, 160), 10ms)");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-              .getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray2[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray2.length, cnt);
-      }
-
-      hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([25, 314), 20ms)");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-              .getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray3[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray3.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void maxMinValeTimeTest() {
-    String[] retArray1 = new String[]{
-        "2,null,null,null,null",
-        "4,5.5,4.4,5,4",
-        "6,null,null,null,null",
-        "8,null,null,null,null",
-        "10,10.1,10.1,10,10",
-        "12,null,null,null,null",
-        "14,null,null,null,null",
-        "16,null,null,null,null",
-        "18,null,null,null,null",
-        "20,20.2,20.2,20,20",
-        "22,null,null,null,null",
-        "24,null,null,null,null",
-        "26,null,null,null,null",
-        "28,null,null,null,null"
-    };
-    String[] retArray2 = new String[]{
-        "2,20.2,3.3,20,3",
-        "22,40.4,30.3,40,30",
-        "42,50.5,50.5,50,50",
-        "62,null,null,null,null",
-        "82,100.1,100.1,100,100",
-        "102,null,null,null,null",
-        "122,null,null,null,null",
-        "142,200.2,200.2,150,150",
-        "162,null,null,null,null",
-        "182,300.3,300.3,200,200",
-        "202,null,null,null,null",
-        "222,null,null,null,null",
-        "242,400.4,400.4,250,250",
-        "262,null,null,null,null",
-        "282,null,null,null,null",
-    };
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute(
-          "select max_value(temperature), min_value(temperature), max_time(temperature), "
-              + "min_time(temperature) from root.ln.wf01.wt01 where time > 3 "
-              + "GROUP BY ([2,30), 2ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(max_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_value("root.ln.wf01.wt01.temperature")) + ","
-              + resultSet.getString(max_time("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_time("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-
-      hasResultSet = statement.execute(
-          "select max_value(temperature), min_value(temperature), max_time(temperature), "
-              + "min_time(temperature) from root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([2,300), 20ms)");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(max_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_value("root.ln.wf01.wt01.temperature")) + ","
-              + resultSet.getString(max_time("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_time("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray2[cnt], ans);
-          cnt++;
-        }
-      }
-      Assert.assertEquals(retArray2.length, cnt);
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void firstLastTest() {
-    String[] retArray1 = new String[]{
-        "2,5.5,4.4",
-        "6,null,null",
-        "10,10.1,10.1",
-        "14,null,null",
-        "18,20.2,20.2",
-        "22,null,null",
-        "26,null,null"
-    };
-    String[] retArray2 = new String[]{
-        "2,20.2,3.3",
-        "22,40.4,30.3",
-        "42,50.5,50.5",
-        "62,null,null",
-        "82,100.1,100.1",
-        "102,null,null",
-        "122,null,null",
-        "142,200.2,200.2",
-        "162,null,null",
-        "182,300.3,300.3",
-        "202,null,null",
-        "222,null,null",
-        "242,400.4,400.4",
-        "262,null,null",
-        "282,null,null"
-    };
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select last_value(temperature), first_value(temperature) from root.ln.wf01.wt01 where time > 3 "
-              + "GROUP BY ([2,30), 4ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(last_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(first_value("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-
-      hasResultSet = statement.execute(
-          "select first_value(temperature), last_value(temperature) from root.ln.wf01.wt01 "
-              + "where temperature > 3 "
-              + "GROUP BY ([2,300), 20ms)");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(last_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(first_value("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray2[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray2.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void largeIntervalTest() {
-    String[] retArray1 = new String[]{
-        "0,4.4,12,300,4",
-        "340,100.1,10,620,500"
-    };
-    String[] retArray2 = new String[]{
-        "0,3.3,13,300,3",
-        "340,100.1,10,620,500"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select min_value(temperature), count(temperature), max_time(temperature), "
-              + "min_time(temperature) from root.ln.wf01.wt01 where time > 3 GROUP BY "
-              + "([0, 680), 340ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(min_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(max_time("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_time("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-
-      hasResultSet = statement.execute(
-          "select min_value(temperature), count (temperature), max_time(temperature), "
-              + "min_time(temperature) from root.ln.wf01.wt01 where temperature > 3 GROUP BY "
-              + "([0, 680), 340ms)");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(min_value("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(count("root.ln.wf01.wt01.temperature")) + ","
-              + resultSet.getString(max_time("root.ln.wf01.wt01.temperature"))
-              + "," + resultSet.getString(min_time("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray2[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray2.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countSumAvgInnerIntervalTest() {
-    String[] retArray1 = new String[]{
-        "0,2,7.7,3.85",
-        "30,1,30.3,30.3",
-        "60,0,0.0,null",
-        "90,0,0.0,null",
-        "120,0,0.0,null",
-        "150,1,200.2,200.2",
-        "180,0,0.0,null",
-        "210,0,0.0,null",
-        "240,0,0.0,null",
-        "270,0,0.0,null",
-        "300,1,500.5,500.5",
-        "330,0,0.0,null",
-        "360,0,0.0,null",
-        "390,0,0.0,null",
-        "420,0,0.0,null",
-        "450,0,0.0,null",
-        "480,0,0.0,null",
-        "510,1,200.2,200.2",
-        "540,1,500.5,500.5",
-        "570,0,0.0,null"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([0, 600), 5ms, 30ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-              .getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countSumAvgNoDataTest() {
-    String[] retArray1 = new String[]{
-        "10000,0,0.0,null",
-        "10005,0,0.0,null",
-        "10010,0,0.0,null",
-        "10015,0,0.0,null",
-        "10020,0,0.0,null",
-        "10025,0,0.0,null",
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([10000, 10030), 5ms)");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString("Time") + "," +
-              resultSet.getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test 
-  public void usingLimit() {
-    String[] retArray1 = new String[]{
-        "90,0,0.0,null",
-        "120,0,0.0,null",
-        "150,1,200.2,200.2",
-        "180,0,0.0,null",
-        "210,0,0.0,null"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 where temperature > 3 "
-              + "GROUP BY ([0, 600), 5ms, 30ms) "
-              + "limit 5 offset 3");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-              .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-              resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-              .getString(avg("root.ln.wf01.wt01.temperature"));
-          Assert.assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray1.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void usingNowFunction() {
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      statement.execute("INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-          + "values(now(), 35.5, false, 650)");
-      ResultSet resultSet = statement.executeQuery(
-          "select count(temperature), sum(temperature), avg(temperature) from "
-              + "root.ln.wf01.wt01 "
-              + "GROUP BY ([now() - 1h, now() + 1h), 2h)");
-      Assert.assertTrue(resultSet.next());
-      //resultSet.getLong(1) is the timestamp
-      Assert.assertEquals(1, Integer.valueOf(resultSet.getString(2)).intValue());
-      Assert.assertEquals(35.5, Float.valueOf(resultSet.getString(3)).floatValue(), 0.01);
-      Assert.assertEquals(35.5, Double.valueOf(resultSet.getString(4)).doubleValue(), 0.01);
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void prepareData() {
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
-            "root");
-        Statement statement = connection.createStatement();) {
-
-      for (String sql : dataSet1) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java
deleted file mode 100644
index f3a62b0..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IOTDBGroupByInnerIntervalIT.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.integration;
-
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.apache.iotdb.jdbc.IoTDBSQLException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.*;
-
-import static org.apache.iotdb.db.constant.TestConstant.*;
-import static org.junit.Assert.*;
-
-public class IOTDBGroupByInnerIntervalIT {
-
-  private static String[] dataSet1 = new String[]{
-          "SET STORAGE GROUP TO root.ln.wf01.wt01",
-          "CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN",
-          "CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=DOUBLE, ENCODING=PLAIN",
-          "CREATE TIMESERIES root.ln.wf01.wt01.hardware WITH DATATYPE=INT32, ENCODING=PLAIN",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(1, 1.1, false, 11)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(2, 2.2, true, 22)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(3, 3.3, false, 33 )",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(4, 4.4, false, 44)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(5, 5.5, false, 55)",
-          "flush",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(6, 6.6, false, 66)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(7, 7.7, true, 77)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(8, 8.8, false, 88)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(9, 9.9, false, 99)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(10, 10.0, false, 110)",
-          "flush",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(11, 11.1, false, 121)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(12, 12.2, true, 220)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(13, 13.3, false, 330)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(14, 14.4, false, 440)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(15, 15.5, false, 550)",
-          "flush",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(16, 16.6, false, 660)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(18, 18.8, true, 780)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(22, 22.2, false, 220 )",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(23, 23.3, false, 650)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(24, 24.4, false, 760)",
-          "flush",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(25, 25.5, false, 550)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(26, 20.2, true, 220)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(27, 30.3, false, 330 )",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(28, 40.4, false, 440)",
-          "INSERT INTO root.ln.wf01.wt01(timestamp,temperature,status, hardware) "
-                  + "values(29, 50.5, false, 550)",
-  };
-
-  private static final String TIMESTAMP_STR = "Time";
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    prepareData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void countSumAvgInnerIntervalTest() {
-    String[] retArray1 = new String[]{
-            "1,3,6.6,2.2",
-            "6,3,23.1,7.7",
-            "11,3,36.599999999999994,12.2",
-            "16,2,35.400000000000006,17.700000000000003",
-            "21,2,45.5,22.75",
-            "26,3,90.9,30.299999999999997"
-    };
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 "
-                      + "GROUP BY ([1, 30), 3ms, 5ms)");
-
-      assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-                  .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-                  resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-                  .getString(avg("root.ln.wf01.wt01.temperature"));
-          assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        assertEquals(retArray1.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countSumAvgInnerIntervalTestWithValueFilter() {
-    String[] retArray1 = new String[]{
-            "1,1,3.3,3.3",
-            "6,3,23.1,7.7",
-            "11,3,36.599999999999994,12.2",
-            "16,2,35.400000000000006,17.700000000000003",
-            "21,2,45.5,22.75",
-            "26,3,90.9,30.299999999999997"
-    };
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 where temperature > 3"
-                      + " GROUP BY ([1, 30), 3ms, 5ms)");
-
-      assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-                  .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-                  resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-                  .getString(avg("root.ln.wf01.wt01.temperature"));
-          assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        assertEquals(retArray1.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countSumAvgInnerIntervalTestWithTimeFilter() {
-    String[] retArray1 = new String[]{
-            "1,0,0.0,null",
-            "6,3,23.1,7.7",
-            "11,3,36.599999999999994,12.2",
-            "16,2,35.400000000000006,17.700000000000003",
-            "21,2,45.5,22.75",
-            "26,3,90.9,30.299999999999997"
-    };
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 where time > 3"
-                      + " GROUP BY ([1, 30), 3ms, 5ms)");
-
-      assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet
-                  .getString(count("root.ln.wf01.wt01.temperature")) + "," +
-                  resultSet.getString(sum("root.ln.wf01.wt01.temperature")) + "," + resultSet
-                  .getString(avg("root.ln.wf01.wt01.temperature"));
-          assertEquals(retArray1[cnt], ans);
-          cnt++;
-        }
-        assertEquals(retArray1.length, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void negativeOrZeroTimeInterval() {
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 where time > 3"
-                      + "GROUP BY ([1, 30), 0ms)");
-      fail();
-    } catch (Exception e) {
-      assertTrue(e instanceof IoTDBSQLException);
-    }
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 where time > 3"
-                      + "GROUP BY ([1, 30), -1ms)");
-      fail();
-    } catch (Exception e) {
-      assertTrue(e instanceof SQLException);
-    }
-  }
-
-  @Test
-  public void slidingStepLessThanTimeInterval() {
-
-    try (Connection connection = DriverManager.
-            getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-              "select count(temperature), sum(temperature), avg(temperature) from "
-                      + "root.ln.wf01.wt01 where time > 3"
-                      + "GROUP BY ([1, 30), 2ms, 1ms)");
-      fail();
-    } catch (Exception e) {
-      assertTrue(e instanceof IoTDBSQLException);
-    }
-  }
-
-  private void prepareData() {
-    try (Connection connection = DriverManager
-            .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
-                    "root");
-         Statement statement = connection.createStatement();) {
-
-      for (String sql : dataSet1) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAddSubDeviceIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAddSubDeviceIT.java
deleted file mode 100644
index c458a01..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAddSubDeviceIT.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.integration;
-
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.Statement;
-import java.sql.Types;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-public class IoTDBAddSubDeviceIT {
-
-  private static String[] sqls = new String[]{
-      "CREATE TIMESERIES root.sg1.d1.s1 with datatype=INT32,encoding=RLE",
-      "CREATE TIMESERIES root.sg1.d1.s1.s1 with datatype=INT32,encoding=RLE",
-      "CREATE TIMESERIES root.sg1.d1.s1.s2 with datatype=INT32,encoding=RLE"
-  };
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-
-    insertData();
-
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  private static void insertData() throws ClassNotFoundException {
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-
-      for (String sql : sqls) {
-        statement.execute(sql);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
-  @Test
-  public void showDevices() throws ClassNotFoundException {
-    String[] retArray = new String[]{
-        "root.sg1.d1,",
-        "root.sg1.d1.s1,",
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SHOW DEVICES");
-      Assert.assertTrue(hasResultSet);
-
-      try (ResultSet resultSet = statement.getResultSet()) {
-        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
-        StringBuilder header = new StringBuilder();
-        for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-          header.append(resultSetMetaData.getColumnName(i)).append(",");
-        }
-        Assert.assertEquals("devices,", header.toString());
-        Assert.assertEquals(Types.VARCHAR, resultSetMetaData.getColumnType(1));
-
-        int cnt = 0;
-        while (resultSet.next()) {
-          StringBuilder builder = new StringBuilder();
-          for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-            builder.append(resultSet.getString(i)).append(",");
-          }
-          Assert.assertEquals(retArray[cnt], builder.toString());
-          cnt++;
-        }
-        Assert.assertEquals(retArray.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void showTimeseries() throws ClassNotFoundException {
-    String[] retArray = new String[]{
-        "root.sg1.d1.s1,null,root.sg1,INT32,RLE,SNAPPY,null,null,",
-        "root.sg1.d1.s1.s1,null,root.sg1,INT32,RLE,SNAPPY,null,null,",
-        "root.sg1.d1.s1.s2,null,root.sg1,INT32,RLE,SNAPPY,null,null,",
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SHOW TIMESERIES");
-      Assert.assertTrue(hasResultSet);
-
-      try (ResultSet resultSet = statement.getResultSet()) {
-        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
-        StringBuilder header = new StringBuilder();
-        for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-          header.append(resultSetMetaData.getColumnName(i)).append(",");
-        }
-        Assert.assertEquals("timeseries,alias,storage group,dataType,encoding,compression,tags,attributes,",
-            header.toString());
-        Assert.assertEquals(Types.VARCHAR, resultSetMetaData.getColumnType(1));
-
-        int cnt = 0;
-        while (resultSet.next()) {
-          StringBuilder builder = new StringBuilder();
-          for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-            builder.append(resultSet.getString(i)).append(",");
-          }
-          Assert.assertEquals(retArray[cnt], builder.toString());
-          cnt++;
-        }
-        Assert.assertEquals(retArray.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void insertDataInAllSeries() throws ClassNotFoundException {
-    String[] retArray = new String[]{
-        "0,1,2,3,",
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-         Statement statement = connection.createStatement()) {
-
-      statement.execute("INSERT INTO root.sg1.d1 (timestamp, s1) VALUES(0, 1)");
-      statement.execute("INSERT INTO root.sg1.d1.s1 (timestamp, s1) VALUES(0, 2)");
-      statement.execute("INSERT INTO root.sg1.d1.s1 (timestamp, s2) VALUES(0, 3)");
-
-      // assertEquals(1, statement.getUpdateCount());
-
-      boolean hasResultSet = statement.execute(
-          "SELECT * FROM root.sg1.d1");
-      Assert.assertTrue(hasResultSet);
-
-      try (ResultSet resultSet = statement.getResultSet()) {
-        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
-        StringBuilder header = new StringBuilder();
-        for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-          header.append(resultSetMetaData.getColumnName(i)).append(",");
-        }
-        Assert.assertEquals("Time,root.sg1.d1.s1,root.sg1.d1.s1.s1,root.sg1.d1.s1.s2,", header.toString());
-
-        int cnt = 0;
-        while (resultSet.next()) {
-          StringBuilder builder = new StringBuilder();
-          for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-            builder.append(resultSet.getString(i)).append(",");
-          }
-          Assert.assertEquals(retArray[cnt], builder.toString());
-          cnt++;
-        }
-        Assert.assertEquals(retArray.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationAlignByDeviceIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationAlignByDeviceIT.java
deleted file mode 100644
index 3655fe8..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationAlignByDeviceIT.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.integration;
-
-import static org.apache.iotdb.db.constant.TestConstant.count;
-import static org.junit.Assert.fail;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IoTDBAggregationAlignByDeviceIT {
-
-  private static final String[] dataSet = new String[]{
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1, 1.0, 1.1, 1.2)",
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(2, 2.0, 2.1, 2.2)",
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(3, 3.0, 3.1, 3.2)",
-      "flush",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1, 1.0, 1.1, 1.2)",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(2, 2.0, 2.1, 2.2)",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(3, 3.0, 3.1, 3.2)",
-      "flush",
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(1, 11.0, 11.1, 11.2)",
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(2, 12.0, 12.1, 12.2)",
-      "INSERT INTO root.sg1.d1(timestamp,s1,s2,s3) values(3, 13.0, 13.1, 13.2)",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(1, 11.0, 11.1, 11.2)",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(2, 12.0, 12.1, 12.2)",
-      "INSERT INTO root.sg1.d2(timestamp,s1,s2,s3) values(3, 13.0, 13.1, 13.2)",
-  };
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    prepareData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void test() throws SQLException {
-    String[] retArray = new String[]{"root.sg1.d1,3,3,3", "root.sg1.d2,3,3,3",};
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement
-          .execute("SELECT count(*) from root align by device");
-
-      Assert.assertTrue(hasResultSet);
-
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString("Device") + "," + resultSet.getString(count("s1"))
-                  + "," + resultSet.getString(count("s2")) + "," + resultSet
-                  .getString(count("s3"));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(retArray.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void prepareData() {
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
-            "root");
-        Statement statement = connection.createStatement()) {
-
-      for (String sql : dataSet) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationDeleteIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationDeleteIT.java
deleted file mode 100644
index d3751c2..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationDeleteIT.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.integration;
-
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.sql.*;
-
-import static org.apache.iotdb.db.constant.TestConstant.count;
-import static org.junit.Assert.*;
-
-public class IoTDBAggregationDeleteIT {
-
-
-  private static String[] dataSet = new String[]{
-      "INSERT INTO root.turbine.d1(timestamp,s1) values(1,1)",
-      "INSERT INTO root.turbine.d1(timestamp,s1) values(2,2)",
-      "INSERT INTO root.turbine.d1(timestamp,s1) values(3,3)",
-      "INSERT INTO root.turbine.d1(timestamp,s1) values(4,4)",
-      "INSERT INTO root.turbine.d1(timestamp,s1) values(5,5)",
-      "flush",
-      "delete from root.turbine.d1.s1 where time < 3"
-  };
-  private long prevPartitionInterval;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    prevPartitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(1000);
-    EnvironmentUtils.envSetUp();
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    prepareData();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(prevPartitionInterval);
-  }
-
-  @Test
-  public void countAfterDeleteTest() {
-    try (Connection connection =
-        DriverManager.getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet =
-          statement.execute("select count(*) from root");
-
-      assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        while (resultSet.next()) {
-          assertEquals("3", resultSet.getString(count("root.turbine.d1.s1")));
-        }
-      }
-
-    } catch (SQLException e) {
-      e.printStackTrace();
-      fail();
-    }
-  }
-
-  private void prepareData() {
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root",
-            "root");
-        Statement statement = connection.createStatement()) {
-
-      for (String sql : dataSet) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationLargeDataIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationLargeDataIT.java
deleted file mode 100644
index fa0ae8d..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationLargeDataIT.java
+++ /dev/null
@@ -1,842 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.integration;
-
-import static org.apache.iotdb.db.constant.TestConstant.avg;
-import static org.apache.iotdb.db.constant.TestConstant.count;
-import static org.apache.iotdb.db.constant.TestConstant.first_value;
-import static org.apache.iotdb.db.constant.TestConstant.last_value;
-import static org.apache.iotdb.db.constant.TestConstant.max_time;
-import static org.apache.iotdb.db.constant.TestConstant.max_value;
-import static org.apache.iotdb.db.constant.TestConstant.min_time;
-import static org.apache.iotdb.db.constant.TestConstant.min_value;
-import static org.apache.iotdb.db.constant.TestConstant.sum;
-import static org.junit.Assert.fail;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IoTDBAggregationLargeDataIT {
-
-  private static final String TIMESTAMP_STR = "Time";
-  private final String d0s0 = "root.vehicle.d0.s0";
-  private final String d0s1 = "root.vehicle.d0.s1";
-  private final String d0s2 = "root.vehicle.d0.s2";
-  private final String d0s3 = "root.vehicle.d0.s3";
-  private final String d0s4 = "root.vehicle.d0.s4";
-
-  private static String[] createSql = new String[]{
-      "SET STORAGE GROUP TO root.vehicle",
-      "CREATE TIMESERIES root.vehicle.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s2 WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s3 WITH DATATYPE=TEXT, ENCODING=PLAIN",
-      "CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s4 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN",
-  };
-
-  private static String[] insertSql = new String[]{
-      "insert into root.vehicle.d0(timestamp,s0) values(1,101)",
-      "insert into root.vehicle.d0(timestamp,s0) values(2,198)",
-      "insert into root.vehicle.d0(timestamp,s0) values(100,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(101,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(102,80)",
-      "insert into root.vehicle.d0(timestamp,s0) values(103,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(104,90)",
-      "insert into root.vehicle.d0(timestamp,s0) values(105,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(106,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(2,10000)",
-      "insert into root.vehicle.d0(timestamp,s0) values(50,10000)",
-      "insert into root.vehicle.d0(timestamp,s0) values(1000,22222)",
-      "insert into root.vehicle.d0(timestamp,s0) values(106,199)",
-      "DELETE FROM root.vehicle.d0.s0 WHERE time < 104",
-
-      "insert into root.vehicle.d0(timestamp,s1) values(1,1101)",
-      "insert into root.vehicle.d0(timestamp,s1) values(2,198)",
-      "insert into root.vehicle.d0(timestamp,s1) values(100,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(101,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(102,180)",
-      "insert into root.vehicle.d0(timestamp,s1) values(103,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(104,190)",
-      "insert into root.vehicle.d0(timestamp,s1) values(105,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(2,40000)",
-      "insert into root.vehicle.d0(timestamp,s1) values(50,50000)",
-      "insert into root.vehicle.d0(timestamp,s1) values(1000,55555)",
-
-      "insert into root.vehicle.d0(timestamp,s2) values(1000,55555)",
-      "insert into root.vehicle.d0(timestamp,s2) values(2,2.22)",
-      "insert into root.vehicle.d0(timestamp,s2) values(3,3.33)",
-      "insert into root.vehicle.d0(timestamp,s2) values(4,4.44)",
-      "insert into root.vehicle.d0(timestamp,s2) values(102,10.00)",
-      "insert into root.vehicle.d0(timestamp,s2) values(105,11.11)",
-      "insert into root.vehicle.d0(timestamp,s2) values(1000,1000.11)",
-
-      "insert into root.vehicle.d0(timestamp,s3) values(60,'aaaaa')",
-      "insert into root.vehicle.d0(timestamp,s3) values(70,'bbbbb')",
-      "insert into root.vehicle.d0(timestamp,s3) values(80,'ccccc')",
-      "insert into root.vehicle.d0(timestamp,s3) values(101,'ddddd')",
-      "insert into root.vehicle.d0(timestamp,s3) values(102,'fffff')",
-
-      "insert into root.vehicle.d1(timestamp,s0) values(1,999)",
-      "insert into root.vehicle.d1(timestamp,s0) values(1000,888)",
-
-      "insert into root.vehicle.d0(timestamp,s4) values(100, false)",
-      "insert into root.vehicle.d0(timestamp,s4) values(100, true)",
-  };
-
-  private long prevPartitionInterval;
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    prevPartitionInterval = IoTDBDescriptor.getInstance().getConfig().getPartitionInterval();
-    EnvironmentUtils.envSetUp();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-    IoTDBDescriptor.getInstance().getConfig().setPartitionInterval(prevPartitionInterval);
-  }
-
-  @Test
-  public void test() throws ClassNotFoundException, SQLException {
-    insertSQL();
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");) {
-      lastValueAggreWithSingleFilterTest();
-      avgAggreWithSingleFilterTest();
-      sumAggreWithSingleFilterTest();
-      firstAggreWithSingleFilterTest();
-      countAggreWithSingleFilterTest();
-      minMaxTimeAggreWithSingleFilterTest();
-      minValueAggreWithSingleFilterTest();
-      maxValueAggreWithSingleFilterTest();
-
-      lastValueAggreWithMultiFilterTest();
-      countAggreWithMultiFilterTest();
-      minTimeAggreWithMultiFilterTest();
-      maxTimeAggreWithMultiFilterTest();
-      minValueAggreWithMultiFilterTest();
-      maxValueAggreWithMultiFilterTest();
-      avgAggreWithMultiFilterTest();
-      sumAggreWithMultiFilterTest();
-      firstAggreWithMultiFilterTest();
-    }
-  }
-
-  private void lastValueAggreWithMultiFilterTest() throws SQLException {
-    String[] retArray = new String[]{
-        "0,9,39,63.0,E,true"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "select last_value(s0),last_value(s1),last_value(s2),last_value(s3),last_value(s4)" +
-              " from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," +
-              resultSet.getString(last_value(d0s0)) + "," + resultSet
-              .getString(last_value(d0s1))
-              + "," + resultSet.getString(last_value(d0s2)) + "," +
-              resultSet.getString(last_value(d0s3)) + "," + resultSet
-              .getString(last_value(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void lastValueAggreWithSingleFilterTest() throws SQLException {
-    String[] retArray = new String[]{
-        "0,9,39,63.0"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement
-          .execute("select last_value(s0),last_value(s1),last_value(s2)" +
-              " from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," +
-              resultSet.getString(last_value(d0s0)) + ","
-              + resultSet.getString(last_value(d0s1)) + "," +
-              resultSet.getString(last_value(d0s2));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void sumAggreWithSingleFilterTest() {
-    String[] retArray = new String[]{
-        "0,55061.0,156752.0,20254"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select sum(s0),sum(s1),sum(s2)" +
-          " from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(sum(d0s0)) + ","
-                  + resultSet.getString(sum(d0s1)) + "," + Math
-                  .round(resultSet.getDouble(sum(d0s2)));
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void firstAggreWithSingleFilterTest() {
-    String[] retArray = new String[]{
-        "0,90,1101,2.22,ddddd,true"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement
-          .execute("select first_value(s0),first_value(s1),first_value(s2),first_value(s3),"
-              + "first_value(s4) from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," +
-              resultSet.getString(first_value(d0s0)) + ","
-              + resultSet.getString(first_value(d0s1)) + "," +
-              resultSet.getString(first_value(d0s2))
-              + "," + resultSet.getString(first_value(d0s3)) + "," +
-              resultSet.getString(first_value(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void avgAggreWithSingleFilterTest() {
-    String[] retArray = new String[]{
-        "0,75,212,28"
-    };
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement();) {
-
-      boolean hasResultSet = statement.execute(
-          "select avg(s0),avg(s1),avg(s2) from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + Math.round(resultSet.getDouble(avg(d0s0)))
-                  + "," + Math.round(resultSet.getDouble(avg(d0s1))) + "," +
-                  Math.round(resultSet.getDouble(avg(d0s2)));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void countAggreWithSingleFilterTest() throws SQLException {
-    String[] retArray = new String[]{
-        "0,733,740,734"
-    };
-
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute(
-          "select count(s0),count(s1),count(s2) from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0))
-              + "," + resultSet.getString(count(d0s1)) + "," + resultSet.getString(count(d0s2));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void minMaxTimeAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,104,1,2,101,100"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute(
-          "select min_time(s0),min_time(s1),min_time(s2),min_time(s3),min_time(s4)" +
-              " from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," +
-                  resultSet.getString(min_time(d0s0)) + "," +
-                  resultSet.getString(min_time(d0s1)) + "," +
-                  resultSet.getString(min_time(d0s2)) +
-                  "," + resultSet.getString(min_time(d0s3)) +
-                  "," + resultSet.getString(min_time(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-
-      retArray = new String[]{
-          "0,3999,3999,3999,3599,100"
-      };
-      hasResultSet = statement.execute("select max_time(s0),max_time(s1),max_time(s2),"
-          + "max_time(s3),max_time(s4) from root.vehicle.d0 " +
-          "where s1 < 50000 and s1 != 100");
-      Assert.assertTrue(hasResultSet);
-      resultSet = statement.getResultSet();
-      cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_time(d0s0))
-                  + "," + resultSet.getString(max_time(d0s1)) + "," + resultSet.getString(max_time(d0s2))
-                  + "," + resultSet.getString(max_time(d0s3)) + "," + resultSet.getString(max_time(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void minValueAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,0,0,0.0,B,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("select min_value(s0),min_value(s1),min_value(s2),"
-          + "min_value(s3),min_value(s4) from root.vehicle.d0 " +
-          "where s1 < 50000 and s1 != 100");
-
-      if (hasResultSet) {
-        ResultSet resultSet = statement.getResultSet();
-        int cnt = 0;
-        try {
-          while (resultSet.next()) {
-            String ans =
-                    resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(min_value(d0s0))
-                            + "," + resultSet.getString(min_value(d0s1)) + "," + resultSet
-                            .getString(min_value(d0s2))
-                            + "," + resultSet.getString(min_value(d0s3)) + "," + resultSet
-                            .getString(min_value(d0s4));
-            //System.out.println("============ " + ans);
-            Assert.assertEquals(ans, retArray[cnt]);
-            cnt++;
-          }
-          Assert.assertEquals(1, cnt);
-        } finally {
-          resultSet.close();
-        }
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void maxValueAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,99,40000,122.0,fffff,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select max_value(s0),max_value(s1),max_value(s2),"
-          + "max_value(s3),max_value(s4) from root.vehicle.d0 " +
-          "where s1 < 50000 and s1 != 100");
-
-      if (hasResultSet) {
-        ResultSet resultSet = statement.getResultSet();
-        int cnt = 0;
-        try {
-          while (resultSet.next()) {
-            String ans =
-                    resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_value(d0s0))
-                            + "," + resultSet.getString(max_value(d0s1)) + "," + resultSet
-                            .getString(max_value(d0s2))
-                            + "," + resultSet.getString(max_value(d0s3)) + "," + resultSet
-                            .getString(max_value(d0s4));
-            //System.out.println("============ " + ans);
-            Assert.assertEquals(ans, retArray[cnt]);
-            cnt++;
-          }
-          Assert.assertEquals(1, cnt);
-        } finally {
-          resultSet.close();
-        }
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void avgAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,55061.0,733,75,212,28"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select sum(s0),count(s0),avg(s0),avg(s1),"
-          + "avg(s2) from root.vehicle.d0 " +
-          "where s1 >= 0 or s2 < 10");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans =
-                  resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(sum(d0s0)) + "," +
-                          resultSet.getString(count(d0s0)) + "," + Math.round(resultSet.getDouble(avg(d0s0)))
-                          + "," +
-                          Math.round(resultSet.getDouble(avg(d0s1))) + "," + Math
-                          .round(resultSet.getDouble(avg(d0s2)));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void sumAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,55061.0,156752.0,20262"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select sum(s0),sum(s1),sum(s2) from root.vehicle.d0"
-          + " where s1 >= 0 or s2 < 10");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(sum(d0s0))
-                  + "," + resultSet.getString(sum(d0s1)) + "," + Math
-                  .round(resultSet.getDouble(sum(d0s2)));
-          //String ans = resultSet.getString(sum(d0s3));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void firstAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,90,1101,2.22,ddddd,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement
-          .execute("select first_value(s0),first_value(s1),first_value(s2),first_value(s3),"
-              + "first_value(s4) from root.vehicle.d0 where s1 >= 0 or s2 < 10");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans =
-                  resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(first_value(d0s0))
-                          + "," + resultSet.getString(first_value(d0s1)) + "," + resultSet
-                          .getString(first_value(d0s2))
-                          + "," + resultSet.getString(first_value(d0s3)) + "," + resultSet
-                          .getString(first_value(d0s4));
-          //String ans = resultSet.getString(first_value(d0s3));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void countAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,733,740,736,482,1"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select count(s0),count(s1),count(s2),count(s3),"
-          + "count(s4) from root.vehicle.d0 where s1 >= 0 or s2 < 10");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0))
-                  + "," + resultSet.getString(count(d0s1)) + "," + resultSet.getString(count(d0s2))
-                  + "," + resultSet.getString(count(d0s3)) + "," + resultSet.getString(count(d0s4));
-          //String ans = resultSet.getString(count(d0s3));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void minTimeAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,104,1,2,101,100"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select min_time(s0),min_time(s1),min_time(s2),"
-          + "min_time(s3),min_time(s4) from root.vehicle.d0 where s1 >= 0");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," +
-                  resultSet.getString(min_time(d0s0)) + "," +
-                  resultSet.getString(min_time(d0s1)) + "," +
-                  resultSet.getString(min_time(d0s2)) + "," +
-                  resultSet.getString(min_time(d0s3)) + "," +
-                  resultSet.getString(min_time(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void maxTimeAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,3999,3999,3999,3599,100"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select max_time(s0),max_time(s1),max_time(s2),"
-          + "max_time(s3),max_time(s4) from root.vehicle.d0 " +
-          "where s1 < 50000 and s1 != 100");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_time(d0s0))
-                  + "," + resultSet.getString(max_time(d0s1)) + "," + resultSet.getString(max_time(d0s2))
-                  + "," + resultSet.getString(max_time(d0s3)) + "," + resultSet.getString(max_time(d0s4));
-          //System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void minValueAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,0,0,0.0,B,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select min_value(s0),min_value(s1),min_value(s2),"
-          + "min_value(s3),min_value(s4) from root.vehicle.d0 " +
-          "where s1 < 50000 and s1 != 100");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(min_value(d0s0))
-                  + "," + resultSet.getString(min_value(d0s1)) + "," + resultSet
-                  .getString(min_value(d0s2))
-                  + "," + resultSet.getString(min_value(d0s3)) + "," + resultSet
-                  .getString(min_value(d0s4));
-          //System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private void maxValueAggreWithMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,99,40000,122.0,fffff,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute("select max_value(s0),max_value(s1),max_value(s2),"
-          + "max_value(s3),max_value(s4) from root.vehicle.d0 where s1 < 50000 and s1 != 100");
-      Assert.assertTrue(hasResultSet);
-      ResultSet resultSet = statement.getResultSet();
-      int cnt = 0;
-      try {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_value(d0s0))
-                  + "," + resultSet.getString(max_value(d0s1)) + "," + resultSet
-                  .getString(max_value(d0s2))
-                  + "," + resultSet.getString(max_value(d0s3)) + "," + resultSet
-                  .getString(max_value(d0s4));
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      } finally {
-        resultSet.close();
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  private static String[] stringValue = new String[]{"A", "B", "C", "D", "E"};
-
-  public static void insertSQL() throws ClassNotFoundException, SQLException {
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    double d0s0sum = 0.0, d0s1sum = 0.0, d0s2sum = 0.0;
-    int cnt = 0;
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      for (String sql : createSql) {
-        statement.execute(sql);
-      }
-
-      // insert large amount of data
-      for (int time = 3000; time < 3600; time++) {
-        if (time % 5 == 0) {
-          continue;
-        }
-
-        String sql = String.format("insert into root.vehicle.d0(timestamp,s0) values(%s,%s)",
-            time, time % 100);
-        statement.execute(sql);
-        sql = String.format("insert into root.vehicle.d0(timestamp,s1) values(%s,%s)",
-            time, time % 17);
-        statement.execute(sql);
-        sql = String.format("insert into root.vehicle.d0(timestamp,s2) values(%s,%s)",
-            time, time % 22);
-        statement.execute(sql);
-        sql = String.format("insert into root.vehicle.d0(timestamp,s3) values(%s,'%s')",
-            time, stringValue[time % 5]);
-        statement.execute(sql);
-        cnt++;
-        d0s0sum += time % 100;
-        d0s1sum += time % 17;
-        d0s2sum += time % 22;
-      }
-
-      statement.execute("flush");
-
-      // insert large amount of data
-      for (int time = 3700; time < 4000; time++) {
-        if (time % 6 == 0) {
-          continue;
-        }
-
-        String sql = String.format("insert into root.vehicle.d0(timestamp,s0) values(%s,%s)",
-            time, time % 70);
-        statement.execute(sql);
-        sql = String.format("insert into root.vehicle.d0(timestamp,s1) values(%s,%s)",
-            time, time % 40);
-        statement.execute(sql);
-        sql = String.format("insert into root.vehicle.d0(timestamp,s2) values(%s,%s)",
-            time, time % 123);
-        statement.execute(sql);
-
-        cnt++;
-        d0s0sum += time % 70;
-        d0s1sum += time % 40;
-        d0s2sum += time % 123;
-      }
-
-      statement.execute("merge");
-      for (String sql : insertSql) {
-        statement.execute(sql);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationSmallDataIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationSmallDataIT.java
deleted file mode 100644
index b73ff06..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAggregationSmallDataIT.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.iotdb.db.integration;
-
-import static org.apache.iotdb.db.constant.TestConstant.avg;
-import static org.apache.iotdb.db.constant.TestConstant.count;
-import static org.apache.iotdb.db.constant.TestConstant.first_value;
-import static org.apache.iotdb.db.constant.TestConstant.last_value;
-import static org.apache.iotdb.db.constant.TestConstant.max_time;
-import static org.apache.iotdb.db.constant.TestConstant.max_value;
-import static org.apache.iotdb.db.constant.TestConstant.min_time;
-import static org.apache.iotdb.db.constant.TestConstant.min_value;
-import static org.apache.iotdb.db.constant.TestConstant.sum;
-import static org.junit.Assert.fail;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.apache.iotdb.jdbc.IoTDBSQLException;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Multiple aggregation with filter test.
- */
-public class IoTDBAggregationSmallDataIT {
-
-  private static final String TIMESTAMP_STR = "Time";
-  private final String d0s0 = "root.vehicle.d0.s0";
-  private final String d0s1 = "root.vehicle.d0.s1";
-  private final String d0s2 = "root.vehicle.d0.s2";
-  private final String d0s3 = "root.vehicle.d0.s3";
-  private final String d0s4 = "root.vehicle.d0.s4";
-  private final String d1s0 = "root.vehicle.d1.s0";
-  private final String d1s1 = "root.vehicle.d1.s1";
-
-  private static String[] sqls = new String[]{
-      "SET STORAGE GROUP TO root.vehicle",
-      "CREATE TIMESERIES root.vehicle.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE",
-
-      "CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s2 WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.vehicle.d0.s3 WITH DATATYPE=TEXT, ENCODING=PLAIN",
-      "CREATE TIMESERIES root.vehicle.d0.s4 WITH DATATYPE=BOOLEAN, ENCODING=PLAIN",
-
-      "insert into root.vehicle.d0(timestamp,s0) values(1,101)",
-      "insert into root.vehicle.d0(timestamp,s0) values(2,198)",
-      "insert into root.vehicle.d0(timestamp,s0) values(100,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(101,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(102,80)",
-      "insert into root.vehicle.d0(timestamp,s0) values(103,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(104,90)",
-      "insert into root.vehicle.d0(timestamp,s0) values(105,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(106,99)",
-      "insert into root.vehicle.d0(timestamp,s0) values(2,10000)",
-      "insert into root.vehicle.d0(timestamp,s0) values(50,10000)",
-      "insert into root.vehicle.d0(timestamp,s0) values(1000,22222)",
-      "insert into root.vehicle.d0(timestamp,s0) values(106,199)",
-      "DELETE FROM root.vehicle.d0.s0 WHERE time < 104",
-
-      "insert into root.vehicle.d0(timestamp,s1) values(1,1101)",
-      "insert into root.vehicle.d0(timestamp,s1) values(2,198)",
-      "insert into root.vehicle.d0(timestamp,s1) values(100,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(101,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(102,180)",
-      "insert into root.vehicle.d0(timestamp,s1) values(103,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(104,190)",
-      "insert into root.vehicle.d0(timestamp,s1) values(105,199)",
-      "insert into root.vehicle.d0(timestamp,s1) values(2,40000)",
-      "insert into root.vehicle.d0(timestamp,s1) values(50,50000)",
-      "insert into root.vehicle.d0(timestamp,s1) values(1000,55555)",
-
-      "insert into root.vehicle.d0(timestamp,s2) values(1000,55555)",
-      "insert into root.vehicle.d0(timestamp,s2) values(2,2.22)",
-      "insert into root.vehicle.d0(timestamp,s2) values(3,3.33)",
-      "insert into root.vehicle.d0(timestamp,s2) values(4,4.44)",
-      "insert into root.vehicle.d0(timestamp,s2) values(102,10.00)",
-      "insert into root.vehicle.d0(timestamp,s2) values(105,11.11)",
-      "insert into root.vehicle.d0(timestamp,s2) values(1000,1000.11)",
-
-      "insert into root.vehicle.d0(timestamp,s3) values(60,'aaaaa')",
-      "insert into root.vehicle.d0(timestamp,s3) values(70,'bbbbb')",
-      "insert into root.vehicle.d0(timestamp,s3) values(80,'ccccc')",
-      "insert into root.vehicle.d0(timestamp,s3) values(101,'ddddd')",
-      "insert into root.vehicle.d0(timestamp,s3) values(102,'fffff')",
-
-      "insert into root.vehicle.d1(timestamp,s0) values(1,999)",
-      "insert into root.vehicle.d1(timestamp,s0) values(1000,888)",
-
-      "insert into root.vehicle.d0(timestamp,s1) values(2000-01-01T08:00:00+08:00, 100)",
-      "insert into root.vehicle.d0(timestamp,s3) values(2000-01-01T08:00:00+08:00, 'good')",
-
-      "insert into root.vehicle.d0(timestamp,s4) values(100, false)",
-      "insert into root.vehicle.d0(timestamp,s4) values(100, true)"
-  };
-
-  @Before
-  public void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-
-    //Thread.sleep(5000);
-    insertSQL();
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-  @Test
-  public void countOnlyTimeFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,3,7,4,5,1"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SELECT count(s0),count(s1),count(s2),count(s3),count(s4) " +
-              "FROM root.vehicle.d0 WHERE time >= 3 AND time <= 106");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0))
-              + "," + resultSet.getString(count(d0s1)) + "," + resultSet.getString(count(d0s2))
-              + "," + resultSet.getString(count(d0s3)) + "," + resultSet.getString(count(d0s4));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void functionsNoFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,4,0,6,1",
-        "0,22222,null",
-        "0,90,null,aaaaa",
-        "0,22222,null,good",
-        "0,22610.0,0.0"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      //select count(d0.s0),count(d1.s1),count(d0.s3),count(d0.s4) from root.vehicle
-      boolean hasResultSet = statement.execute(
-          "SELECT count(d0.s0),count(d1.s1),count(d0.s3),count(d0.s4) FROM root.vehicle");
-
-      Assert.assertTrue(hasResultSet);
-      int cnt;
-      try (ResultSet resultSet = statement.getResultSet()) {
-        cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0))
-              + "," + resultSet.getString(count(d1s1)) + "," + resultSet.getString(count(d0s3))
-              + "," + resultSet.getString(count(d0s4));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-
-      //select max_value(d0.s0),max_value(d1.s1),max_value(d0.s3) from root.vehicle
-
-      try {
-        statement.execute(
-            "SELECT max_value(d0.s0),max_value(d1.s1),max_value(d0.s3) FROM root.vehicle");
-        fail();
-      } catch (IoTDBSQLException e) {
-        Assert.assertEquals("500: Binary statistics does not support: max", e.getMessage());
-      }
-
-      hasResultSet = statement.execute(
-          "SELECT max_value(d0.s0),max_value(d1.s1) FROM root.vehicle");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_value(d0s0))
-                  + "," + resultSet.getString(max_value(d1s1));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(2, cnt);
-      }
-
-      //select first_value(d0.s0),first_value(d1.s1),first_value(d0.s3) from root.vehicle
-      hasResultSet = statement.execute(
-          "SELECT first_value(d0.s0),first_value(d1.s1),first_value(d0.s3) FROM root.vehicle");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(first_value(d0s0))
-                  + "," + resultSet.getString(first_value(d1s1)) + "," + resultSet
-                  .getString(first_value(d0s3));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(3, cnt);
-      }
-
-      //select last_value(d0.s0),last_value(d1.s1),last_value(d0.s3) from root.vehicle
-      hasResultSet = statement.execute(
-          "SELECT last_value(d0.s0),last_value(d1.s1),last_value(d0.s3) FROM root.vehicle");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(last_value(d0s0))
-                  + "," + resultSet.getString(last_value(d1s1)) + "," + resultSet
-                  .getString(last_value(d0s3));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(4, cnt);
-      }
-
-      //select sum(d0.s0),sum(d1.s1),sum(d0.s3) from root.vehicle
-      hasResultSet = statement.execute("SELECT sum(d0.s0),sum(d1.s1) FROM root.vehicle");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(sum(d0s0))
-              + "," + resultSet.getString(sum(d1s1));
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(5, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void lastAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,22222,55555"
-    };
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      boolean hasResultSet = statement.execute(
-          "SELECT last_value(s0),last_value(s1) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(last_value(d0s0)) + ","
-                  + resultSet.getString(last_value(d0s1));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void firstAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,99,180"
-    };
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement();) {
-
-      boolean hasResultSet = statement.execute(
-          "SELECT first_value(s0),first_value(s1) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(first_value(d0s0))
-                  + ","
-                  + resultSet.getString(first_value(d0s1));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void sumAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,22321.0,55934.0,1029"
-    };
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SELECT sum(s0),sum(s1),sum(s2) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(sum(d0s0))
-              + "," + resultSet.getString(sum(d0s1)) + "," + Math
-              .round(resultSet.getDouble(sum(d0s2)));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void avgAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,11160.5,18645,206"
-    };
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SELECT avg(s0),avg(s1),avg(s2) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(avg(d0s0))
-              + "," + Math.round(resultSet.getDouble(avg(d0s1))) + ","
-              + Math.round(resultSet.getDouble(avg(d0s2)));
-          //System.out.println("!!!!!============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,2,3,5,1,0"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT count(s0),count(s1),count(s2),count(s3),"
-          + "count(s4) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      // System.out.println(hasResultSet + "...");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0))
-              + "," + resultSet.getString(count(d0s1)) + "," + resultSet.getString(count(d0s2))
-              + "," + resultSet.getString(count(d0s3)) + "," + resultSet.getString(count(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(retArray[cnt], ans);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void minTimeAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,104,1,2,101,100"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT min_time(s0),min_time(s1),min_time(s2)"
-          + ",min_time(s3),min_time(s4) FROM root.vehicle.d0 " +
-          "WHERE s1 < 50000 AND s1 != 100");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(min_time(d0s0))
-                  + "," + resultSet.getString(min_time(d0s1)) + "," + resultSet
-                  .getString(min_time(d0s2))
-                  + "," + resultSet.getString(min_time(d0s3)) + "," + resultSet
-                  .getString(min_time(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-          Assert.assertEquals(1, cnt);
-        }
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void maxTimeAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,105,105,105,102,100"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT max_time(s0),max_time(s1),max_time(s2)"
-          + ",max_time(s3),max_time(s4) FROM root.vehicle.d0 " +
-          "WHERE s1 < 50000 AND s1 != 100");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_time(d0s0))
-                  + "," + resultSet.getString(max_time(d0s1)) + "," + resultSet
-                  .getString(max_time(d0s2))
-                  + "," + resultSet.getString(max_time(d0s3)) + "," + resultSet
-                  .getString(max_time(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void minValueAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,90,180,2.22,ddddd,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT min_value(s0),min_value(s1),min_value(s2)"
-          + ",min_value(s3),min_value(s4) FROM root.vehicle.d0 " +
-          "WHERE s1 < 50000 AND s1 != 100");
-      Assert.assertTrue(hasResultSet);
-
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(min_value(d0s0))
-                  + "," + resultSet.getString(min_value(d0s1)) +
-                  "," + resultSet.getString(min_value(d0s2))
-                  + "," + resultSet.getString(min_value(d0s3)) + ","
-                  + resultSet.getString(min_value(d0s4));
-          // System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void maxValueAggreWithSingleFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,99,50000,11.11,fffff,true"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT max_value(s0),max_value(s1),max_value(s2),"
-          + "max_value(s3),max_value(s4) FROM root.vehicle.d0 " +
-          "WHERE s1 < 50000 AND s1 != 100");
-
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans =
-              resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(max_value(d0s0))
-                  + "," + resultSet.getString(max_value(d0s1)) + "," + resultSet
-                  .getString(max_value(d0s2))
-                  + "," + resultSet.getString(max_value(d0s3)) + "," + resultSet
-                  .getString(max_value(d0s4));
-          //System.out.println("============ " + ans);
-          //Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void countAggreWithMultiMultiFilterTest() throws ClassNotFoundException, SQLException {
-    String[] retArray = new String[]{
-        "0,2",
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute(
-          "SELECT count(s0) FROM root.vehicle.d0 WHERE s2 >= 3.33");
-      // System.out.println(hasResultSet + "...");
-      Assert.assertTrue(hasResultSet);
-      try (ResultSet resultSet = statement.getResultSet()) {
-        int cnt = 0;
-        while (resultSet.next()) {
-          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(count(d0s0));
-          //System.out.println("============ " + ans);
-          Assert.assertEquals(ans, retArray[cnt]);
-          cnt++;
-        }
-        Assert.assertEquals(1, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  @Test
-  public void selectAllSQLTest() throws ClassNotFoundException, SQLException {
-    //d0s0,d0s1,d0s2,d0s3,d1s0
-    String[] retArray = new String[]{
-        "1,null,1101,null,null,999",
-        "2,null,40000,2.22,null,null",
-        "3,null,null,3.33,null,null",
-        "4,null,null,4.44,null,null",
-        "50,null,50000,null,null,null",
-        "60,null,null,null,aaaaa,null",
-        "70,null,null,null,bbbbb,null",
-        "80,null,null,null,ccccc,null",
-        "100,null,199,null,null,null",
-        "101,null,199,null,ddddd,null",
-        "102,null,180,10.0,fffff,null",
-        "103,null,199,null,null,null",
-        "104,90,190,null,null,null",
-        "105,99,199,11.11,null,null",
-        "106,199,null,null,null,null",
-        "1000,22222,55555,1000.11,null,888",
-        "946684800000,null,100,null,good,null"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.
-        getConnection("jdbc:iotdb://127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("SELECT * FROM root");
-      // System.out.println(hasResultSet + "...");
-      if (hasResultSet) {
-        try (ResultSet resultSet = statement.getResultSet()) {
-          int cnt = 0;
-          while (resultSet.next()) {
-            String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(d0s0) + ","
-                + resultSet.getString(d0s1) + "," + resultSet.getString(d0s2) + "," +
-                resultSet.getString(d0s3) + "," + resultSet.getString(d1s0);
-            // System.out.println(ans);
-            Assert.assertEquals(ans, retArray[cnt]);
-            cnt++;
-          }
-          Assert.assertEquals(17, cnt);
-        }
-      }
-
-      retArray = new String[]{
-          "100,true"
-      };
-      hasResultSet = statement.execute("SELECT s4 FROM root.vehicle.d0");
-      if (hasResultSet) {
-        try (ResultSet resultSet = statement.getResultSet()) {
-          int cnt = 0;
-          while (resultSet.next()) {
-            String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(d0s4);
-            Assert.assertEquals(ans, retArray[cnt]);
-            cnt++;
-          }
-          Assert.assertEquals(1, cnt);
-        }
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-  public static void insertSQL() throws ClassNotFoundException {
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager.getConnection
-        (Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement();) {
-
-      for (String sql : sqls) {
-        statement.execute(sql);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
-
-}
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAliasIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAliasIT.java
deleted file mode 100644
index 5fe6e32..0000000
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBAliasIT.java
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.iotdb.db.integration;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.ResultSetMetaData;
-import java.sql.Statement;
-import org.apache.iotdb.db.utils.EnvironmentUtils;
-import org.apache.iotdb.jdbc.Config;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class IoTDBAliasIT {
-
-  private static String[] sqls = new String[]{
-      "SET STORAGE GROUP TO root.sg",
-      "CREATE TIMESERIES root.sg.d1.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.sg.d1.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.sg.d2.s1(speed) WITH DATATYPE=FLOAT, ENCODING=RLE",
-      "CREATE TIMESERIES root.sg.d2.s2(temperature) WITH DATATYPE=FLOAT, ENCODING=RLE",
-
-      "CREATE TIMESERIES root.sg.d2.s3(power) WITH DATATYPE=FLOAT, ENCODING=RLE",
-
-      "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(100, 10.1, 20.7)",
-      "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(200, 15.2, 22.9)",
-      "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(300, 30.3, 25.1)",
-      "INSERT INTO root.sg.d1(timestamp,speed,temperature) values(400, 50.4, 28.3)",
-
-      "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(100, 11.1, 20.2, 80.0)",
-      "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(200, 20.2, 21.8, 81.0)",
-      "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(300, 45.3, 23.4, 82.0)",
-      "INSERT INTO root.sg.d2(timestamp,speed,temperature,power) values(400, 73.4, 26.3, 83.0)"
-  };
-
-  private static final String TIMESTAMP_STR = "Time";
-  private static final String TIMESEIRES_STR = "timeseries";
-  private static final String VALUE_STR = "value";
-
-  @BeforeClass
-  public static void setUp() throws Exception {
-    EnvironmentUtils.closeStatMonitor();
-    EnvironmentUtils.envSetUp();
-
-    insertData();
-  }
-
-  @AfterClass
-  public static void tearDown() throws Exception {
-    EnvironmentUtils.cleanEnv();
-  }
-
-
-  private static void insertData() throws ClassNotFoundException {
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-
-      for (String sql : sqls) {
-        statement.execute(sql);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-    }
-  }
-
-  @Test
-  public void selectWithAliasTest() throws ClassNotFoundException {
-    String[] retArray = new String[]{
-        "100,10.1,20.7,",
-        "200,15.2,22.9,",
-        "300,30.3,25.1,",
-        "400,50.4,28.3,"
-    };
-
-    Class.forName(Config.JDBC_DRIVER_NAME);
-    try (Connection connection = DriverManager
-        .getConnection(Config.IOTDB_URL_PREFIX + "127.0.0.1:6667/", "root", "root");
-        Statement statement = connection.createStatement()) {
-      boolean hasResultSet = statement.execute("select speed, temperature from root.sg.d1");
-      Assert.assertTrue(hasResultSet);
-
-      try (ResultSet resultSet = statement.getResultSet()) {
-        ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
-        StringBuilder header = new StringBuilder();
-        for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-          header.append(resultSetMetaData.getColumnName(i)).append(",");
-        }
-        assertEquals("Time,root.sg.d1.speed,root.sg.d1.temperature,", header.toString());
-
-        int cnt = 0;
-        while (resultSet.next()) {
-          StringBuilder builder = new StringBuilder();
-          for (int i = 1; i <= resultSetMetaData.getColumnCount(); i++) {
-            builder.append(resultSet.getString(i)).append(",");
-          }
-          assertEquals(retArray[cnt], builder.toString());
-          cnt++;
-        }
-        assertEquals(retArray.length, cnt);
-      }
-    } catch (Exception e) {
-      e.printStackTrace();
-      fail(e.getMessage());
-    }
-  }
... 28605 lines suppressed ...