private static void insertData() {
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {

      for (String sql : TestConstant.createSql) {
        statement.addBatch(sql);
      }

      statement.addBatch("CREATE DATABASE root.fans");
      statement.addBatch("CREATE TIMESERIES root.fans.d0.s0 WITH DATATYPE=INT32, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.fans.d1.s0 WITH DATATYPE=INT32, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.fans.d2.s0 WITH DATATYPE=INT32, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.fans.d3.s0 WITH DATATYPE=INT32, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.car.d0.s1 WITH DATATYPE=INT64, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.car.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE");
      statement.addBatch("CREATE TIMESERIES root.car.d2.s1 WITH DATATYPE=INT64, ENCODING=RLE");

      // insert of data time range :0-100 into fans
      for (int time = 0; time < 100; time++) {

        String sql =
            String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
      }

      // insert large amount of data time range : 1370 ~ 2400
      for (int time = 1370; time < 2400; time++) {

        String sql =
            String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
      }

      // insert large amount of data time range : 300 ~ 1360
      for (int time = 300; time < 1360; time++) {
        // System.out.println("===" + time);
        String sql =
            String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
      }

      statement.addBatch("flush");

      // unsequential data, memory data
      for (int time = 1000; time < 1100; time++) {

        String sql =
            String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
      }

      // sequential data, memory data
      for (int time = 20000; time < 20100; time++) {

        String sql =
            String.format("insert into root.fans.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d2(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.fans.d3(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d0(timestamp,s0) values(%s,%s)", time, time % 7);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d1(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
        sql = String.format("insert into root.car.d2(timestamp,s0) values(%s,%s)", time, time % 4);
        statement.addBatch(sql);
      }
      statement.executeBatch();

    } catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
    }
  }
Notice that, all test begins with "IoTDB" is integration test. All test which will start the
IoTDB server should be defined as integration test.
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBMultiDeviceIT.java