You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/05/29 12:40:30 UTC
[incubator-iotdb] branch add_restart_test created (now d3d70de)
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a change to branch add_restart_test
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.
at d3d70de add some test
This branch includes the following new commits:
new d3d70de add some test
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
[incubator-iotdb] 01/01: add some test
Posted by qi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch add_restart_test
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit d3d70dee3cc01fbb21629877ac9c6f7099beeaed
Author: qiaojialin <64...@qq.com>
AuthorDate: Fri May 29 20:41:00 2020 +0800
add some test
---
.../iotdb/db/integration/IoTDBRestartIT.java | 103 +++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRestartIT.java b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRestartIT.java
index e0a657e..d070097 100644
--- a/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRestartIT.java
+++ b/server/src/test/java/org/apache/iotdb/db/integration/IoTDBRestartIT.java
@@ -142,4 +142,107 @@ public class IoTDBRestartIT {
EnvironmentUtils.cleanEnv();
}
+
+ @Test
+ public void testRestartQueryLargerThanEndTime()
+ throws SQLException, ClassNotFoundException, IOException, StorageEngineException {
+ EnvironmentUtils.envSetUp();
+ 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.turbine.d1(timestamp,s1) values(1,1)");
+ statement.execute("insert into root.turbine.d1(timestamp,s1) values(2,2)");
+ }
+
+ EnvironmentUtils.restartDaemon();
+
+ 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.turbine.d1(timestamp,s1) values(3,1)");
+ statement.execute("insert into root.turbine.d1(timestamp,s1) values(4,2)");
+ }
+
+ EnvironmentUtils.restartDaemon();
+
+ 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 s1 FROM root.turbine.d1 where time > 3");
+ assertTrue(hasResultSet);
+ String[] exp = new String[]{
+ "4,2.0",
+ };
+ ResultSet resultSet = statement.getResultSet();
+ int cnt = 0;
+ while (resultSet.next()) {
+ String result = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(2);
+ assertEquals(exp[cnt], result);
+ cnt++;
+ }
+ assertEquals(1, cnt);
+
+ }
+
+ EnvironmentUtils.cleanEnv();
+ }
+
+
+
+ @Test
+ public void testRestartEndTIme()
+ throws SQLException, ClassNotFoundException, IOException, StorageEngineException {
+ EnvironmentUtils.envSetUp();
+ 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.turbine.d1(timestamp,s1) values(1,1)");
+ statement.execute("insert into root.turbine.d1(timestamp,s1) values(2,2)");
+ }
+
+ EnvironmentUtils.restartDaemon();
+
+ 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.turbine.d1(timestamp,s2) values(1,1)");
+ statement.execute("insert into root.turbine.d1(timestamp,s2) values(2,2)");
+ }
+
+ EnvironmentUtils.restartDaemon();
+
+ 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 s2 FROM root.turbine.d1");
+ assertTrue(hasResultSet);
+ String[] exp = new String[]{
+ "1,1.0",
+ "2,2.0"
+ };
+ ResultSet resultSet = statement.getResultSet();
+ int cnt = 0;
+ while (resultSet.next()) {
+ String result = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(2);
+ assertEquals(exp[cnt], result);
+ cnt++;
+ }
+ assertEquals(2, cnt);
+
+ }
+
+ EnvironmentUtils.cleanEnv();
+ }
}