Package org.apache.calcite.jdbc
Class CalciteRemoteDriverTest
- java.lang.Object
-
- org.apache.calcite.jdbc.CalciteRemoteDriverTest
-
public class CalciteRemoteDriverTest extends java.lang.Object
Test for Calcite's remote JDBC driver.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CalciteRemoteDriverTest.Factory
Factory that creates aMeta
that can see the test databases.static class
CalciteRemoteDriverTest.Factory2
Factory that creates aLocalJsonService
.static class
CalciteRemoteDriverTest.LocalServiceModifiableFactory
Factory that creates a Service with connection to a modifiable table.static class
CalciteRemoteDriverTest.LocalServiceMoreFactory
Service factory that creates a Calcite instance with more data.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.function.Function<java.sql.Connection,java.sql.ResultSet>
GET_CATALOGS
private static java.util.function.Function<java.sql.Connection,java.sql.ResultSet>
GET_COLUMNS
private static java.util.function.Function<java.sql.Connection,java.sql.ResultSet>
GET_SCHEMAS
private static java.util.function.Function<java.sql.Connection,java.sql.ResultSet>
GET_TABLE_TYPES
private static java.util.function.Function<java.sql.Connection,java.sql.ResultSet>
GET_TYPEINFO
static java.lang.String
LJS
private static java.sql.Connection
localConnection
private java.io.PrintWriter
out
private static CalciteAssert.ConnectionFactory
REMOTE_CONNECTION_FACTORY
private static java.util.List<java.lang.Object>
SAMPLE_VALUES
A bunch of sample values of various types.private static org.apache.calcite.avatica.server.HttpServer
start
-
Constructor Summary
Constructors Constructor Description CalciteRemoteDriverTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
afterClass()
static void
beforeClass()
private java.lang.Object
convert(java.lang.Object o, java.lang.Class clazz)
protected static java.sql.Connection
getRemoteConnection()
static java.sql.Connection
makeConnection()
private java.lang.String
pad(java.lang.String x)
void
testAvaticaConnectionException()
void
testAvaticaStatementException()
void
testAvaticaStatementGetMoreResults()
void
testCatalogsLocal()
void
testInsert()
Test remote Statement insert.void
testInsertBatch()
Test remote Statement batched insert.void
testLocalPreparedStatementFetch()
Test that returns all result sets in one go.void
testLocalStatementFetch()
void
testMetaFunctionsLocal()
void
testParameterConvert()
For each (source, destination) type, make sure that we can convert bind variables.void
testRemoteCatalogs()
void
testRemoteColumns()
void
testRemoteExecute()
void
testRemoteExecuteMaxRow()
void
testRemoteExecuteQuery()
void
testRemoteExecuteQuery2()
Same query astestRemoteExecuteQuery()
, run without the test infrastructure.void
testRemotePreparedStatementFetch()
void
testRemotePreparedStatementInsert()
Remote PreparedStatement insert WITHOUT bind variablesvoid
testRemotePreparedStatementInsert2()
Remote PreparedStatement insert WITH bind variablesvoid
testRemotePrepareExecute()
Test case for [CALCITE-661] Remote fetch in Calcite JDBC driver.void
testRemoteSchemas()
void
testRemoteStatementExecute()
ChecksStatement.execute(java.lang.String)
on a query over a remote connection.void
testRemoteStatementFetch()
void
testRemoteTableTypes()
void
testRemoteTypeInfo()
void
testSchemasLocal()
void
testTableB5()
Check that the "set" conversion table looks like Table B-5 in JDBC 4.1 specificationvoid
testTableB6()
Check that the "get" conversion table looks like Table B-5 in JDBC 4.1 specificationprivate static java.util.List<java.lang.Object>
values(java.lang.Class clazz)
-
-
-
Field Detail
-
LJS
public static final java.lang.String LJS
-
out
private final java.io.PrintWriter out
-
REMOTE_CONNECTION_FACTORY
private static final CalciteAssert.ConnectionFactory REMOTE_CONNECTION_FACTORY
-
GET_SCHEMAS
private static final java.util.function.Function<java.sql.Connection,java.sql.ResultSet> GET_SCHEMAS
-
GET_CATALOGS
private static final java.util.function.Function<java.sql.Connection,java.sql.ResultSet> GET_CATALOGS
-
GET_COLUMNS
private static final java.util.function.Function<java.sql.Connection,java.sql.ResultSet> GET_COLUMNS
-
GET_TYPEINFO
private static final java.util.function.Function<java.sql.Connection,java.sql.ResultSet> GET_TYPEINFO
-
GET_TABLE_TYPES
private static final java.util.function.Function<java.sql.Connection,java.sql.ResultSet> GET_TABLE_TYPES
-
localConnection
private static java.sql.Connection localConnection
-
start
private static org.apache.calcite.avatica.server.HttpServer start
-
SAMPLE_VALUES
private static final java.util.List<java.lang.Object> SAMPLE_VALUES
A bunch of sample values of various types.
-
-
Method Detail
-
beforeClass
public static void beforeClass() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getRemoteConnection
protected static java.sql.Connection getRemoteConnection() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
afterClass
public static void afterClass() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testCatalogsLocal
public void testCatalogsLocal() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testSchemasLocal
public void testSchemasLocal() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testMetaFunctionsLocal
public void testMetaFunctionsLocal() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteCatalogs
public void testRemoteCatalogs() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteSchemas
public void testRemoteSchemas() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteColumns
public void testRemoteColumns() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteTypeInfo
public void testRemoteTypeInfo() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteTableTypes
public void testRemoteTableTypes() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteExecuteQuery
public void testRemoteExecuteQuery() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteExecuteQuery2
public void testRemoteExecuteQuery2() throws java.lang.Exception
Same query astestRemoteExecuteQuery()
, run without the test infrastructure.- Throws:
java.lang.Exception
-
testParameterConvert
public void testParameterConvert() throws java.lang.Exception
For each (source, destination) type, make sure that we can convert bind variables.- Throws:
java.lang.Exception
-
testTableB5
public void testTableB5()
Check that the "set" conversion table looks like Table B-5 in JDBC 4.1 specification
-
pad
private java.lang.String pad(java.lang.String x)
-
testTableB6
public void testTableB6()
Check that the "get" conversion table looks like Table B-5 in JDBC 4.1 specification
-
testRemoteStatementExecute
public void testRemoteStatementExecute() throws java.lang.Exception
ChecksStatement.execute(java.lang.String)
on a query over a remote connection.Test case for [CALCITE-646] AvaticaStatement execute method broken over remote JDBC.
- Throws:
java.lang.Exception
-
testAvaticaConnectionException
public void testAvaticaConnectionException() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAvaticaStatementException
public void testAvaticaStatementException() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAvaticaStatementGetMoreResults
public void testAvaticaStatementGetMoreResults() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteExecute
public void testRemoteExecute() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemoteExecuteMaxRow
public void testRemoteExecuteMaxRow() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemotePrepareExecute
public void testRemotePrepareExecute() throws java.lang.Exception
Test case for [CALCITE-661] Remote fetch in Calcite JDBC driver.- Throws:
java.lang.Exception
-
makeConnection
public static java.sql.Connection makeConnection() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testLocalStatementFetch
public void testLocalStatementFetch() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testLocalPreparedStatementFetch
public void testLocalPreparedStatementFetch() throws java.lang.Exception
Test that returns all result sets in one go.- Throws:
java.lang.Exception
-
testRemoteStatementFetch
public void testRemoteStatementFetch() throws java.lang.Exception
- Throws:
java.lang.Exception
-
testRemotePreparedStatementFetch
public void testRemotePreparedStatementFetch() throws java.lang.Exception
- Throws:
java.lang.Exception
-
values
private static java.util.List<java.lang.Object> values(java.lang.Class clazz)
-
convert
private java.lang.Object convert(java.lang.Object o, java.lang.Class clazz) throws java.text.ParseException
- Throws:
java.text.ParseException
-
testInsert
public void testInsert() throws java.lang.Exception
Test remote Statement insert.- Throws:
java.lang.Exception
-
testInsertBatch
public void testInsertBatch() throws java.lang.Exception
Test remote Statement batched insert.- Throws:
java.lang.Exception
-
testRemotePreparedStatementInsert
public void testRemotePreparedStatementInsert() throws java.lang.Exception
Remote PreparedStatement insert WITHOUT bind variables- Throws:
java.lang.Exception
-
testRemotePreparedStatementInsert2
public void testRemotePreparedStatementInsert2() throws java.lang.Exception
Remote PreparedStatement insert WITH bind variables- Throws:
java.lang.Exception
-
-