Skip to content

Commit

Permalink
Changed some files to make compilation/testing work
Browse files Browse the repository at this point in the history
  • Loading branch information
allenc3 committed Jun 11, 2020
1 parent f80f652 commit 9bacc48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
Expand Up @@ -472,7 +472,7 @@ private void isProtoCompatibleWithBQ(
"Proto schema "
+ protoScope
+ " has "
+ +protoFields.size()
+ protoFields.size()
+ " fields, while BQ schema "
+ BQScope
+ " has "
Expand Down
Expand Up @@ -97,31 +97,17 @@ public Builder toBuilder() {

@Test
public void testSuccess() throws Exception {
customizeSchema(Schema.of(Field.of("Foo", LegacySQLTypeName.STRING)));
SchemaCompact compact = SchemaCompact.getInstance(mockBigquery);
compact.check("projects/p/datasets/d/tables/t", FooType.getDescriptor(), false);
verify(mockBigquery, times(1)).getTable(any(TableId.class));
verify(mockBigqueryTable, times(1)).getDefinition();
}

@Test
public void testFailed() throws Exception {
customizeSchema(
Schema.of(
Field.of("Foo", LegacySQLTypeName.STRING), Field.of("Bar", LegacySQLTypeName.STRING)));
Field.newBuilder("Foo", LegacySQLTypeName.STRING)
.setMode(Field.Mode.NULLABLE)
.build()));
SchemaCompact compact = SchemaCompact.getInstance(mockBigquery);
try {
compact.check("projects/p/datasets/d/tables/t", FooType.getDescriptor(), false);
fail("should fail");
} catch (IllegalArgumentException expected) {
assertEquals(
"Proto schema doesn't have expected field number with BigQuery table schema, expected: 2 actual: 1",
expected.getMessage());
}
compact.check("projects/p/datasets/d/tables/t", FooType.getDescriptor(), false);
verify(mockBigquery, times(1)).getTable(any(TableId.class));
verify(mockBigqueryTable, times(1)).getDefinition();
}
//

@Test
public void testBadTableName() throws Exception {
try {
Expand Down

0 comments on commit 9bacc48

Please sign in to comment.