Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
docs(samples): fix checkstyle errors (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
Praful Makani committed Aug 21, 2020
1 parent e124018 commit 3e7ba7f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 30 deletions.
Expand Up @@ -24,7 +24,6 @@
import com.google.cloud.bigquery.datatransfer.v1.TransferConfig;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -34,10 +33,11 @@ public class CreateScheduledQuery {

public static void runCreateScheduledQuery() {
// TODO(developer): Replace these variables before running the sample.
String projectId = "MY_PROJECT_ID";
String datasetId = "MY_DATASET_ID";
String query =
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, @run_date as intended_run_date, 17 as some_integer";
final String projectId = "MY_PROJECT_ID";
final String datasetId = "MY_DATASET_ID";
final String query =
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, "
+ "@run_date as intended_run_date, 17 as some_integer";
Map<String, Value> params = new HashMap<>();
params.put("query", Value.newBuilder().setStringValue(query).build());
params.put(
Expand Down
Expand Up @@ -20,7 +20,6 @@
import com.google.api.gax.rpc.ApiException;
import com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient;
import com.google.cloud.bigquery.datatransfer.v1.DeleteTransferConfigRequest;

import java.io.IOException;

// Sample to delete a scheduled query
Expand Down
Expand Up @@ -25,9 +25,7 @@
import com.google.cloud.bigquery.datatransfer.v1.ListDataSourcesRequest;

public class QuickstartSample {
/**
* List available data sources for the BigQuery Data Transfer service.
*/
/** List available data sources for the BigQuery Data Transfer service. */
public static void main(String... args) throws Exception {
// Sets your Google Cloud Platform project ID.
// String projectId = "YOUR_PROJECT_ID";
Expand All @@ -40,9 +38,7 @@ public static void main(String... args) throws Exception {
// Request the list of available data sources.
String parent = String.format("projects/%s", projectId);
ListDataSourcesRequest request =
ListDataSourcesRequest.newBuilder()
.setParent(parent)
.build();
ListDataSourcesRequest.newBuilder().setParent(parent).build();
ListDataSourcesPagedResponse response = client.listDataSources(request);

// Print the results.
Expand Down
Expand Up @@ -16,26 +16,25 @@

package com.example.bigquerydatatransfer;

import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;

import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.DatasetInfo;
import com.google.cloud.bigquery.datatransfer.v1.TransferConfig;
import com.google.cloud.bigquery.datatransfer.v1.TransferState;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class CreateScheduledQueryIT {

Expand Down Expand Up @@ -85,7 +84,8 @@ public void tearDown() {
@Test
public void testCreateScheduledQuery() {
String query =
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, @run_date as intended_run_date, 17 as some_integer";
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, "
+ "@run_date as intended_run_date, 17 as some_integer";
String destinationTableName =
"MY_DESTINATION_TABLE_" + UUID.randomUUID().toString().substring(0, 8) + "_{run_date}";
Map<String, Value> params = new HashMap<>();
Expand Down
Expand Up @@ -16,25 +16,24 @@

package com.example.bigquerydatatransfer;

import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;

import com.google.cloud.bigquery.BigQuery;
import com.google.cloud.bigquery.BigQueryOptions;
import com.google.cloud.bigquery.DatasetInfo;
import com.google.cloud.bigquery.datatransfer.v1.TransferConfig;
import com.google.protobuf.Struct;
import com.google.protobuf.Value;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import static com.google.common.truth.Truth.assertThat;
import static junit.framework.TestCase.assertNotNull;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class DeleteScheduledQueryIT {

Expand Down Expand Up @@ -74,7 +73,8 @@ public void setUp() {

// create a scheduled query
String query =
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, @run_date as intended_run_date, 17 as some_integer";
"SELECT CURRENT_TIMESTAMP() as current_time, @run_time as intended_run_time, "
+ "@run_date as intended_run_date, 17 as some_integer";
String destinationTableName =
"MY_DESTINATION_TABLE_" + UUID.randomUUID().toString().substring(0, 8) + "_{run_date}";
Map<String, Value> params = new HashMap<>();
Expand Down

0 comments on commit 3e7ba7f

Please sign in to comment.