Skip to content

Commit bb3ce6a

Browse files
committed
---
yaml --- r: 7181 b: refs/heads/tswast-patch-1 c: 29b1ea5 h: refs/heads/master i: 7179: bc38f86
1 parent 8ef62bd commit bb3ce6a

21 files changed

Lines changed: 93 additions & 102 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: 804d44785aa5ff1c3d6654dbb57a56f8ee81b2af
60+
refs/heads/tswast-patch-1: 29b1ea56a18978e5fb93b28ea71955d4f356047c
6161
refs/heads/pubsub-streaming-pull: 19262b752ee874eb2ca3b950eb2aef44d5a5267b

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,19 @@ public boolean exists() {
128128

129129
/**
130130
* Checks if this job has completed its execution, either failing or succeeding. If the job does
131-
* not exist this method returns {@code false}. To correctly wait for job's completion check that
132-
* the job exists first, using {@link #exists()}:
131+
* not exist this method returns {@code true}. You can wait for job completion with:
133132
* <pre> {@code
134-
* if (job.exists()) {
135-
* while(!job.isDone()) {
136-
* Thread.sleep(1000L);
137-
* }
133+
* while(!job.isDone()) {
134+
* Thread.sleep(1000L);
138135
* }}</pre>
139136
*
140-
* @return {@code true} if this job is in {@link JobStatus.State#DONE} state, {@code false} if the
141-
* state is not {@link JobStatus.State#DONE} or the job does not exist
137+
* @return {@code true} if this job is in {@link JobStatus.State#DONE} state or if it does not
138+
* exist, {@code false} if the state is not {@link JobStatus.State#DONE}
142139
* @throws BigQueryException upon failure
143140
*/
144141
public boolean isDone() {
145142
Job job = bigquery.getJob(jobId(), BigQuery.JobOption.fields(BigQuery.JobField.STATUS));
146-
return job != null && job.status().state() == JobStatus.State.DONE;
143+
return job == null || job.status().state() == JobStatus.State.DONE;
147144
}
148145

149146
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public void testIsDone_NotExists() throws Exception {
172172
expect(bigquery.getJob(JOB_INFO.jobId(), expectedOptions)).andReturn(null);
173173
replay(bigquery);
174174
initializeJob();
175-
assertFalse(job.isDone());
175+
assertTrue(job.isDone());
176176
}
177177

178178
@Test

branches/tswast-patch-1/gcloud-java-dns/pom.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<groupId>com.google.gcloud</groupId>
76
<artifactId>gcloud-java-dns</artifactId>
87
<packaging>jar</packaging>
98
<name>GCloud Java DNS</name>

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ChangeRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static ChangeRequest fromPb(Dns dns, String zoneName, Change pb) {
221221
static Function<Change, ChangeRequest> fromPbFunction(final Dns dns, final String zoneName) {
222222
return new Function<Change, ChangeRequest>() {
223223
@Override
224-
public ChangeRequest apply(com.google.api.services.dns.model.Change pb) {
224+
public ChangeRequest apply(Change pb) {
225225
return ChangeRequest.fromPb(dns, zoneName, pb);
226226
}
227227
};

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.google.gcloud.Service;
2424
import com.google.gcloud.dns.spi.DnsRpc;
2525

26-
import java.io.Serializable;
2726
import java.util.List;
2827

2928
/**

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsImpl.java

Lines changed: 29 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
package com.google.gcloud.dns;
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
20-
import static com.google.gcloud.RetryHelper.RetryHelperException;
2120
import static com.google.gcloud.RetryHelper.runWithRetries;
2221

2322
import com.google.api.services.dns.model.Change;
2423
import com.google.api.services.dns.model.ManagedZone;
24+
import com.google.api.services.dns.model.Project;
2525
import com.google.api.services.dns.model.ResourceRecordSet;
2626
import com.google.common.base.Function;
2727
import com.google.common.collect.ImmutableList;
@@ -121,8 +121,7 @@ private static Page<Zone> listZones(final DnsOptions serviceOptions,
121121
// this differs from the other list operations since zone is functional and requires dns service
122122
Function<ManagedZone, Zone> pbToZoneFunction = new Function<ManagedZone, Zone>() {
123123
@Override
124-
public Zone apply(
125-
com.google.api.services.dns.model.ManagedZone zonePb) {
124+
public Zone apply(ManagedZone zonePb) {
126125
return Zone.fromPb(serviceOptions.service(), zonePb);
127126
}
128127
};
@@ -142,7 +141,7 @@ public DnsRpc.ListResult<ManagedZone> call() {
142141
? ImmutableList.<Zone>of() : Iterables.transform(result.results(), pbToZoneFunction);
143142
return new PageImpl<>(new ZonePageFetcher(serviceOptions, cursor, optionsMap),
144143
cursor, zones);
145-
} catch (RetryHelperException e) {
144+
} catch (RetryHelper.RetryHelperException e) {
146145
throw DnsException.translateAndThrow(e);
147146
}
148147
}
@@ -169,10 +168,10 @@ public DnsRpc.ListResult<Change> call() {
169168
Iterable<ChangeRequest> changes = result.results() == null
170169
? ImmutableList.<ChangeRequest>of()
171170
: Iterables.transform(result.results(),
172-
ChangeRequest.fromPbFunction(serviceOptions.service(), zoneName));
171+
ChangeRequest.fromPbFunction(serviceOptions.service(), zoneName));
173172
return new PageImpl<>(new ChangeRequestPageFetcher(zoneName, serviceOptions, cursor,
174173
optionsMap), cursor, changes);
175-
} catch (RetryHelperException e) {
174+
} catch (RetryHelper.RetryHelperException e) {
176175
throw DnsException.translateAndThrow(e);
177176
}
178177
}
@@ -201,7 +200,7 @@ public DnsRpc.ListResult<ResourceRecordSet> call() {
201200
: Iterables.transform(result.results(), RecordSet.FROM_PB_FUNCTION);
202201
return new PageImpl<>(new DnsRecordPageFetcher(zoneName, serviceOptions, cursor, optionsMap),
203202
cursor, recordSets);
204-
} catch (RetryHelperException e) {
203+
} catch (RetryHelper.RetryHelperException e) {
205204
throw DnsException.translateAndThrow(e);
206205
}
207206
}
@@ -210,10 +209,10 @@ public DnsRpc.ListResult<ResourceRecordSet> call() {
210209
public Zone create(final ZoneInfo zoneInfo, Dns.ZoneOption... options) {
211210
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
212211
try {
213-
com.google.api.services.dns.model.ManagedZone answer = runWithRetries(
214-
new Callable<com.google.api.services.dns.model.ManagedZone>() {
212+
ManagedZone answer = runWithRetries(
213+
new Callable<ManagedZone>() {
215214
@Override
216-
public com.google.api.services.dns.model.ManagedZone call() {
215+
public ManagedZone call() {
217216
return dnsRpc.create(zoneInfo.toPb(), optionsMap);
218217
}
219218
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -227,10 +226,10 @@ public com.google.api.services.dns.model.ManagedZone call() {
227226
public Zone getZone(final String zoneName, Dns.ZoneOption... options) {
228227
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
229228
try {
230-
com.google.api.services.dns.model.ManagedZone answer = runWithRetries(
231-
new Callable<com.google.api.services.dns.model.ManagedZone>() {
229+
ManagedZone answer = runWithRetries(
230+
new Callable<ManagedZone>() {
232231
@Override
233-
public com.google.api.services.dns.model.ManagedZone call() {
232+
public ManagedZone call() {
234233
return dnsRpc.getZone(zoneName, optionsMap);
235234
}
236235
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -258,10 +257,10 @@ public Boolean call() {
258257
public ProjectInfo getProject(Dns.ProjectOption... fields) {
259258
final Map<DnsRpc.Option, ?> optionsMap = optionMap(fields);
260259
try {
261-
com.google.api.services.dns.model.Project answer = runWithRetries(
262-
new Callable<com.google.api.services.dns.model.Project>() {
260+
Project answer = runWithRetries(
261+
new Callable<Project>() {
263262
@Override
264-
public com.google.api.services.dns.model.Project call() {
263+
public Project call() {
265264
return dnsRpc.getProject(optionsMap);
266265
}
267266
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -276,14 +275,13 @@ public ChangeRequest applyChangeRequest(final String zoneName,
276275
final ChangeRequestInfo changeRequest, ChangeRequestOption... options) {
277276
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
278277
try {
279-
com.google.api.services.dns.model.Change answer =
280-
runWithRetries(
281-
new Callable<com.google.api.services.dns.model.Change>() {
282-
@Override
283-
public com.google.api.services.dns.model.Change call() {
284-
return dnsRpc.applyChangeRequest(zoneName, changeRequest.toPb(), optionsMap);
285-
}
286-
}, options().retryParams(), EXCEPTION_HANDLER);
278+
Change answer = runWithRetries(
279+
new Callable<Change>() {
280+
@Override
281+
public Change call() {
282+
return dnsRpc.applyChangeRequest(zoneName, changeRequest.toPb(), optionsMap);
283+
}
284+
}, options().retryParams(), EXCEPTION_HANDLER);
287285
return answer == null ? null : ChangeRequest.fromPb(this, zoneName, answer); // not null
288286
} catch (RetryHelper.RetryHelperException ex) {
289287
throw DnsException.translateAndThrow(ex);
@@ -295,14 +293,13 @@ public ChangeRequest getChangeRequest(final String zoneName, final String change
295293
Dns.ChangeRequestOption... options) {
296294
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
297295
try {
298-
com.google.api.services.dns.model.Change answer =
299-
runWithRetries(
300-
new Callable<com.google.api.services.dns.model.Change>() {
301-
@Override
302-
public com.google.api.services.dns.model.Change call() {
303-
return dnsRpc.getChangeRequest(zoneName, changeRequestId, optionsMap);
304-
}
305-
}, options().retryParams(), EXCEPTION_HANDLER);
296+
Change answer = runWithRetries(
297+
new Callable<Change>() {
298+
@Override
299+
public Change call() {
300+
return dnsRpc.getChangeRequest(zoneName, changeRequestId, optionsMap);
301+
}
302+
}, options().retryParams(), EXCEPTION_HANDLER);
306303
return answer == null ? null : ChangeRequest.fromPb(this, zoneName, answer);
307304
} catch (RetryHelper.RetryHelperException ex) {
308305
throw DnsException.translateAndThrow(ex);

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull;
2020

21+
import com.google.api.services.dns.model.Project;
2122
import com.google.common.base.MoreObjects;
2223

2324
import java.io.Serializable;
@@ -143,14 +144,13 @@ com.google.api.services.dns.model.Quota toPb() {
143144
}
144145

145146
static Quota fromPb(com.google.api.services.dns.model.Quota pb) {
146-
Quota quota = new Quota(pb.getManagedZones(),
147+
return new Quota(pb.getManagedZones(),
147148
pb.getResourceRecordsPerRrset(),
148149
pb.getRrsetAdditionsPerChange(),
149150
pb.getRrsetDeletionsPerChange(),
150151
pb.getRrsetsPerManagedZone(),
151152
pb.getTotalRrdataSizePerChange()
152153
);
153-
return quota;
154154
}
155155

156156
@Override
@@ -243,8 +243,8 @@ String id() {
243243
return id;
244244
}
245245

246-
com.google.api.services.dns.model.Project toPb() {
247-
com.google.api.services.dns.model.Project pb = new com.google.api.services.dns.model.Project();
246+
Project toPb() {
247+
Project pb = new Project();
248248
pb.setId(id);
249249
pb.setNumber(number);
250250
if (this.quota != null) {
@@ -253,7 +253,7 @@ com.google.api.services.dns.model.Project toPb() {
253253
return pb;
254254
}
255255

256-
static ProjectInfo fromPb(com.google.api.services.dns.model.Project pb) {
256+
static ProjectInfo fromPb(Project pb) {
257257
Builder builder = builder();
258258
if (pb.getId() != null) {
259259
builder.id(pb.getId());

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/RecordSet.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,17 +285,16 @@ public boolean equals(Object obj) {
285285
return obj instanceof RecordSet && Objects.equals(this.toPb(), ((RecordSet) obj).toPb());
286286
}
287287

288-
com.google.api.services.dns.model.ResourceRecordSet toPb() {
289-
com.google.api.services.dns.model.ResourceRecordSet pb =
290-
new com.google.api.services.dns.model.ResourceRecordSet();
288+
ResourceRecordSet toPb() {
289+
ResourceRecordSet pb = new ResourceRecordSet();
291290
pb.setName(this.name());
292291
pb.setRrdatas(this.records());
293292
pb.setTtl(this.ttl());
294293
pb.setType(this.type().name());
295294
return pb;
296295
}
297296

298-
static RecordSet fromPb(com.google.api.services.dns.model.ResourceRecordSet pb) {
297+
static RecordSet fromPb(ResourceRecordSet pb) {
299298
Builder builder = builder(pb.getName(), Type.valueOf(pb.getType()));
300299
if (pb.getRrdatas() != null) {
301300
builder.records(pb.getRrdatas());

branches/tswast-patch-1/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import static com.google.common.base.Preconditions.checkNotNull;
2020

21+
import com.google.api.services.dns.model.ManagedZone;
2122
import com.google.gcloud.Page;
2223

2324
import java.io.IOException;
@@ -205,12 +206,12 @@ public int hashCode() {
205206
return Objects.hash(super.hashCode(), options);
206207
}
207208

208-
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
209-
in.defaultReadObject();
209+
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
210+
stream.defaultReadObject();
210211
this.dns = options.service();
211212
}
212213

213-
static Zone fromPb(Dns dns, com.google.api.services.dns.model.ManagedZone zone) {
214+
static Zone fromPb(Dns dns, ManagedZone zone) {
214215
ZoneInfo info = ZoneInfo.fromPb(zone);
215216
return new Zone(dns, new ZoneInfo.BuilderImpl(info));
216217
}

0 commit comments

Comments
 (0)