|
| 1 | +/* |
| 2 | + * Copyright 2024 Copyright 2022 Aiven Oy and |
| 3 | + * bigquery-connector-for-apache-kafka project contributors |
| 4 | + * |
| 5 | + * This software contains code derived from the Confluent BigQuery |
| 6 | + * Kafka Connector, Copyright Confluent, Inc, which in turn |
| 7 | + * contains code derived from the WePay BigQuery Kafka Connector, |
| 8 | + * Copyright WePay, Inc. |
| 9 | + * |
| 10 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | + * you may not use this file except in compliance with the License. |
| 12 | + * You may obtain a copy of the License at |
| 13 | + * |
| 14 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | + * |
| 16 | + * Unless required by applicable law or agreed to in writing, |
| 17 | + * software distributed under the License is distributed on an |
| 18 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 19 | + * KIND, either express or implied. See the License for the |
| 20 | + * specific language governing permissions and limitations |
| 21 | + * under the License. |
| 22 | + */ |
| 23 | + |
| 24 | +package com.wepay.kafka.connect.bigquery.write.storage; |
| 25 | + |
| 26 | +import com.google.cloud.bigquery.BigQuery; |
| 27 | +import com.wepay.kafka.connect.bigquery.GcpClientBuilder; |
| 28 | +import com.wepay.kafka.connect.bigquery.config.BigQuerySinkConfig; |
| 29 | +import org.junit.jupiter.api.Test; |
| 30 | + |
| 31 | +import java.util.HashMap; |
| 32 | +import java.util.Map; |
| 33 | + |
| 34 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 35 | + |
| 36 | +public class BigQueryBuilderTest { |
| 37 | + |
| 38 | + @Test |
| 39 | + public void testBigQueryBuild() { |
| 40 | + Map<String, String> properties = new HashMap<>(); |
| 41 | + properties.put(BigQuerySinkConfig.PROJECT_CONFIG, "abcd"); |
| 42 | + properties.put(BigQuerySinkConfig.DEFAULT_DATASET_CONFIG, "dummy_dataset"); |
| 43 | + BigQuerySinkConfig config = new BigQuerySinkConfig(properties); |
| 44 | + |
| 45 | + BigQuery actualSettings = new GcpClientBuilder.BigQueryBuilder() |
| 46 | + .withConfig(config) |
| 47 | + .build(); |
| 48 | + |
| 49 | + assertEquals(actualSettings.getOptions().getProjectId(), "abcd"); |
| 50 | + } |
| 51 | + |
| 52 | +} |
0 commit comments