Skip to content

Commit 8ad2093

Browse files
committed
---
yaml --- r: 4693 b: refs/heads/logging-alpha c: 379a0a8 h: refs/heads/master i: 4691: e1ba96d
1 parent cf75c49 commit 8ad2093

23 files changed

Lines changed: 234 additions & 495 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ refs/heads/compute-alpha: 969cba2627f1d53d352cc4a5ffe0879dacf65e6c
1212
refs/heads/dns-alpha: 2f90e7e338349287ace33375896907af0f032ca1
1313
refs/heads/dns-alpha-batch: 17442b07867021b85d0452f5f3eda29a3413288f
1414
refs/heads/gcs-nio: 283aeaf15efdcf3621eb6859f05e55ad7764375d
15-
refs/heads/logging-alpha: 4b1a4fd3cf9624983dd35a048d26d11bfe12aa61
15+
refs/heads/logging-alpha: 379a0a89e116413827339169361879480fec703b
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0
1818
refs/tags/v0.1.2: 3eb3fe866ba22487686048f45d927b8c8638ea3f

branches/logging-alpha/RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Most of the release process is handled by the `after_success.sh` script, trigger
77
1. Run `utilities/update_pom_version.sh` from the repository's base directory.
88
This script takes an optional argument denoting the new version. By default, if the current version is X.Y.Z-SNAPSHOT, the script will update the version in all the pom.xml files to X.Y.Z. If desired, another version can be supplied via command line argument instead.
99

