Skip to content

Commit 1de4361

Browse files
committed
---
yaml --- r: 7575 b: refs/heads/tswast-patch-1 c: 49e2cd9 h: refs/heads/master i: 7573: 126f672 7571: 369c8e3 7567: 389c554
1 parent a760118 commit 1de4361

66 files changed

Lines changed: 281 additions & 3400 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[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: 470d948b17d01b7a6c249ddecf23069f4cfcae17
60+
refs/heads/tswast-patch-1: 49e2cd94548b22f90bf332feb0480c8bb38adcac
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

branches/tswast-patch-1/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableDataWriteChannel.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,14 @@
2424
import com.google.cloud.RetryHelper;
2525
import com.google.cloud.WriteChannel;
2626

27-
import java.util.concurrent.Callable;
28-
2927
/**
3028
* WriteChannel implementation to stream data into a BigQuery table.
3129
*/
3230
class TableDataWriteChannel extends BaseWriteChannel<BigQueryOptions, WriteChannelConfiguration> {
3331

3432
TableDataWriteChannel(BigQueryOptions options,
3533
WriteChannelConfiguration writeChannelConfiguration) {
36-
this(options, writeChannelConfiguration, open(options, writeChannelConfiguration));
34+
this(options, writeChannelConfiguration, options.rpc().open(writeChannelConfiguration.toPb()));
3735
}
3836

3937
TableDataWriteChannel(BigQueryOptions options, WriteChannelConfiguration config,
@@ -60,20 +58,6 @@ protected StateImpl.Builder stateBuilder() {
6058
return StateImpl.builder(options(), entity(), uploadId());
6159
}
6260

63-
private static String open(final BigQueryOptions options,
64-
final WriteChannelConfiguration writeChannelConfiguration) {
65-
try {
66-
return runWithRetries(new Callable<String>() {
67-
@Override
68-
public String call() {
69-
return options.rpc().open(writeChannelConfiguration.toPb());
70-
}
71-
}, options.retryParams(), BigQueryImpl.EXCEPTION_HANDLER, options.clock());
72-
} catch (RetryHelper.RetryHelperException e) {
73-
throw BigQueryException.translateAndThrow(e);
74-
}
75-
}
76-
7761
static class StateImpl
7862
extends BaseWriteChannel.BaseState<BigQueryOptions, WriteChannelConfiguration> {
7963

branches/tswast-patch-1/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/TableDataWriteChannelTest.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@
3939
import org.easymock.CaptureType;
4040
import org.junit.After;
4141
import org.junit.Before;
42-
import org.junit.Rule;
4342
import org.junit.Test;
44-
import org.junit.rules.ExpectedException;
4543

4644
import java.io.IOException;
47-
import java.net.SocketException;
4845
import java.nio.ByteBuffer;
4946
import java.util.Arrays;
5047
import java.util.Random;
@@ -66,9 +63,6 @@ public class TableDataWriteChannelTest {
6663
private static final int CUSTOM_CHUNK_SIZE = 4 * MIN_CHUNK_SIZE;
6764
private static final Random RANDOM = new Random();
6865

69-
@Rule
70-
public ExpectedException thrown = ExpectedException.none();
71-
7266
private BigQueryOptions options;
7367
private BigQueryRpcFactory rpcFactoryMock;
7468
private BigQueryRpc bigqueryRpcMock;
@@ -78,7 +72,8 @@ public class TableDataWriteChannelTest {
7872
public void setUp() {
7973
rpcFactoryMock = createMock(BigQueryRpcFactory.class);
8074
bigqueryRpcMock = createMock(BigQueryRpc.class);
81-
expect(rpcFactoryMock.create(anyObject(BigQueryOptions.class))).andReturn(bigqueryRpcMock);
75+
expect(rpcFactoryMock.create(anyObject(BigQueryOptions.class)))
76+
.andReturn(bigqueryRpcMock);
8277
replay(rpcFactoryMock);
8378
options = BigQueryOptions.builder()
8479
.projectId("projectid")
@@ -99,24 +94,6 @@ public void testCreate() {
9994
assertTrue(writer.isOpen());
10095
}
10196

102-
@Test
103-
public void testCreateRetryableError() {
104-
BigQueryException exception = new BigQueryException(new SocketException("Socket closed"));
105-
expect(bigqueryRpcMock.open(LOAD_CONFIGURATION.toPb())).andThrow(exception);
106-
expect(bigqueryRpcMock.open(LOAD_CONFIGURATION.toPb())).andReturn(UPLOAD_ID);
107-
replay(bigqueryRpcMock);
108-
writer = new TableDataWriteChannel(options, LOAD_CONFIGURATION);
109-
assertTrue(writer.isOpen());
110-
}
111-
112-
@Test
113-
public void testCreateNonRetryableError() {
114-
expect(bigqueryRpcMock.open(LOAD_CONFIGURATION.toPb())).andThrow(new RuntimeException());
115-
replay(bigqueryRpcMock);
116-
thrown.expect(RuntimeException.class);
117-
new TableDataWriteChannel(options, LOAD_CONFIGURATION);
118-
}
119-
12097
@Test
12198
public void testWriteWithoutFlush() throws IOException {
12299
expect(bigqueryRpcMock.open(LOAD_CONFIGURATION.toPb())).andReturn(UPLOAD_ID);

branches/tswast-patch-1/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/FakeStorageRpc.java

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
package com.google.cloud.storage.contrib.nio;
1818

1919
import com.google.api.services.storage.model.Bucket;
20-
import com.google.api.services.storage.model.BucketAccessControl;
21-
import com.google.api.services.storage.model.ObjectAccessControl;
2220
import com.google.api.services.storage.model.StorageObject;
2321
import com.google.cloud.storage.Storage;
2422
import com.google.cloud.storage.StorageException;
@@ -338,81 +336,6 @@ public RewriteResponse continueRewrite(RewriteResponse previousResponse) throws
338336
throw new UnsupportedOperationException();
339337
}
340338

341-
@Override
342-
public BucketAccessControl getAcl(String bucket, String entity) {
343-
throw new UnsupportedOperationException();
344-
}
345-
346-
@Override
347-
public boolean deleteAcl(String bucket, String entity) {
348-
throw new UnsupportedOperationException();
349-
}
350-
351-
@Override
352-
public BucketAccessControl createAcl(BucketAccessControl acl) {
353-
throw new UnsupportedOperationException();
354-
}
355-
356-
@Override
357-
public BucketAccessControl patchAcl(BucketAccessControl acl) {
358-
throw new UnsupportedOperationException();
359-
}
360-
361-
@Override
362-
public List<BucketAccessControl> listAcls(String bucket) {
363-
throw new UnsupportedOperationException();
364-
}
365-
366-
@Override
367-
public ObjectAccessControl getDefaultAcl(String bucket, String entity) {
368-
throw new UnsupportedOperationException();
369-
}
370-
371-
@Override
372-
public boolean deleteDefaultAcl(String bucket, String entity) {
373-
throw new UnsupportedOperationException();
374-
}
375-
376-
@Override
377-
public ObjectAccessControl createDefaultAcl(ObjectAccessControl acl) {
378-
throw new UnsupportedOperationException();
379-
}
380-
381-
@Override
382-
public ObjectAccessControl patchDefaultAcl(ObjectAccessControl acl) {
383-
throw new UnsupportedOperationException();
384-
}
385-
386-
@Override
387-
public List<ObjectAccessControl> listDefaultAcls(String bucket) {
388-
throw new UnsupportedOperationException();
389-
}
390-
391-
@Override
392-
public ObjectAccessControl getAcl(String bucket, String object, Long generation, String entity) {
393-
throw new UnsupportedOperationException();
394-
}
395-
396-
@Override
397-
public boolean deleteAcl(String bucket, String object, Long generation, String entity) {
398-
throw new UnsupportedOperationException();
399-
}
400-
401-
@Override
402-
public ObjectAccessControl createAcl(ObjectAccessControl acl) {
403-
throw new UnsupportedOperationException();
404-
}
405-
406-
@Override
407-
public ObjectAccessControl patchAcl(ObjectAccessControl acl) {
408-
throw new UnsupportedOperationException();
409-
}
410-
411-
@Override
412-
public List<ObjectAccessControl> listAcls(String bucket, String object, Long generation) {
413-
throw new UnsupportedOperationException();
414-
}
415-
416339
private String fullname(StorageObject so) {
417340
return (so.getBucket() + "/" + so.getName());
418341
}

branches/tswast-patch-1/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseEntity.java

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
import static com.google.cloud.datastore.NullValue.of;
2929
import static com.google.cloud.datastore.StringValue.of;
3030

31+
import com.google.common.base.MoreObjects;
3132
import com.google.common.collect.ImmutableSortedMap;
3233
import com.google.common.collect.Maps;
33-
import com.google.protobuf.InvalidProtocolBufferException;
3434

3535
import java.util.HashMap;
3636
import java.util.LinkedList;
@@ -49,12 +49,10 @@
4949
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">Google Cloud Datastore
5050
* Entities, Properties, and Keys</a>
5151
*/
52-
public abstract class BaseEntity<K extends IncompleteKey>
53-
extends Serializable<com.google.datastore.v1.Entity> {
52+
public abstract class BaseEntity<K extends IncompleteKey> implements java.io.Serializable {
5453

55-
private static final long serialVersionUID = 8175618724683792766L;
56-
57-
private final transient ImmutableSortedMap<String, Value<?>> properties;
54+
private static final long serialVersionUID = -9070588108769487081L;
55+
private final ImmutableSortedMap<String, Value<?>> properties;
5856
private final K key;
5957

6058
public abstract static class Builder<K extends IncompleteKey, B extends Builder<K, B>> {
@@ -459,6 +457,14 @@ public B setNull(String name) {
459457
this.properties = from.properties;
460458
}
461459

460+
@Override
461+
public String toString() {
462+
return MoreObjects.toStringHelper(this)
463+
.add("key", key)
464+
.add("properties", properties)
465+
.toString();
466+
}
467+
462468
@Override
463469
public int hashCode() {
464470
return Objects.hash(key, properties);
@@ -643,16 +649,6 @@ ImmutableSortedMap<String, Value<?>> properties() {
643649
return properties;
644650
}
645651

646-
@Override
647-
Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException {
648-
Builder<?, ?> builder = emptyBuilder();
649-
builder.fill(com.google.datastore.v1.Entity.parseFrom(bytesPb));
650-
return builder.build();
651-
}
652-
653-
protected abstract Builder<?, ?> emptyBuilder();
654-
655-
@Override
656652
final com.google.datastore.v1.Entity toPb() {
657653
com.google.datastore.v1.Entity.Builder entityPb = com.google.datastore.v1.Entity.newBuilder();
658654
Map<String, com.google.datastore.v1.Value> propertiesPb = entityPb.getMutableProperties();

branches/tswast-patch-1/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BaseKey.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,25 @@
2020
import static com.google.cloud.datastore.Validator.validateKind;
2121
import static com.google.cloud.datastore.Validator.validateNamespace;
2222

23+
import com.google.common.base.MoreObjects;
2324
import com.google.common.base.Preconditions;
2425
import com.google.common.collect.ImmutableList;
2526

27+
import java.io.Serializable;
2628
import java.util.LinkedList;
2729
import java.util.List;
2830
import java.util.Objects;
2931

3032
/**
3133
* Base class for keys.
3234
*/
33-
public abstract class BaseKey extends Serializable<com.google.datastore.v1.Key> {
35+
public abstract class BaseKey implements Serializable {
3436

35-
private static final long serialVersionUID = -4671243265877410635L;
37+
private static final long serialVersionUID = -5897863400209818325L;
3638

37-
private final transient String projectId;
38-
private final transient String namespace;
39-
private final transient ImmutableList<PathElement> path;
39+
private final String projectId;
40+
private final String namespace;
41+
private final ImmutableList<PathElement> path;
4042

4143
/**
4244
* Base class for key builders.
@@ -158,6 +160,15 @@ public String kind() {
158160

159161
abstract BaseKey parent();
160162

163+
@Override
164+
public String toString() {
165+
return MoreObjects.toStringHelper(this)
166+
.add("projectId", projectId)
167+
.add("namespace", namespace)
168+
.add("path", path)
169+
.toString();
170+
}
171+
161172
@Override
162173
public int hashCode() {
163174
return Objects.hash(projectId(), namespace(), path());
@@ -177,7 +188,6 @@ public boolean equals(Object obj) {
177188
&& Objects.equals(path(), other.path());
178189
}
179190

180-
@Override
181191
com.google.datastore.v1.Key toPb() {
182192
com.google.datastore.v1.Key.Builder keyPb = com.google.datastore.v1.Key.newBuilder();
183193
com.google.datastore.v1.PartitionId.Builder partitionIdPb =

branches/tswast-patch-1/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Blob.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
import com.google.common.base.MoreObjects;
2222
import com.google.common.base.MoreObjects.ToStringHelper;
2323
import com.google.protobuf.ByteString;
24-
import com.google.protobuf.InvalidProtocolBufferException;
2524

2625
import java.io.BufferedInputStream;
2726
import java.io.ByteArrayOutputStream;
2827
import java.io.IOException;
2928
import java.io.InputStream;
29+
import java.io.Serializable;
3030
import java.nio.ByteBuffer;
3131

3232
/**
@@ -36,11 +36,11 @@
3636
* @see <a href="https://cloud.google.com/datastore/docs/concepts/entities">
3737
* Google Cloud Datastore Entities, Properties, and Keys</a>
3838
*/
39-
public final class Blob extends Serializable<com.google.datastore.v1.Value> {
39+
public final class Blob implements Serializable {
4040

41-
private static final long serialVersionUID = 3835421019618247721L;
41+
private static final long serialVersionUID = 7311366042557240313L;
4242

43-
private final transient ByteString byteString;
43+
private final ByteString byteString;
4444

4545
Blob(ByteString byteString) {
4646
this.byteString = checkNotNull(byteString);
@@ -144,13 +144,7 @@ public static Blob copyFrom(InputStream input) throws IOException {
144144
return copyFrom(bytes.toByteArray());
145145
}
146146

147-
@Override
148147
com.google.datastore.v1.Value toPb() {
149148
return com.google.datastore.v1.Value.newBuilder().setBlobValue(byteString).build();
150149
}
151-
152-
@Override
153-
Object fromPb(byte[] bytesPb) throws InvalidProtocolBufferException {
154-
return new Blob(com.google.datastore.v1.Value.parseFrom(bytesPb).getBlobValue());
155-
}
156150
}

branches/tswast-patch-1/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BlobValue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public final class BlobValue extends Value<Blob> {
2525
static final BaseMarshaller<Blob, BlobValue, Builder> MARSHALLER =
2626
new BaseMarshaller<Blob, BlobValue, Builder>() {
2727

28-
private static final long serialVersionUID = -823515687083612387L;
28+
private static final long serialVersionUID = -739627441374592171L;
2929

3030
@Override
3131
public int getProtoFieldId() {

branches/tswast-patch-1/google-cloud-datastore/src/main/java/com/google/cloud/datastore/BooleanValue.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
public final class BooleanValue extends Value<Boolean> {
2222

23-
private static final long serialVersionUID = -542649497897250340L;
23+
private static final long serialVersionUID = -6692551696100439451L;
2424

2525
static final BaseMarshaller<Boolean, BooleanValue, Builder> MARSHALLER =
2626
new BaseMarshaller<Boolean, BooleanValue, Builder>() {
2727

28-
private static final long serialVersionUID = 7080467411349092522L;
28+
private static final long serialVersionUID = 5178009712526977429L;
2929

3030
@Override
3131
public int getProtoFieldId() {

0 commit comments

Comments
 (0)