-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Source BigQuery: Fix NPE when
dataset_id
isn't provided (#6051)
* Source BigQuery: Fix for NPE when `dataset_id` isn't provided * changes for an empty `dataset_id` in the configuration * added changelog * bumped version * Source Bigquery: Version should be 0.1.2 🤦♂️ * Source BigQuery: Fixed formatting * Fixes from `./gradlew format` run * Source Bigquery: Bump version to 0.1.3
- Loading branch information
Showing
8 changed files
with
75 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Changelog | ||
|
||
## 0.1.2 | ||
Fix for NPE when optional `dataset_id` not provided in configuration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ce-bigquery/src/test/java/io/airbyte/integrations/source/bigquery/BigQuerySourceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2020 Airbyte | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
package io.airbyte.integrations.source.bigquery; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import io.airbyte.commons.json.Jsons; | ||
import io.airbyte.commons.resources.MoreResources; | ||
import java.io.IOException; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class BigQuerySourceTest { | ||
|
||
@Test | ||
public void testEmptyDatasetIdInConfig() throws IOException { | ||
JsonNode configJson = Jsons.deserialize(MoreResources.readResource("test_config_empty_datasetid.json")); | ||
JsonNode dbConfig = new BigQuerySource().toDatabaseConfig(configJson); | ||
assertTrue(dbConfig.get(BigQuerySource.CONFIG_DATASET_ID).isEmpty()); | ||
} | ||
|
||
@Test | ||
public void testConfig() throws IOException { | ||
JsonNode configJson = Jsons.deserialize(MoreResources.readResource("test_config.json")); | ||
JsonNode dbConfig = new BigQuerySource().toDatabaseConfig(configJson); | ||
assertEquals("dataset", dbConfig.get(BigQuerySource.CONFIG_DATASET_ID).asText()); | ||
assertEquals("project", dbConfig.get(BigQuerySource.CONFIG_PROJECT_ID).asText()); | ||
assertEquals("credentials", dbConfig.get(BigQuerySource.CONFIG_CREDS).asText()); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
airbyte-integrations/connectors/source-bigquery/src/test/resources/test_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dataset_id": "dataset", | ||
"project_id": "project", | ||
"credentials_json": "credentials" | ||
} |
5 changes: 5 additions & 0 deletions
5
...tegrations/connectors/source-bigquery/src/test/resources/test_config_empty_datasetid.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"dataset_id": "", | ||
"project_id": "xxxx", | ||
"credentials_json": "xxxx" | ||
} |