@Test public void testJdbcClientCalcitePropsInUrl() throws Exception { String sql = "select 1 as val"; when(client.executeQuery(anyString(), Mockito.<List<Object>>any(), Mockito.<Map<String, String>>any())).thenReturn(getMockResult()); Map<String, String> toggles = new HashMap<>(); Properties info = new Properties(); info.setProperty("caseSensitive", "false"); info.setProperty("unquotedCasing", "UNCHANGED"); try (KylinConnection conn = getConnectionWithMockClient("jdbc:kylin:test_url/test_db", info)) { PreparedStatement preparedStatement = conn.prepareStatement(sql); try (ResultSet resultSet = preparedStatement.executeQuery()) { verify(client).executeQuery(eq(sql), Mockito.<List<Object>>any(), argThat(new ArgumentMatcher<Map<String, String>>() { @Override public boolean matches(Map<String, String> argument) { String propsStr = argument.get("JDBC_CLIENT_CALCITE_PROPS"); assertNotNull(propsStr); Properties props = new Properties(); try { props.load(new StringReader(propsStr)); } catch (IOException e) { throw new RuntimeException(e); } assertEquals("false", props.getProperty("caseSensitive")); assertEquals("UNCHANGED", props.getProperty("unquotedCasing")); return true; } })); 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();  }