Skip to content

Commit 0310cf5

Browse files
committed
---
yaml --- r: 4763 b: refs/heads/logging-alpha c: 33a81a0 h: refs/heads/master i: 4761: 4e05218 4759: cc651a7
1 parent ee5b04e commit 0310cf5

21 files changed

Lines changed: 99 additions & 96 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: 3e7069a1e4af6f7c7efbc7a71e5ccbb148387863
15+
refs/heads/logging-alpha: 33a81a0433d45e1ca2e203a1be9d93b27b28fc74
1616
refs/tags/v0.1.0: a615317f7424ed58621b1f65d5c4d8cbbe8a6ed8
1717
refs/tags/v0.1.1: 7a7f6985fe465e9dd6a075af55493f42b4933be0
1818
refs/tags/v0.1.2: 3eb3fe866ba22487686048f45d927b8c8638ea3f

branches/logging-alpha/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/logging-alpha/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/logging-alpha/gcloud-java-dns/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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>
67
<artifactId>gcloud-java-dns</artifactId>
78
<packaging>jar</packaging>
89
<name>GCloud Java DNS</name>

branches/logging-alpha/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(Change pb) {
224+
public ChangeRequest apply(com.google.api.services.dns.model.Change pb) {
225225
return ChangeRequest.fromPb(dns, zoneName, pb);
226226
}
227227
};

branches/logging-alpha/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java

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

26+
import java.io.Serializable;
2627
import java.util.List;
2728