10-
2. Create a PR to update the pom.xml version. If releasing a new client library, this PR should also update javadoc grouping in the base directory's [pom.xml](./pom.xml).
11-
PRs that don't release new modules should look something like [#225](https://github.com/GoogleCloudPlatform/gcloud-java/pull/225). PRs that do release a new module should also add the appropriate packages to the javadoc groups "SPI" and "Test helpers", as shown in [#802](https://github.com/GoogleCloudPlatform/gcloud-java/pull/802) for `gcloud-java-dns`. After this PR is merged into GoogleCloudPlatform/gcloud-java, Travis CI will push a new website to GoogleCloudPlatform/gh-pages, push a new artifact to the Maven Central Repository, and update versions in the README files.
10+
2. Create a PR to update the pom.xml version.
11+
The PR should look something like [#225](https://github.com/GoogleCloudPlatform/gcloud-java/pull/225). After this PR is merged into GoogleCloudPlatform/gcloud-java, Travis CI will push a new website to GoogleCloudPlatform/gh-pages, push a new artifact to the Maven Central Repository, and update versions in the README files.
1212

1313
3. Before moving on, verify that the artifacts have successfully been pushed to the Maven Central Repository. Open Travis CI, click the ["Build History" tab](https://travis-ci.org/GoogleCloudPlatform/gcloud-java/builds), and open the second build's logs for Step 2's PR. Be sure that you are not opening the "Pull Request" build logs. When the build finishes, scroll to the end of the log and verify that the artifacts were successfully staged and deployed. You can also search for `gcloud-java` on the [Sonatype website](https://oss.sonatype.org/#nexus-search;quick~gcloud-java) and check the latest version number. If the deployment didn't succeed because of a flaky test, rerun the build.
1414

branches/logging-alpha/codacy-conf.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

branches/logging-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/BigQuery.java

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919
import static com.google.common.base.Preconditions.checkArgument;
2020

2121
import com.google.common.base.Function;
22+
import com.google.common.base.Joiner;
2223
import com.google.common.collect.ImmutableList;
2324
import com.google.common.collect.Lists;
24-
import com.google.gcloud.FieldSelector;
25-
import com.google.gcloud.FieldSelector.Helper;
25+
import com.google.common.collect.Sets;
2626
import com.google.gcloud.Page;
2727
import com.google.gcloud.Service;
2828
import com.google.gcloud.bigquery.spi.BigQueryRpc;
2929

3030
import java.util.List;
31+
import java.util.Set;
3132

3233
/**
3334
* An interface for Google Cloud BigQuery.
@@ -42,7 +43,7 @@ public interface BigQuery extends Service<BigQueryOptions> {
4243
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/datasets#resource">Dataset
4344
* Resource</a>
4445
*/
45-
enum DatasetField implements FieldSelector {
46+
enum DatasetField {
4647
ACCESS("access"),
4748
CREATION_TIME("creationTime"),
4849
DATASET_REFERENCE("datasetReference"),
@@ -55,19 +56,24 @@ enum DatasetField implements FieldSelector {
5556
LOCATION("location"),
5657
SELF_LINK("selfLink");
5758

58-
static final List<? extends FieldSelector> REQUIRED_FIELDS =
59-
ImmutableList.of(DATASET_REFERENCE);
60-
6159
private final String selector;
6260

6361
DatasetField(String selector) {
6462
this.selector = selector;
6563
}
6664

67-
@Override
6865
public String selector() {
6966
return selector;
7067
}
68+
69+
static String selector(DatasetField... fields) {
70+
Set<String> fieldStrings = Sets.newHashSetWithExpectedSize(fields.length + 1);
71+
fieldStrings.add(DATASET_REFERENCE.selector());
72+
for (DatasetField field : fields) {
73+
fieldStrings.add(field.selector());
74+
}
75+
return Joiner.on(',').join(fieldStrings);
76+
}
7177
}
7278

7379
/**
@@ -76,7 +82,7 @@ public String selector() {
7682
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/tables#resource">Table
7783
* Resource</a>
7884
*/
79-
enum TableField implements FieldSelector {
85+
enum TableField {
8086
CREATION_TIME("creationTime"),
8187
DESCRIPTION("description"),
8288
ETAG("etag"),
@@ -95,19 +101,25 @@ enum TableField implements FieldSelector {
95101
TYPE("type"),
96102
VIEW("view");
97103

98-
static final List<? extends FieldSelector> REQUIRED_FIELDS =
99-
ImmutableList.of(TABLE_REFERENCE, TYPE);
100-
101104
private final String selector;
102105

103106
TableField(String selector) {
104107
this.selector = selector;
105108
}
106109

107-
@Override
108110
public String selector() {
109111
return selector;
110112
}
113+
114+
static String selector(TableField... fields) {
115+
Set<String> fieldStrings = Sets.newHashSetWithExpectedSize(fields.length + 2);
116+
fieldStrings.add(TABLE_REFERENCE.selector());
117+
fieldStrings.add(TYPE.selector());
118+
for (TableField field : fields) {
119+
fieldStrings.add(field.selector());
120+
}
121+
return Joiner.on(',').join(fieldStrings);
122+
}
111123
}
112124

113125
/**
@@ -116,7 +128,7 @@ public String selector() {
116128
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs#resource">Job Resource
117129
* </a>
118130
*/
119-
enum JobField implements FieldSelector {
131+
enum JobField {
120132
CONFIGURATION("configuration"),
121133
ETAG("etag"),
122134
ID("id"),
@@ -126,19 +138,25 @@ enum JobField implements FieldSelector {
126138
STATUS("status"),
127139
USER_EMAIL("user_email");
128140

129-
static final List<? extends FieldSelector> REQUIRED_FIELDS =
130-
ImmutableList.of(JOB_REFERENCE, CONFIGURATION);
131-
132141
private final String selector;
133142

134143
JobField(String selector) {
135144
this.selector = selector;
136145
}
137146

138-
@Override
139147
public String selector() {
140148
return selector;
141149
}
150+
151+
static String selector(JobField... fields) {
152+
Set<String> fieldStrings = Sets.newHashSetWithExpectedSize(fields.length + 2);
153+
fieldStrings.add(JOB_REFERENCE.selector());
154+
fieldStrings.add(CONFIGURATION.selector());
155+
for (JobField field : fields) {
156+
fieldStrings.add(field.selector());
157+
}
158+
return Joiner.on(',').join(fieldStrings);
159+
}
142160
}
143161

144162
/**
@@ -192,8 +210,7 @@ private DatasetOption(BigQueryRpc.Option option, Object value) {
192210
* returned, even if not specified.
193211
*/
194212
public static DatasetOption fields(DatasetField... fields) {
195-
return new DatasetOption(BigQueryRpc.Option.FIELDS,
196-
Helper.selector(DatasetField.REQUIRED_FIELDS, fields));
213+
return new DatasetOption(BigQueryRpc.Option.FIELDS, DatasetField.selector(fields));
197214
}
198215
}
199216

@@ -262,8 +279,7 @@ private TableOption(BigQueryRpc.Option option, Object value) {
262279
* of {@link Table#definition()}) are always returned, even if not specified.
263280
*/
264281
public static TableOption fields(TableField... fields) {
265-
return new TableOption(BigQueryRpc.Option.FIELDS,
266-
Helper.selector(TableField.REQUIRED_FIELDS, fields));
282+
return new TableOption(BigQueryRpc.Option.FIELDS, TableField.selector(fields));
267283
}
268284
}
269285

@@ -360,8 +376,10 @@ public static JobListOption pageToken(String pageToken) {
360376
* listing jobs.
361377
*/
362378
public static JobListOption fields(JobField... fields) {
363-
return new JobListOption(BigQueryRpc.Option.FIELDS,
364-
Helper.listSelector("jobs", JobField.REQUIRED_FIELDS, fields, "state", "errorResult"));
379+
String selector = JobField.selector(fields);
380+
StringBuilder builder = new StringBuilder();
381+
builder.append("etag,jobs(").append(selector).append(",state,errorResult),nextPageToken");
382+
return new JobListOption(BigQueryRpc.Option.FIELDS, builder.toString());
365383
}
366384
}
367385

@@ -384,8 +402,7 @@ private JobOption(BigQueryRpc.Option option, Object value) {
384402
* returned, even if not specified.
385403
*/
386404
public static JobOption fields(JobField... fields) {
387-
return new JobOption(BigQueryRpc.Option.FIELDS,
388-
Helper.selector(JobField.REQUIRED_FIELDS, fields));
405+
return new JobOption(BigQueryRpc.Option.FIELDS, JobField.selector(fields));
389406
}
390407
}
391408

branches/logging-alpha/gcloud-java-bigquery/src/main/java/com/google/gcloud/bigquery/Option.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/**
2828
* Base class for BigQuery operation option.
2929
*/
30-
abstract class Option implements Serializable {
30+
class Option implements Serializable {
3131

3232
private static final long serialVersionUID = -6647817677804099207L;
3333

@@ -53,7 +53,8 @@ public boolean equals(Object obj) {
5353
return false;
5454
}
5555
Option other = (Option) obj;
56-
return Objects.equals(rpcOption, other.rpcOption) && Objects.equals(value, other.value);
56+
return Objects.equals(rpcOption, other.rpcOption)
57+
&& Objects.equals(value, other.value);
5758
}
5859

5960
@Override

branches/logging-alpha/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/BigQueryImplTest.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,14 +886,12 @@ public com.google.api.services.bigquery.model.Job apply(Job job) {
886886
assertEquals(cursor, page.nextPageCursor());
887887
assertArrayEquals(jobList.toArray(), Iterables.toArray(page.values(), Job.class));
888888
String selector = (String) capturedOptions.getValue().get(JOB_OPTION_FIELDS.rpcOption());
889-
assertTrue(selector.contains("nextPageToken,jobs("));
889+
assertTrue(selector.contains("etag,jobs("));
890890
assertTrue(selector.contains("configuration"));
891891
assertTrue(selector.contains("jobReference"));
892892
assertTrue(selector.contains("statistics"));
893-
assertTrue(selector.contains("state"));
894-
assertTrue(selector.contains("errorResult"));
895-
assertTrue(selector.contains(")"));
896-
assertEquals(75, selector.length());
893+
assertTrue(selector.contains("state,errorResult),nextPageToken"));
894+
assertEquals(80, selector.length());
897895
}
898896

899897
@Test

branches/logging-alpha/gcloud-java-bigquery/src/test/java/com/google/gcloud/bigquery/OptionTest.java

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,49 +17,22 @@
1717
package com.google.gcloud.bigquery;
1818

1919
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNotEquals;
21-
import static org.junit.Assert.assertNull;
2220

2321
import com.google.gcloud.bigquery.spi.BigQueryRpc;
2422

25-
import org.junit.Rule;
2623
import org.junit.Test;
27-
import org.junit.rules.ExpectedException;
2824

2925
public class OptionTest {
3026

31-
private static final BigQueryRpc.Option RPC_OPTION = BigQueryRpc.Option.PAGE_TOKEN;
32-
private static final BigQueryRpc.Option ANOTHER_RPC_OPTION = BigQueryRpc.Option.FIELDS;
33-
private static final String VALUE = "some value";
34-
private static final String OTHER_VALUE = "another value";
35-
private static final Option OPTION = new Option(RPC_OPTION, VALUE) {};
36-
private static final Option OPTION_EQUALS = new Option(RPC_OPTION, VALUE) {};
37-
private static final Option OPTION_NOT_EQUALS1 = new Option(RPC_OPTION, OTHER_VALUE) {};
38-
private static final Option OPTION_NOT_EQUALS2 = new Option(ANOTHER_RPC_OPTION, VALUE) {};
39-
40-
@Rule
41-
public ExpectedException thrown = ExpectedException.none();
42-
43-
@Test
44-
public void testEquals() {
45-
assertEquals(OPTION, OPTION_EQUALS);
46-
assertNotEquals(OPTION, OPTION_NOT_EQUALS1);
47-
assertNotEquals(OPTION, OPTION_NOT_EQUALS2);
48-
}
49-
5027
@Test
51-
public void testHashCode() {
52-
assertEquals(OPTION.hashCode(), OPTION_EQUALS.hashCode());
28+
public void testOption() {
29+
Option option = new Option(BigQueryRpc.Option.PAGE_TOKEN, "token");
30+
assertEquals(BigQueryRpc.Option.PAGE_TOKEN, option.rpcOption());
31+
assertEquals("token", option.value());
5332
}
5433

55-
@Test
56-
public void testConstructor() {
57-
assertEquals(RPC_OPTION, OPTION.rpcOption());
58-
assertEquals(VALUE, OPTION.value());
59-
Option option = new Option(RPC_OPTION, null) {};
60-
assertEquals(RPC_OPTION, option.rpcOption());
61-
assertNull(option.value());
62-
thrown.expect(NullPointerException.class);
63-
new Option(null, VALUE) {};
34+
@Test(expected = NullPointerException.class)
35+
public void testNullRpcOption() {
36+
new Option(null, "token");
6437
}
6538
}

branches/logging-alpha/gcloud-java-core/src/main/java/com/google/gcloud/FieldSelector.java

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)