@Test
  public void testDeleteTimeSeriesWhenUsingTemplate() throws SQLException {
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      // set device template
      statement.execute("SET DEVICE TEMPLATE t1 TO root.sg1.d1");
      statement.execute("SET DEVICE TEMPLATE t2 TO root.sg1.d2");

      statement.execute("CREATE TIMESERIES root.sg3.d1.s1 INT64");

      // set using device template
      statement.execute("INSERT INTO root.sg1.d1(time,s1) VALUES (1,1)");
      statement.execute("INSERT INTO root.sg1.d2(time,s1) ALIGNED VALUES (1,1)");
      statement.execute("INSERT INTO root.sg3.d1(time,s1) VALUES (1,1)");

      Set<String> expectedResult = new HashSet<>(Collections.singletonList("1,1,1,1,"));

      try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.**")) {
        while (resultSet.next()) {
          StringBuilder stringBuilder = new StringBuilder();
          for (int i = 1; i <= 4; i++) {
            stringBuilder.append(resultSet.getString(i)).append(",");
          }
          String actualResult = stringBuilder.toString();
          Assert.assertTrue(expectedResult.contains(actualResult));
          expectedResult.remove(actualResult);
        }
      }
      Assert.assertTrue(expectedResult.isEmpty());

      statement.execute("DELETE TIMESERIES root.**.s1");

      expectedResult =
          new HashSet<>(
              Arrays.asList(
                  "root.sg1.d1.s1,INT64,TS_2DIFF,LZ4", "root.sg1.d2.s1,INT64,TS_2DIFF,LZ4"));

      try (ResultSet resultSet = statement.executeQuery("SHOW TIMESERIES root.**.s1")) {
        while (resultSet.next()) {
          String actualResult =
              resultSet.getString(ColumnHeaderConstant.TIMESERIES)
                  + ","
                  + resultSet.getString(ColumnHeaderConstant.DATATYPE)
                  + ","
                  + resultSet.getString(ColumnHeaderConstant.ENCODING)
                  + ","
                  + resultSet.getString(ColumnHeaderConstant.COMPRESSION);
          Assert.assertTrue(expectedResult.contains(actualResult));
          expectedResult.remove(actualResult);
        }
      }
      Assert.assertTrue(expectedResult.isEmpty());

      try (ResultSet resultSet = statement.executeQuery("SELECT s1 FROM root.**")) {
        Assert.assertFalse(resultSet.next());
      }
    }
  }
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/schema/IoTDBSchemaTemplateIT.java