Skip to content

Commit cb055df

Browse files
committed
make suggested changes
1 parent 2ccc61c commit cb055df

File tree

11 files changed

+29
-31
lines changed

11 files changed

+29
-31
lines changed

java-bigquery/.cloudbuild/jdbc_external.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
steps:
1818
- name: 'gcr.io/cloud-devrel-public-resources/java11'
1919
entrypoint: 'bash'
20-
args: ['java-bigquery/.cloudbuild/scripts/jdbc-external.sh'', "${_VERSION}"]
20+
args: ['java-bigquery/.cloudbuild/scripts/jdbc-external.sh', "${_VERSION}"]
2121
secretEnv: ['SA_SECRET']
2222
availableSecrets:
2323
secretManager:

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/main/java/com.google.cloud.bigquery.jdbc.testsuite/JdbcStarter.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/main/java/com.google.cloud.bigquery.jdbc.javatests/JdbcStarter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ public static void main(String[] args) throws SQLException {
3232
+ ";OAuthType="
3333
+ oauthType
3434
+ ";Timeout=3600;";
35-
Connection connection = DriverManager.getConnection(connectionUrl);
36-
Statement statement = connection.createStatement();
37-
statement.execute("SELECT 1;");
35+
try(Connection connection = DriverManager.getConnection(connectionUrl);
36+
Statement statement = connection.createStatement()) {
37+
statement.execute("SELECT 1;");
38+
}
3839
}
3940
}

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/BaseDatabaseMetadata.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/BaseDatabaseMetadata.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite;
17+
package com.google.cloud.bigquery.jdbc.javatests;
1818

1919
import static java.sql.Types.TIME;
2020
import static java.sql.Types.TIMESTAMP;
@@ -49,14 +49,14 @@ public static int getSizeOfResultSet(ResultSet rs) throws SQLException {
4949
public static List<String> getInfoBySQL(Connection connection, String sqlCmd)
5050
throws SQLException {
5151
List<String> result = new ArrayList<>();
52-
try {
53-
Statement st = connection.createStatement();
54-
ResultSet rs = st.executeQuery(sqlCmd);
55-
while (rs.next()) {
56-
result.add(rs.getString(1));
52+
try {Statement st = connection.createStatement()) {
53+
ResultSet rs = st.executeQuery(sqlCmd);
54+
while (rs.next()) {
55+
result.add(rs.getString(1));
56+
}
57+
} catch (SQLException e) {
58+
throw e;
5759
}
58-
} catch (SQLException e) {
59-
throw e;
6060
}
6161
return result;
6262
}

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/JdbcConnectionHelper.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/JdbcConnectionHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite;
17+
package com.google.cloud.bigquery.jdbc.javatests;
1818

1919
import com.google.cloud.ServiceOptions;
2020
import com.google.cloud.bigquery.BigQuery;

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/authentication/ITJdbcAuthenticationTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/authentication/ITJdbcAuthenticationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.authentication;
17+
package com.google.cloud.bigquery.jdbc.javatests.authentication;
1818

1919
import com.google.gson.JsonObject;
2020
import com.google.gson.JsonParser;

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/connection/ITJdbcConnectionTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/connection/ITJdbcConnectionTest.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.connection;
17+
package com.google.cloud.bigquery.jdbc.javatests.connection;
1818

1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertFalse;
@@ -23,7 +23,7 @@
2323
import static org.junit.Assert.assertThrows;
2424
import static org.junit.Assert.assertTrue;
2525

26-
import com.google.cloud.bigquery.jdbc.testsuite.JdbcConnectionHelper;
26+
import com.google.cloud.bigquery.jdbc.javatests.JdbcConnectionHelper;
2727
import com.google.cloud.ServiceOptions;
2828
import java.sql.Array;
2929
import java.sql.CallableStatement;
@@ -436,15 +436,12 @@ public void testAbort() throws SQLException, InterruptedException {
436436
// But we mainly want to test that calling abort doesn't cause a direct error
437437
assertFalse(connection.isClosed());
438438
assertTrue(connection.isClosed());
439-
System.out.println(connection.isClosed());
440439
connection.abort(java.util.concurrent.Executors.newSingleThreadExecutor());
441-
System.out.println(connection.isClosed());
442-
assertTrue(connection.isClosed());
440+
assertTrue(connection.isClosed());
443441
} catch (SQLException e) {
444442
e.printStackTrace();
445443
// It's expected that calling abort might cause an exception
446444
// depending on the state of the connection and driver.
447-
System.out.println("Abort test threw an exception, which is expected in some cases.");
448445
}
449446
});
450447

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/connection/ITJdbcDriverTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/connection/ITJdbcDriverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.connection;
17+
package com.google.cloud.bigquery.jdbc.javatests.connection;
1818