2829
/**

branches/logging-alpha/gcloud-java-dns/src/main/java/com/google/gcloud/dns/DnsImpl.java

Lines changed: 32 additions & 29 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;
2021
import static com.google.gcloud.RetryHelper.runWithRetries;
2122

2223
import com.google.api.services.dns.model.Change;
2324
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,7 +121,8 @@ 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(ManagedZone zonePb) {
124+
public Zone apply(
125+
com.google.api.services.dns.model.ManagedZone zonePb) {
125126
return Zone.fromPb(serviceOptions.service(), zonePb);
126127
}
127128
};
@@ -141,7 +142,7 @@ public DnsRpc.ListResult<ManagedZone> call() {
141142
? ImmutableList.<Zone>of() : Iterables.transform(result.results(), pbToZoneFunction);
142143
return new PageImpl<>(new ZonePageFetcher(serviceOptions, cursor, optionsMap),
143144
cursor, zones);
144-
} catch (RetryHelper.RetryHelperException e) {
145+
} catch (RetryHelperException e) {
145146
throw DnsException.translateAndThrow(e);
146147
}
147148
}
@@ -168,10 +169,10 @@ public DnsRpc.ListResult<Change> call() {
168169
Iterable<ChangeRequest> changes = result.results() == null
169170
? ImmutableList.<ChangeRequest>of()
170171
: Iterables.transform(result.results(),
171-
ChangeRequest.fromPbFunction(serviceOptions.service(), zoneName));
172+
ChangeRequest.fromPbFunction(serviceOptions.service(), zoneName));
172173
return new PageImpl<>(new ChangeRequestPageFetcher(zoneName, serviceOptions, cursor,
173174
optionsMap), cursor, changes);
174-
} catch (RetryHelper.RetryHelperException e) {
175+
} catch (RetryHelperException e) {
175176
throw DnsException.translateAndThrow(e);
176177
}
177178
}
@@ -200,7 +201,7 @@ public DnsRpc.ListResult<ResourceRecordSet> call() {
200201
: Iterables.transform(result.results(), RecordSet.FROM_PB_FUNCTION);
201202
return new PageImpl<>(new DnsRecordPageFetcher(zoneName, serviceOptions, cursor, optionsMap),
202203
cursor, recordSets);
203-
} catch (RetryHelper.RetryHelperException e) {
204+
} catch (RetryHelperException e) {
204205
throw DnsException.translateAndThrow(e);
205206
}
206207
}
@@ -209,10 +210,10 @@ public DnsRpc.ListResult<ResourceRecordSet> call() {
209210
public Zone create(final ZoneInfo zoneInfo, Dns.ZoneOption... options) {
210211
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
211212
try {
212-
ManagedZone answer = runWithRetries(
213-
new Callable<ManagedZone>() {
213+
com.google.api.services.dns.model.ManagedZone answer = runWithRetries(
214+
new Callable<com.google.api.services.dns.model.ManagedZone>() {
214215
@Override
215-
public ManagedZone call() {
216+
public com.google.api.services.dns.model.ManagedZone call() {
216217
return dnsRpc.create(zoneInfo.toPb(), optionsMap);
217218
}
218219
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -226,10 +227,10 @@ public ManagedZone call() {
226227
public Zone getZone(final String zoneName, Dns.ZoneOption... options) {
227228
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
228229
try {
229-
ManagedZone answer = runWithRetries(
230-
new Callable<ManagedZone>() {
230+
com.google.api.services.dns.model.ManagedZone answer = runWithRetries(
231+
new Callable<com.google.api.services.dns.model.ManagedZone>() {
231232
@Override
232-
public ManagedZone call() {
233+
public com.google.api.services.dns.model.ManagedZone call() {
233234
return dnsRpc.getZone(zoneName, optionsMap);
234235
}
235236
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -257,10 +258,10 @@ public Boolean call() {
257258
public ProjectInfo getProject(Dns.ProjectOption... fields) {
258259
final Map<DnsRpc.Option, ?> optionsMap = optionMap(fields);
259260
try {
260-
Project answer = runWithRetries(
261-
new Callable<Project>() {
261+
com.google.api.services.dns.model.Project answer = runWithRetries(
262+
new Callable<com.google.api.services.dns.model.Project>() {
262263
@Override
263-
public Project call() {
264+
public com.google.api.services.dns.model.Project call() {
264265
return dnsRpc.getProject(optionsMap);
265266
}
266267
}, options().retryParams(), EXCEPTION_HANDLER);
@@ -275,13 +276,14 @@ public ChangeRequest applyChangeRequest(final String zoneName,
275276
final ChangeRequestInfo changeRequest, ChangeRequestOption... options) {
276277
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
277278
try {
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);
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);
285287
return answer == null ? null : ChangeRequest.fromPb(this, zoneName, answer); // not null
286288
} catch (RetryHelper.RetryHelperException ex) {
287289
throw DnsException.translateAndThrow(ex);
@@ -293,13 +295,14 @@ public ChangeRequest getChangeRequest(final String zoneName, final String change
293295
Dns.ChangeRequestOption... options) {
294296
final Map<DnsRpc.Option, ?> optionsMap = optionMap(options);
295297
try {
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);
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);
303306
return answer == null ? null : ChangeRequest.fromPb(this, zoneName, answer);
304307
} catch (RetryHelper.RetryHelperException ex) {
305308
throw DnsException.translateAndThrow(ex);

branches/logging-alpha/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,7 +18,6 @@
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;
2221
import com.google.common.base.MoreObjects;
2322

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

146145
static Quota fromPb(com.google.api.services.dns.model.Quota pb) {
147-
return new Quota(pb.getManagedZones(),
146+
Quota quota = new Quota(pb.getManagedZones(),
148147
pb.getResourceRecordsPerRrset(),
149148
pb.getRrsetAdditionsPerChange(),
150149
pb.getRrsetDeletionsPerChange(),
151150
pb.getRrsetsPerManagedZone(),
152151
pb.getTotalRrdataSizePerChange()
153152
);
153+
return quota;
154154
}
155155

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

246-
Project toPb() {
247-
Project pb = new Project();
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();
248248
pb.setId(id);
249249
pb.setNumber(number);
250250
if (this.quota != null) {
@@ -253,7 +253,7 @@ Project toPb() {
253253
return pb;
254254
}
255255

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

branches/logging-alpha/gcloud-java-dns/src/main/java/com/google/gcloud/dns/RecordSet.java

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

288-
ResourceRecordSet toPb() {
289-
ResourceRecordSet pb = new ResourceRecordSet();
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();
290291
pb.setName(this.name());
291292
pb.setRrdatas(this.records());
292293
pb.setTtl(this.ttl());
293294
pb.setType(this.type().name());
294295
return pb;
295296
}
296297

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

branches/logging-alpha/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java

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

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

21-
import com.google.api.services.dns.model.ManagedZone;
2221
import com.google.gcloud.Page;
2322

2423
import java.io.IOException;
@@ -206,12 +205,12 @@ public int hashCode() {
206205
return Objects.hash(super.hashCode(), options);
207206
}
208207

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

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

0 commit comments

Comments
 (0)