Search in sources :

Example 1 with JdbcSqlScriptVerifier

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);
}
Also used : JdbcSqlScriptVerifier(com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier) ITAbstractJdbcTest(com.google.cloud.spanner.jdbc.ITAbstractJdbcTest) ParallelIntegrationTest(com.google.cloud.spanner.ParallelIntegrationTest) Test(org.junit.Test)

Example 2 with JdbcSqlScriptVerifier

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);
}
Also used : JdbcSqlScriptVerifier(com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier) ParallelIntegrationTest(com.google.cloud.spanner.ParallelIntegrationTest) ITAbstractJdbcTest(com.google.cloud.spanner.jdbc.ITAbstractJdbcTest) Test(org.junit.Test)

Example 3 with JdbcSqlScriptVerifier

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);
}
Also used : JdbcSqlScriptVerifier(com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier) ParallelIntegrationTest(com.google.cloud.spanner.ParallelIntegrationTest) ITAbstractJdbcTest(com.google.cloud.spanner.jdbc.ITAbstractJdbcTest) Test(org.junit.Test)

Example 4 with JdbcSqlScriptVerifier

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();
        }
    }
}
Also used : JdbcSqlScriptVerifier(com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier) CloudSpannerJdbcConnection(com.google.cloud.spanner.jdbc.CloudSpannerJdbcConnection) Before(org.junit.Before)

Aggregations

JdbcSqlScriptVerifier (com.google.cloud.spanner.jdbc.JdbcSqlScriptVerifier)4 ParallelIntegrationTest (com.google.cloud.spanner.ParallelIntegrationTest)3 ITAbstractJdbcTest (com.google.cloud.spanner.jdbc.ITAbstractJdbcTest)3 Test (org.junit.Test)3 CloudSpannerJdbcConnection (com.google.cloud.spanner.jdbc.CloudSpannerJdbcConnection)1 Before (org.junit.Before)1