protected static void clearSchema() throws Exception {
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {
      try {
        statement.execute("DELETE DATABASE root.**");
      } catch (Exception e) {
        // If database is null, it will throw exception. Do nothing.
      }
      // delete all template
      try (ResultSet resultSet = statement.executeQuery("SHOW DEVICE TEMPLATES")) {
        while (resultSet.next()) {
          statement.execute(
              "DROP DEVICE TEMPLATE " + resultSet.getString(ColumnHeaderConstant.TEMPLATE_NAME));
        }
      }
      // drop all users
      try (ResultSet resultSet = statement.executeQuery("LIST USER")) {
        while (resultSet.next()) {
          if (!resultSet.getString(ColumnHeaderConstant.USER).equals("root")) {
            statement.execute("DROP USER " + resultSet.getString(ColumnHeaderConstant.USER));
          }
        }
      }
    }
  }
This class define multiple modes for schema engine. All IT class extends AbstractSchemaIT will be
run in both Memory and PBTree modes. In PBTree mode, there are three kinds of test environment:
full memory, partial memory and non memory.

<p>Notice that, all IT class extends AbstractSchemaIT need to call {@link
AbstractSchemaIT#setUpEnvironment} before test env initialization at {@code @BeforeParam}, or
call {@link AbstractSchemaIT#setUpEnvironmentBeforeMethod()} at {@code @Before}, and call {@link
AbstractSchemaIT#tearDownEnvironment} after test env cleaning.
integration-test/src/test/java/org/apache/iotdb/util/AbstractSchemaIT.java