@Test public void testCancel() throws SQLException { HiveConnection hiveConnection = createNiceMock(HiveConnection.class); HiveStatement hiveStatement = createNiceMock(HiveStatement.class); HiveQueryResultSet resultSet = createNiceMock(HiveQueryResultSet.class); expect(hiveConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)).andReturn(hiveStatement); String query = "select * from test"; expect(hiveStatement.execute(query)).andReturn(true); expect(hiveStatement.getResultSet()).andReturn(resultSet); hiveStatement.cancel(); resultSet.close(); replay(hiveConnection, hiveStatement, resultSet); HiveJdbcConnectionDelegate hiveJdbcConnectionDelegate = new HiveJdbcConnectionDelegate(); hiveJdbcConnectionDelegate.execute(hiveConnection, query); hiveJdbcConnectionDelegate.cancel(); hiveJdbcConnectionDelegate.closeResultSet(); hiveJdbcConnectionDelegate.closeStatement(); verify(hiveConnection, hiveStatement, resultSet); }
@Override public void cancel() throws SQLException { if (currentStatement != null) { currentStatement.cancel(); } }
HiveJdbcConnectionDelegate implements ConnectionDelegate { @Override public void cancel() throws SQLException { if (currentStatement != null) { currentStatement.cancel(); } } }
HiveJdbcConnectionDelegate implements ConnectionDelegate { @Override public void cancel() throws SQLException { if (currentStatement != null) { currentStatement.cancel(); } }  }
HiveJdbcConnectionDelegate implements ConnectionDelegate { @Override public void cancel() throws SQLException { if (currentStatement != null) { currentStatement.cancel(); } }  @Override HiveStatement createStatement(HiveConnection connection); @Override Optional<ResultSet> execute(String statement); @Override Optional<ResultSet> execute(HiveConnection connection, String sqlStatement); @Override ResultSet getColumnMetadata(HiveConnection connection, GetColumnMetadataJob job); @Override void cancel(); @Override void closeResultSet(); @Override void closeStatement(); }
HiveJdbcConnectionDelegate implements ConnectionDelegate { @Override public void cancel() throws SQLException { if (currentStatement != null) { currentStatement.cancel(); } }  @Override HiveStatement createStatement(HiveConnection connection); @Override Optional<ResultSet> execute(String statement); @Override Optional<ResultSet> execute(HiveConnection connection, String sqlStatement); @Override ResultSet getColumnMetadata(HiveConnection connection, GetColumnMetadataJob job); @Override void cancel(); @Override void closeResultSet(); @Override void closeStatement();  }