use of com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier in project java-spanner-jdbc by googleapis.
the class ITJdbcReadOnlyTest method testSqlScript.
@Test
public void testSqlScript() throws Exception {
// Wait 100ms to ensure that staleness tests in the script succeed.
Thread.sleep(100L);
JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider());
verifier.verifyStatementsInFile(dialect.executeQueriesFiles.get("TEST_READ_ONLY"), ITAbstractJdbcTest.class, false);
}
use of com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier in project java-spanner-jdbc by googleapis.
the class ITJdbcReadWriteAutocommitTest method test01_SqlScript.
@Test
public void test01_SqlScript() throws Exception {
JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider());
verifier.verifyStatementsInFile(dialect.executeQueriesFiles.get("TEST_READ_WRITE_AUTO_COMMIT"), ITAbstractJdbcTest.class, false);
}
use of com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier in project java-spanner-jdbc by googleapis.
the class ITJdbcDdlTest method testSqlScript.
@Test
public void testSqlScript() throws Exception {
JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider());
verifier.verifyStatementsInFile(dialect.executeQueriesFiles.get("TEST_DDL"), ITAbstractJdbcTest.class, false);
}
use of com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier in project java-spanner-jdbc by googleapis.
the class ITJdbcReadOnlyTest method createTestTables.
@Before
public void createTestTables() throws Exception {
try (CloudSpannerJdbcConnection connection = createConnection(getDialect())) {
if (!(tableExists(connection, "NUMBERS") && tableExists(connection, "PRIME_NUMBERS"))) {
// create tables
JdbcSqlScriptVerifier verifier = new JdbcSqlScriptVerifier(new ITJdbcConnectionProvider());
verifier.verifyStatementsInFile(dialect.createTableFile, ITAbstractJdbcTest.class, false);
// fill tables with data
connection.setAutoCommit(false);
connection.setReadOnly(false);
for (long number = 1L; number <= TEST_ROWS_COUNT; number++) {
connection.bufferedWrite(Mutation.newInsertBuilder("NUMBERS").set("number").to(number).set("name").to(Long.toBinaryString(number)).build());
}
for (long number = 1L; number <= TEST_ROWS_COUNT; number++) {
if (BigInteger.valueOf(number).isProbablePrime(Integer.MAX_VALUE)) {
connection.bufferedWrite(Mutation.newInsertBuilder("PRIME_NUMBERS").set("prime_number").to(number).set("binary_representation").to(Long.toBinaryString(number)).build());
}
}
connection.commit();
}
}
}
Aggregations