1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertFalse;
2121
import static org.junit.Assert.assertTrue;
2222

23-
import com.google.cloud.bigquery.jdbc.testsuite.JdbcConnectionHelper;
23+
import com.google.cloud.bigquery.jdbc.javatests.JdbcConnectionHelper;
2424
import com.google.cloud.ServiceOptions;
2525
import com.google.cloud.bigquery.BigQuery;
2626
import com.google.cloud.bigquery.BigQueryOptions;

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/metadata/ITJdbcDatabaseMetadataTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/metadata/ITJdbcDatabaseMetadataTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.metadata;
17+
package com.google.cloud.bigquery.jdbc.javatests.metadata;
1818

1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertFalse;
2121
import static org.junit.Assert.assertTrue;
2222

23-
import com.google.cloud.bigquery.jdbc.testsuite.BaseDatabaseMetadata;
24-
import com.google.cloud.bigquery.jdbc.testsuite.JdbcConnectionHelper;
23+
import com.google.cloud.bigquery.jdbc.javatests.BaseDatabaseMetadata;
24+
import com.google.cloud.bigquery.jdbc.javatests.JdbcConnectionHelper;
2525
import com.google.cloud.ServiceOptions;
2626
import com.google.cloud.bigquery.BigQuery;
2727
import java.sql.Connection;

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/metadata/ITJdbcResultSetMetadataTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/metadata/ITJdbcResultSetMetadataTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.metadata;
17+
package com.google.cloud.bigquery.jdbc.javatests.metadata;
1818

1919
import static org.junit.Assert.assertEquals;
2020

21-
import com.google.cloud.bigquery.jdbc.testsuite.JdbcConnectionHelper;
21+
import com.google.cloud.bigquery.jdbc.javatests.JdbcConnectionHelper;
2222
import com.google.cloud.ServiceOptions;
2323
import java.sql.Connection;
2424
import java.sql.DriverManager;

java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/testsuite/statement/ITBigQueryJDBCTest.java renamed to java-bigquery/google-cloud-bigquery-jdbc/bigquery-external-jdbc-tests/src/test/java/com/google/cloud/bigquery/jdbc/javatests/statement/ITBigQueryJDBCTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.google.cloud.bigquery.jdbc.testsuite.statement;
17+
package com.google.cloud.bigquery.jdbc.javatests.statement;
1818

1919
import static org.junit.Assert.assertEquals;
2020
import static org.junit.Assert.assertFalse;
2121
import static org.junit.Assert.assertNotNull;
2222
import static org.junit.Assert.assertThrows;
2323
import static org.junit.Assert.assertTrue;
2424

25-
import com.google.cloud.bigquery.jdbc.testsuite.JdbcConnectionHelper;
25+
import com.google.cloud.bigquery.jdbc.javatests.JdbcConnectionHelper;
2626
import com.google.cloud.ServiceOptions;
2727
import java.nio.charset.StandardCharsets;
2828
import java.sql.Connection;

0 commit comments

Comments
 (0)