@Test public void testPrepareStatementWithMockHttp() throws IOException, SQLException { String sql = "select 1 as val"; try (KylinConnection connection = getConnectionWithMockHttp()) { HttpResponse response = TestUtil.mockHttpResponseWithFile(200, "OK", "query.json"); when(httpClient.execute(any(HttpUriRequest.class))).thenReturn(response); try (ResultSet resultSet = connection.prepareStatement(sql).executeQuery()) { assertTrue(resultSet.next()); ResultSetMetaData metaData = resultSet.getMetaData(); assertEquals("VAL", metaData.getColumnName(1)); assertEquals(1, resultSet.getInt("VAL")); } } }
@Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Meta.Signature sig = mockPreparedSignature(sql); return factory().newPreparedStatement(this, null, sig, resultSetType, resultSetConcurrency, resultSetHoldability); }
KylinConnection extends AvaticaConnection implements KylinConnectionInfo { @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Meta.Signature sig = mockPreparedSignature(sql); return factory().newPreparedStatement(this, null, sig, resultSetType, resultSetConcurrency, resultSetHoldability); } }
KylinConnection extends AvaticaConnection implements KylinConnectionInfo { @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Meta.Signature sig = mockPreparedSignature(sql); return factory().newPreparedStatement(this, null, sig, resultSetType, resultSetConcurrency, resultSetHoldability); } protected  KylinConnection(UnregisteredDriver driver, JdbcFactory factory, String url, Properties info); }
KylinConnection extends AvaticaConnection implements KylinConnectionInfo { @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Meta.Signature sig = mockPreparedSignature(sql); return factory().newPreparedStatement(this, null, sig, resultSetType, resultSetConcurrency, resultSetHoldability); } protected  KylinConnection(UnregisteredDriver driver, JdbcFactory factory, String url, Properties info); String getBaseUrl(); String getProject(); Properties getConnectionProperties(); @Override AvaticaStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability); boolean getAutoCommit(); boolean isReadOnly(); @Override PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability); IRemoteClient getRemoteClient(); @Override void close(); }
KylinConnection extends AvaticaConnection implements KylinConnectionInfo { @Override public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { Meta.Signature sig = mockPreparedSignature(sql); return factory().newPreparedStatement(this, null, sig, resultSetType, resultSetConcurrency, resultSetHoldability); } protected  KylinConnection(UnregisteredDriver driver, JdbcFactory factory, String url, Properties info); String getBaseUrl(); String getProject(); Properties getConnectionProperties(); @Override AvaticaStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability); boolean getAutoCommit(); boolean isReadOnly(); @Override PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability); IRemoteClient getRemoteClient(); @Override void close();  }