Skip to content

Commit ca53e60

Browse files
committed
---
yaml --- r: 6701 b: refs/heads/tswast-patch-1 c: d8b1814 h: refs/heads/master i: 6699: dfb6e4e
1 parent ea44880 commit ca53e60

19 files changed

Lines changed: 140 additions & 12 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: d58930eb7bbff659bed22f3019b16b848130ccfc
60+
refs/heads/tswast-patch-1: d8b1814479f0243e85d3b4b46b604e1608484df6
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ Using maven for build/test
1515
After you cloned the repository use Maven for building and running the tests.
1616
Maven 3.0+ is required.
1717

18+
When downloading the source, we recommend you obtain service account credentials.
19+
These credentials will allow you to run integration tests using `mvn verify` in command line.
20+
Follow step 2 of the [authentication instructions](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) to generate and use JSON service account credentials.
21+
22+
It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere.
23+
To run tests on different platforms, try deploying the apps available on the [gcloud-java-examples](https://github.com/GoogleCloudPlatform/gcloud-java-examples) repository.
24+
End-to-end tests should ensure that gcloud-java works when running on the
25+
26+
* App Engine production environment (see the docs for [uploading your app to production App Engine](https://cloud.google.com/appengine/docs/java/tools/maven#uploading_your_app_to_production_app_engine))
27+
* App Engine development server (see the docs for [testing your app with the development server](https://cloud.google.com/appengine/docs/java/tools/maven#testing_your_app_with_the_development_server))
28+
* Compute Engine (see the [Getting Started Guide](https://cloud.google.com/compute/docs/quickstart), and be sure to [enable the appropriate APIs](https://github.com/GoogleCloudPlatform/gcloud-common/tree/master/authentication#on-google-compute-engine))
29+
* Your desktop (using `mvn exec:java`, for example)
30+
31+
When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/GoogleCloudPlatform/gcloud-java#authentication) and [project ID docs](https://github.com/GoogleCloudPlatform/gcloud-java#specifying-a-project-id).
1832

1933
Adding Features
2034
---------------

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ public enum Type {
9494
private final Long expirationTime;
9595
private final Long lastModifiedTime;
9696

97+
/**
98+
* Base builder for tables.
99+
*
100+
* @param <T> the table type.
101+
* @param <B> the table builder.
102+
*/
97103
public abstract static class Builder<T extends BaseTableInfo, B extends Builder<T, B>> {
98104

99105
private String etag;

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,16 @@ public Builder ignoreUnknownValues(boolean ignoreUnknownValues) {
236236
/**
237237
* If specified, the destination table is treated as a base template. Rows are inserted into an
238238
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of
239-
* the instance table, using the schema of the base template table.
239+
* the instance table, using the schema of the base template table. Table creation might take
240+
* some time. To obtain table's information after {@link BigQuery#insertAll(InsertAllRequest)}
241+
* is called use:
242+
* <pre> {@code
243+
* String suffixTableId = ...;
244+
* BaseTableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId);
245+
* while (suffixTable == null) {
246+
* Thread.sleep(1000L);
247+
* suffixTable = bigquery.getTable(DATASET, suffixTableId);
248+
* }}</pre>
240249
*
241250
* @see <a
242251
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">
@@ -293,7 +302,16 @@ public Boolean skipInvalidRows() {
293302
/**
294303
* If specified, the destination table is treated as a base template. Rows are inserted into an
295304
* instance table named "{destination}{templateSuffix}". BigQuery will manage the creation of the
296-
* instance table, using the schema of the base template table.
305+
* instance table, using the schema of the base template table. Table creation might take some
306+
* time. To obtain table's information after {@link BigQuery#insertAll(InsertAllRequest)} is
307+
* called use:
308+
* <pre> {@code
309+
* String suffixTableId = ...;
310+
* BaseTableInfo suffixTable = bigquery.getTable(DATASET, suffixTableId);
311+
* while (suffixTable == null) {
312+
* Thread.sleep(1000L);
313+
* suffixTable = bigquery.getTable(DATASET, suffixTableId);
314+
* }}</pre>
297315
*
298316
* @see <a
299317
* href="https://cloud.google.com/bigquery/streaming-data-into-bigquery#template-tables">

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
* a table. Use {@link QueryJobInfo} for a job that runs a query.
3333
*
3434
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs">Jobs</a>
35+
*
36+
* @param <S> the statistics type.
3537
*/
3638
public abstract class JobInfo<S extends JobStatistics> implements Serializable {
3739

@@ -87,6 +89,13 @@ public enum WriteDisposition {
8789
private final S statistics;
8890
private final String userEmail;
8991

92+
/**
93+
* Base builder for jobs.
94+
*
95+
* @param <T> the job type.
96+
* @param <S> the job statistics type.
97+
* @param <B> the job builder.
98+
*/
9099
public abstract static class Builder<T extends JobInfo, S extends JobStatistics,
91100
B extends Builder<T, S, B>> {
92101

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public void testInsertAll() {
476476
}
477477

478478
@Test
479-
public void testInsertAllWithSuffix() {
479+
public void testInsertAllWithSuffix() throws InterruptedException {
480480
String tableName = "test_insert_all_with_suffix_table";
481481
BaseTableInfo tableInfo = TableInfo.of(TableId.of(DATASET, tableName), TABLE_SCHEMA);
482482
assertNotNull(bigquery.create(tableInfo));
@@ -505,7 +505,12 @@ public void testInsertAllWithSuffix() {
505505
assertFalse(response.hasErrors());
506506
assertEquals(0, response.insertErrors().size());
507507
String newTableName = tableName + "_suffix";
508-
assertNotNull(bigquery.getTable(DATASET, newTableName, TableOption.fields()));
508+
BaseTableInfo suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
509+
// wait until the new table is created. If the table is never created the test will time-out
510+
while (suffixTable == null) {
511+
Thread.sleep(1000L);
512+
suffixTable = bigquery.getTable(DATASET, newTableName, TableOption.fields());
513+
}
509514
assertTrue(bigquery.delete(TableId.of(DATASET, tableName)));
510515
assertTrue(bigquery.delete(TableId.of(DATASET, newTableName)));
511516
}

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/BaseService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616

1717
package com.google.gcloud;
1818

19+
/**
20+
* Base class for service objects.
21+
*
22+
* @param <OptionsT> the {@code ServiceOptions} subclass corresponding to the service.
23+
*/
1924
public abstract class BaseService<OptionsT extends ServiceOptions<?, ?, OptionsT>>
2025
implements Service<OptionsT> {
2126

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/Page.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
* }
4141
* page = page.nextPage();
4242
* }}</pre>
43+
*
44+
* @param <T> the value type that the page holds.
4345
*/
4446
public interface Page<T> {
4547

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/PageImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
/**
2727
* Base implementation for Google Cloud paginated results.
28+
*
29+
* @param <T> the value type that the page holds.
2830
*/
2931
public class PageImpl<T> implements Page<T>, Serializable {
3032

@@ -34,6 +36,11 @@ public class PageImpl<T> implements Page<T>, Serializable {
3436
private final Iterable<T> results;
3537
private final NextPageFetcher<T> pageFetcher;
3638

39+
/**
40+
* Interface for fetching the next page of results from the service.
41+
*
42+
* @param <T> the value type that the page holds.
43+
*/
3744
public interface NextPageFetcher<T> extends Serializable {
3845
Page<T> nextPage();
3946
}

branches/tswast-patch-1/gcloud-java-core/src/main/java/com/google/gcloud/Restorable.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
* X restorableObj = state.restore();
3434
* ...
3535
* }</pre>
36+
*
37+
* @param <T> the restorable object's type.
3638
*/
3739
public interface Restorable<T extends Restorable<T>> {
3840

0 commit comments

Comments
 (0)