Skip to content

Commit eec4f77

Browse files
committed
---
yaml --- r: 2027 b: refs/heads/pubsub-alpha c: 7eee528 h: refs/heads/master i: 2025: b69f60d 2023: 5de78ca
1 parent 0b5fe68 commit eec4f77

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
@@ -3,7 +3,7 @@ refs/heads/master: 689bbb466df4b2d5d2483d6edb8ac5c7c7f7c6fa
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
6-
refs/heads/pubsub-alpha: ba8acf16db3b8915f382dcc6263620c0b2b20e0e
6+
refs/heads/pubsub-alpha: 7eee5287d898277f8f78a5afa51a0f9e80a511aa
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
88
refs/heads/update-datastore: 482954f2c5055231e5b3122ea91d2ba00ce8187c
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444

branches/pubsub-alpha/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/pubsub-alpha/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/pubsub-alpha/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/pubsub-alpha/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)