Skip to content

Commit

Permalink
deps: upgrade google-java-format to 1.13.0 (#1288)
Browse files Browse the repository at this point in the history
* deps: upgrade google-java-format to 1.11.0

Fixes googleapis/synthtool#1287

google-java-format 1.11.0 is the version used by fmt-maven-plugin 2.12
(latest as of November 2021).

* ci: owlbot to use Java 11

* formatter version through the java-shared-config

* updating container_test.yaml
Source-Link: googleapis/synthtool@fdf20ea
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-java:latest@sha256:55d5d3c72e1c065f018e423e122a22fb55c8daa36f6f17f540774779ed659ab9
  • Loading branch information
gcf-owl-bot[bot] committed Nov 29, 2021
1 parent abd93e6 commit 0ce0804
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest
digest: sha256:5b8c790f57cca57e6b37ba25f79291265c218cea3e6ba9714b001910ab3f1419
digest: sha256:55d5d3c72e1c065f018e423e122a22fb55c8daa36f6f17f540774779ed659ab9
Expand Up @@ -23,7 +23,8 @@

/** Static utility methods for working with Errors returned from the service. */
public class Errors {
private Errors() {};
private Errors() {}
;

public static class IsRetryableStatusResult {
public boolean isRetryable = false;
Expand Down
Expand Up @@ -174,7 +174,8 @@ public void batchCommitWriteStreams(
responseObserver.onError(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or %s",
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or"
+ " %s",
response == null ? "null" : response.getClass().getName(),
BatchCommitWriteStreamsResponse.class.getName(),
Exception.class.getName())));
Expand Down
Expand Up @@ -163,7 +163,8 @@ public void convertRecursiveTopMessage() {
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Assert.assertEquals(
"Recursive type is not supported:com.google.cloud.bigquery.storage.test.RecursiveTypeTopMessage",
"Recursive type is not"
+ " supported:com.google.cloud.bigquery.storage.test.RecursiveTypeTopMessage",
e.getMessage());
}
}
Expand Down
Expand Up @@ -345,7 +345,8 @@ public void testAppendFailedOnDone() throws Exception {
StatusRuntimeException exception =
new StatusRuntimeException(
io.grpc.Status.INVALID_ARGUMENT.withDescription(
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields than BigQuery schema"));
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields"
+ " than BigQuery schema"));

testBigQueryWrite.addResponse(createAppendResponse(0));
testBigQueryWrite.addException(exception);
Expand All @@ -360,7 +361,8 @@ public void testAppendFailedOnDone() throws Exception {
actualError
.getMessage()
.contains(
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields than BigQuery schema"));
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields"
+ " than BigQuery schema"));

writer.close();
}
Expand Down
Expand Up @@ -102,7 +102,8 @@ public void testLongRunningReadSession() throws InterruptedException, ExecutionE

assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
5,
session.getStreamsCount());
Expand Down
Expand Up @@ -136,7 +136,8 @@ public void testSimpleRead() {
/* maxStreamCount = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -171,7 +172,8 @@ public void testSimpleReadAndResume() {
/* maxStreamCount = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -223,7 +225,8 @@ public void testFilter() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -285,7 +288,8 @@ public void testColumnSelection() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -740,16 +744,10 @@ public void testStructAndArraySqlTypes() throws InterruptedException, IOExceptio
String tableName = "test_struct_and_array_sql_types";
String createTableStatement =
String.format(
" CREATE TABLE %s.%s "
+ " (array_field ARRAY<INT64>,"
+ " struct_field STRUCT<int_field INT64 NOT NULL, str_field STRING NOT NULL> NOT NULL)"
+ " OPTIONS( "
+ " description=\"a table with array and time column types\" "
+ " ) "
+ "AS "
+ " SELECT "
+ " [1, 2, 3],"
+ " (10, 'abc')",
" CREATE TABLE %s.%s (array_field ARRAY<INT64>, struct_field STRUCT<int_field INT64"
+ " NOT NULL, str_field STRING NOT NULL> NOT NULL) OPTIONS( description=\"a"
+ " table with array and time column types\" ) AS SELECT [1, 2, 3], "
+ " (10, 'abc')",
DATASET, tableName);

RunQueryJobAndExpectSuccess(QueryJobConfiguration.newBuilder(createTableStatement).build());
Expand Down Expand Up @@ -879,7 +877,8 @@ private void ProcessRowsAtSnapshot(
ReadSession session = client.createReadSession(createSessionRequestBuilder.build());
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down
Expand Up @@ -466,10 +466,12 @@ public void testComplicateSchemaWithPendingStream()
Iterator<FieldValueList> queryIter = queryResult.getValues().iterator();
assertTrue(queryIter.hasNext());
assertEquals(
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=aaa}, FieldValue{attribute=PRIMITIVE, value=aaa}]}]",
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=aaa},"
+ " FieldValue{attribute=PRIMITIVE, value=aaa}]}]",
queryIter.next().get(1).getRepeatedValue().toString());
assertEquals(
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=bbb}, FieldValue{attribute=PRIMITIVE, value=bbb}]}]",
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=bbb},"
+ " FieldValue{attribute=PRIMITIVE, value=bbb}]}]",
queryIter.next().get(1).getRepeatedValue().toString());
assertFalse(queryIter.hasNext());
}
Expand Down Expand Up @@ -533,7 +535,8 @@ public void testStreamSchemaMisMatchError() throws IOException, InterruptedExcep
// TODO(stephwang): update test case when toStroageException is updated
assertThat(e.getCause().getMessage())
.contains(
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields than BigQuery schema");
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Input schema has more fields"
+ " than BigQuery schema");
}
}
}
Expand Down Expand Up @@ -565,7 +568,8 @@ public void testStreamFinalizedError()
// //TODO(stephwang): update test case when toStroageException is updated
assertThat(e.getCause().getMessage())
.contains(
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Stream has been finalized and cannot be appended");
"io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Stream has been finalized and"
+ " cannot be appended");
}
}
}
Expand Down
Expand Up @@ -117,7 +117,8 @@ public void batchCreateReadSessionStreams(
responseObserver.onError(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCreateReadSessionStreams, expected %s or %s",
"Unrecognized response type %s for method BatchCreateReadSessionStreams, expected"
+ " %s or %s",
response == null ? "null" : response.getClass().getName(),
Storage.BatchCreateReadSessionStreamsResponse.class.getName(),
Exception.class.getName())));
Expand Down
Expand Up @@ -101,7 +101,8 @@ public void testLongRunningReadSession() throws InterruptedException, ExecutionE
/* requestedStreams = */ 5);
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
5,
session.getStreamsCount());
Expand Down
Expand Up @@ -137,7 +137,8 @@ public void testSimpleRead() {
/* requestedStreams = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -173,7 +174,8 @@ public void testSimpleReadAndResume() {
/* requestedStreams = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -224,7 +226,8 @@ public void testFilter() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -287,7 +290,8 @@ public void testColumnSelection() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -757,16 +761,10 @@ public void testStructAndArraySqlTypes() throws InterruptedException, IOExceptio
String table_name = "test_struct_and_array_sql_types";
String createTableStatement =
String.format(
" CREATE TABLE %s.%s "
+ " (array_field ARRAY<INT64>,"
+ " struct_field STRUCT<int_field INT64 NOT NULL, str_field STRING NOT NULL> NOT NULL)"
+ " OPTIONS( "
+ " description=\"a table with array and time column types\" "
+ " ) "
+ "AS "
+ " SELECT "
+ " [1, 2, 3],"
+ " (10, 'abc')",
" CREATE TABLE %s.%s (array_field ARRAY<INT64>, struct_field STRUCT<int_field INT64"
+ " NOT NULL, str_field STRING NOT NULL> NOT NULL) OPTIONS( description=\"a"
+ " table with array and time column types\" ) AS SELECT [1, 2, 3], "
+ " (10, 'abc')",
DATASET, table_name);

RunQueryJobAndExpectSuccess(QueryJobConfiguration.newBuilder(createTableStatement).build());
Expand Down Expand Up @@ -896,7 +894,8 @@ private void ProcessRowsAtSnapshot(
ReadSession session = client.createReadSession(createSessionRequestBuilder.build());
assertEquals(
String.format(
"Did not receive expected number of streams for table reference '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table reference '%s' CreateReadSession"
+ " response:%n%s",
TextFormat.shortDebugString(tableReference), session.toString()),
1,
session.getStreamsCount());
Expand Down
Expand Up @@ -174,7 +174,8 @@ public void batchCommitWriteStreams(
responseObserver.onError(
new IllegalArgumentException(
String.format(
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or %s",
"Unrecognized response type %s for method BatchCommitWriteStreams, expected %s or"
+ " %s",
response == null ? "null" : response.getClass().getName(),
BatchCommitWriteStreamsResponse.class.getName(),
Exception.class.getName())));
Expand Down
Expand Up @@ -163,7 +163,8 @@ public void convertRecursiveTopMessage() {
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
Assert.assertEquals(
"Recursive type is not supported:com.google.cloud.bigquery.storage.test.RecursiveTypeTopMessage",
"Recursive type is not"
+ " supported:com.google.cloud.bigquery.storage.test.RecursiveTypeTopMessage",
e.getMessage());
}
}
Expand Down
Expand Up @@ -102,7 +102,8 @@ public void testLongRunningReadSession() throws InterruptedException, ExecutionE

assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
5,
session.getStreamsCount());
Expand Down
Expand Up @@ -136,7 +136,8 @@ public void testSimpleRead() {
/* maxStreamCount = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -171,7 +172,8 @@ public void testSimpleReadAndResume() {
/* maxStreamCount = */ 1);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -223,7 +225,8 @@ public void testFilter() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -285,7 +288,8 @@ public void testColumnSelection() throws IOException {
ReadSession session = client.createReadSession(request);
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down Expand Up @@ -740,16 +744,10 @@ public void testStructAndArraySqlTypes() throws InterruptedException, IOExceptio
String tableName = "test_struct_and_array_sql_types";
String createTableStatement =
String.format(
" CREATE TABLE %s.%s "
+ " (array_field ARRAY<INT64>,"
+ " struct_field STRUCT<int_field INT64 NOT NULL, str_field STRING NOT NULL> NOT NULL)"
+ " OPTIONS( "
+ " description=\"a table with array and time column types\" "
+ " ) "
+ "AS "
+ " SELECT "
+ " [1, 2, 3],"
+ " (10, 'abc')",
" CREATE TABLE %s.%s (array_field ARRAY<INT64>, struct_field STRUCT<int_field INT64"
+ " NOT NULL, str_field STRING NOT NULL> NOT NULL) OPTIONS( description=\"a"
+ " table with array and time column types\" ) AS SELECT [1, 2, 3], "
+ " (10, 'abc')",
DATASET, tableName);

RunQueryJobAndExpectSuccess(QueryJobConfiguration.newBuilder(createTableStatement).build());
Expand Down Expand Up @@ -879,7 +877,8 @@ private void ProcessRowsAtSnapshot(
ReadSession session = client.createReadSession(createSessionRequestBuilder.build());
assertEquals(
String.format(
"Did not receive expected number of streams for table '%s' CreateReadSession response:%n%s",
"Did not receive expected number of streams for table '%s' CreateReadSession"
+ " response:%n%s",
table, session.toString()),
1,
session.getStreamsCount());
Expand Down
Expand Up @@ -457,10 +457,12 @@ public void testComplicateSchemaWithPendingStream()
Iterator<FieldValueList> queryIter = queryResult.getValues().iterator();
assertTrue(queryIter.hasNext());
assertEquals(
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=aaa}, FieldValue{attribute=PRIMITIVE, value=aaa}]}]",
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=aaa},"
+ " FieldValue{attribute=PRIMITIVE, value=aaa}]}]",
queryIter.next().get(1).getRepeatedValue().toString());
assertEquals(
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=bbb}, FieldValue{attribute=PRIMITIVE, value=bbb}]}]",
"[FieldValue{attribute=REPEATED, value=[FieldValue{attribute=PRIMITIVE, value=bbb},"
+ " FieldValue{attribute=PRIMITIVE, value=bbb}]}]",
queryIter.next().get(1).getRepeatedValue().toString());
assertFalse(queryIter.hasNext());
}
Expand Down

0 comments on commit 0ce0804

Please sign in to comment.