Skip to content

Commit b5713a4

Browse files
committed
---
yaml --- r: 6605 b: refs/heads/tswast-patch-1 c: 7eee528 h: refs/heads/master i: 6603: 7b7fa71
1 parent fc37511 commit b5713a4

5 files changed

Lines changed: 14 additions & 47 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ refs/tags/v0.18.0: 9d193c4c4b9d1c6f21515dd8e50836b9194ec9bb
5757
refs/tags/v0.19.0: e67b56e4d8dad5f9a7b38c9b2107c23c828f2ed5
5858
refs/tags/v0.20.0: 839f7fb7156535146aa1cb2c5aadd8d375d854e8
5959
refs/tags/v0.20.1: 370471f437f1f4f68a11e068df5cd6bf39edb1fa
60-
refs/heads/tswast-patch-1: ba8acf16db3b8915f382dcc6263620c0b2b20e0e
60+
refs/heads/tswast-patch-1: 7eee5287d898277f8f78a5afa51a0f9e80a511aa
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/testing/RemoteBigQueryHelper.java

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@
2222
import com.google.gcloud.bigquery.BigQueryException;
2323
import com.google.gcloud.bigquery.BigQueryOptions;
2424

25-
import java.io.FileInputStream;
26-
import java.io.FileNotFoundException;
2725
import java.io.IOException;
2826
import java.io.InputStream;
2927
import java.util.UUID;
3028
import java.util.logging.Level;
3129
import java.util.logging.Logger;
3230

3331
/**
34-
* Utility to create a remote BigQuery configuration for testing.
32+
* Utility to create a remote BigQuery configuration for testing. BigQuery options can be obtained
33+
* via the {@link #options()} method. Returned options have custom
34+
* {@link BigQueryOptions#retryParams()}: {@link RetryParams#retryMaxAttempts()} is {@code 10},
35+
* {@link RetryParams#retryMinAttempts()} is {@code 6}, {@link RetryParams#maxRetryDelayMillis()} is
36+
* {@code 30000}, {@link RetryParams#totalRetryPeriodMillis()} is {@code 120000} and
37+
* {@link RetryParams#initialRetryDelayMillis()} is {@code 250}.
38+
* {@link BigQueryOptions#connectTimeout()} and {@link BigQueryOptions#readTimeout()} are both set
39+
* to {@code 60000}.
3540
*/
3641
public class RemoteBigQueryHelper {
3742

@@ -97,27 +102,6 @@ public static RemoteBigQueryHelper create(String projectId, InputStream keyStrea
97102
}
98103
}
99104

100-
/**
101-
* Creates a {@code RemoteBigQueryHelper} object for the given project id and JSON key path.
102-
*
103-
* @param projectId id of the project to be used for running the tests
104-
* @param keyPath path to the JSON key to be used for running the tests
105-
* @return A {@code RemoteBigQueryHelper} object for the provided options.
106-
* @throws BigQueryHelperException if the file pointed by {@code keyPath} does not exist
107-
*/
108-
public static RemoteBigQueryHelper create(String projectId, String keyPath)
109-
throws BigQueryHelperException {
110-
try {
111-
InputStream keyFileStream = new FileInputStream(keyPath);
112-
return create(projectId, keyFileStream);
113-
} catch (FileNotFoundException ex) {
114-
if (log.isLoggable(Level.WARNING)) {
115-
log.log(Level.WARNING, ex.getMessage());
116-
}
117-
throw BigQueryHelperException.translate(ex);
118-
}
119-
}
120-
121105
/**
122106
* Creates a {@code RemoteBigQueryHelper} object using default project id and authentication
123107
* credentials.

branches/tswast-patch-1/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,6 @@ public Job apply(JobInfo jobInfo) {
859859
assertEquals(cursor, page.nextPageCursor());
860860
assertArrayEquals(jobList.toArray(), Iterables.toArray(page.values(), JobInfo.class));
861861
String selector = (String) capturedOptions.getValue().get(JOB_OPTION_FIELDS.rpcOption());
862-
System.out.println(selector);
863862
assertTrue(selector.contains("etag,jobs("));
864863
assertTrue(selector.contains("configuration"));
865864
assertTrue(selector.contains("jobReference"));

branches/tswast-patch-1/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/ITBigQueryTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737

3838
import org.junit.AfterClass;
3939
import org.junit.BeforeClass;
40+
import org.junit.Rule;
4041
import org.junit.Test;
42+
import org.junit.rules.Timeout;
4143

4244
import java.io.IOException;
4345
import java.nio.charset.StandardCharsets;
@@ -128,6 +130,9 @@ public class ITBigQueryTest {
128130
private static BigQuery bigquery;
129131
private static Storage storage;
130132

133+
@Rule
134+
public Timeout globalTimeout = Timeout.seconds(300);
135+
131136
@BeforeClass
132137
public static void beforeClass() throws IOException, InterruptedException {
133138
RemoteBigQueryHelper bigqueryHelper = RemoteBigQueryHelper.create();
@@ -732,7 +737,6 @@ public void testQueryJob() throws InterruptedException {
732737
assertTrue(bigquery.delete(DATASET, tableName));
733738
}
734739

735-
736740
@Test
737741
public void testExtract() throws InterruptedException {
738742
String tableName = "test_export_job_table";

branches/tswast-patch-1/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/RemoteBigQueryHelperTest.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,12 @@
2323
import com.google.gcloud.bigquery.testing.RemoteBigQueryHelper;
2424

2525
import org.easymock.EasyMock;
26-
import org.junit.BeforeClass;
2726
import org.junit.Rule;
2827
import org.junit.Test;
2928
import org.junit.rules.ExpectedException;
3029

3130
import java.io.ByteArrayInputStream;
3231
import java.io.InputStream;
33-
import java.nio.file.Files;
34-
import java.nio.file.Paths;
35-
import java.util.UUID;
3632
import java.util.concurrent.ExecutionException;
3733

3834
public class RemoteBigQueryHelperTest {
@@ -66,18 +62,9 @@ public class RemoteBigQueryHelperTest {
6662
+ " \"type\": \"service_account\"\n"
6763
+ "}";
6864
private static final InputStream JSON_KEY_STREAM = new ByteArrayInputStream(JSON_KEY.getBytes());
69-
private static String keyPath = "/does/not/exist/key." + UUID.randomUUID().toString() + ".json";
7065

7166
@Rule
7267
public ExpectedException thrown = ExpectedException.none();
73-
74-
@BeforeClass
75-
public static void beforeClass() {
76-
while (Files.exists(Paths.get(JSON_KEY))) {
77-
keyPath = "/does/not/exist/key." + UUID.randomUUID().toString() + ".json";
78-
}
79-
}
80-
8168
@Test
8269
public void testForceDelete() throws InterruptedException, ExecutionException {
8370
BigQuery bigqueryMock = EasyMock.createMock(BigQuery.class);
@@ -101,11 +88,4 @@ public void testCreateFromStream() {
10188
assertEquals(120000, options.retryParams().totalRetryPeriodMillis());
10289
assertEquals(250, options.retryParams().initialRetryDelayMillis());
10390
}
104-
105-
@Test
106-
public void testCreateNoKey() {
107-
thrown.expect(RemoteBigQueryHelper.BigQueryHelperException.class);
108-
thrown.expectMessage(keyPath + " (No such file or directory)");
109-
RemoteBigQueryHelper.create(PROJECT_ID, keyPath);
110-
}
11191
}

0 commit comments

Comments
 (0)