@Test public void testPrepareStatementWithMockKylinClient() throws SQLException, IOException { String sql = "select 1 as val"; when(client.executeQuery(anyString(), Mockito.<List<Object>>any(), Mockito.<Map<String, String>>any())).thenReturn(getMockResult()); try (KylinConnection conn = getConnectionWithMockClient()) { PreparedStatement preparedStatement = conn.prepareStatement(sql); try (ResultSet resultSet = preparedStatement.executeQuery()) { verify(client).executeQuery(eq(sql), Mockito.<List<Object>>any(), Mockito.<Map<String, String>>any()); 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();  }