From 9b4ff48b64c2192a42d914a672d9004e59a4b822 Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Mon, 25 Jan 2016 16:23:48 -0800 Subject: [PATCH 1/4] Added ProjectInfo. --- .../com/google/gcloud/dns/ProjectInfo.java | 284 ++++++++++++++++++ .../google/gcloud/dns/ProjectInfoTest.java | 118 ++++++++ 2 files changed, 402 insertions(+) create mode 100644 gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java create mode 100644 gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java new file mode 100644 index 000000000000..614b9033a18e --- /dev/null +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java @@ -0,0 +1,284 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.gcloud.dns; + +import static com.google.api.client.repackaged.com.google.common.base.Preconditions.checkNotNull; + +import com.google.common.base.MoreObjects; + +import java.io.Serializable; +import java.math.BigInteger; +import java.util.Objects; + +/** + * The class that encapsulates information about a project in Google Cloud DNS. A project is a top + * level container for resources including {@link ManagedZone}s. Projects can be created only in the + * APIs console. + * + * @see Google Cloud DNS documentation + */ +public class ProjectInfo implements Serializable { + + private static final long serialVersionUID = 201601251420L; + private final String id; + private final BigInteger number; + private final Quota quota; + + /** + * This class represents quotas assigned to the {@code ProjectInfo}. + * + * @see Google Cloud DNS documentation + */ + public static class Quota { + + private Integer zones; + private Integer resourceRecordsPerRrset; + private Integer rrsetAdditionsPerChange; + private Integer rrsetDeletionsPerChange; + private Integer rrsetsPerManagedZone; + private Integer totalRrdataSizePerChange; + + /** + * Creates an instance of {@code Quota}. + * + * This is the only way of creating an instance of {@code Quota}. As the service does not allow + * for specifying options, quota is an "all-or-nothing object" and we do not need a builder. + */ + Quota(Integer zones, + Integer resourceRecordsPerRrset, + Integer rrsetAdditionsPerChange, + Integer rrsetDeletionsPerChange, + Integer rrsetsPerManagedZone, + Integer totalRrdataSizePerChange) { + this.zones = checkNotNull(zones); + this.resourceRecordsPerRrset = checkNotNull(resourceRecordsPerRrset); + this.rrsetAdditionsPerChange = checkNotNull(rrsetAdditionsPerChange); + this.rrsetDeletionsPerChange = checkNotNull(rrsetDeletionsPerChange); + this.rrsetsPerManagedZone = checkNotNull(rrsetsPerManagedZone); + this.totalRrdataSizePerChange = checkNotNull(totalRrdataSizePerChange); + } + + /** + * Returns the maximum allowed number of managed zones in the project. + */ + public Integer zones() { + return zones; + } + + /** + * Returns the maximum allowed number of records per {@link DnsRecord}. + */ + public Integer resourceRecordsPerRrset() { + return resourceRecordsPerRrset; + } + + /** + * Returns the maximum allowed number of {@link DnsRecord}s to add per {@code ChangesRequest}. + */ + public Integer rrsetAdditionsPerChange() { + return rrsetAdditionsPerChange; + } + + /** + * Returns the maximum allowed number of {@link DnsRecord}s to delete per {@code + * ChangesRequest}. + */ + public Integer rrsetDeletionsPerChange() { + return rrsetDeletionsPerChange; + } + + /** + * Returns the maximum allowed number of {@link DnsRecord}s per {@link ManagedZone} in the + * project. + */ + public Integer rrsetsPerManagedZone() { + return rrsetsPerManagedZone; + } + + /** + * Returns the maximum allowed size for total records in one ChangesRequest in bytes. + */ + public Integer totalRrdataSizePerChange() { + return totalRrdataSizePerChange; + } + + @Override + public boolean equals(Object o) { + return (o instanceof Quota) && this.toPb().equals(((Quota) o).toPb()); + } + + @Override + public int hashCode() { + return Objects.hash(zones, resourceRecordsPerRrset, rrsetAdditionsPerChange, + rrsetDeletionsPerChange, rrsetsPerManagedZone, totalRrdataSizePerChange); + } + + com.google.api.services.dns.model.Quota toPb() { + com.google.api.services.dns.model.Quota pb = new com.google.api.services.dns.model.Quota(); + pb.setManagedZones(zones); + pb.setResourceRecordsPerRrset(resourceRecordsPerRrset); + pb.setRrsetAdditionsPerChange(rrsetAdditionsPerChange); + pb.setRrsetDeletionsPerChange(rrsetDeletionsPerChange); + pb.setRrsetsPerManagedZone(rrsetsPerManagedZone); + pb.setTotalRrdataSizePerChange(totalRrdataSizePerChange); + return pb; + } + + static Quota fromPb(com.google.api.services.dns.model.Quota pb) { + Quota q = new Quota(pb.getManagedZones(), + pb.getResourceRecordsPerRrset(), + pb.getRrsetAdditionsPerChange(), + pb.getRrsetDeletionsPerChange(), + pb.getRrsetsPerManagedZone(), + pb.getTotalRrdataSizePerChange() + ); + return q; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("zones", zones) + .add("resourceRecordsPerRrset", resourceRecordsPerRrset) + .add("rrsetAdditionsPerChange", rrsetAdditionsPerChange) + .add("rrsetDeletionsPerChange", rrsetDeletionsPerChange) + .add("rrsetsPerManagedZone", rrsetsPerManagedZone) + .add("totalRrdataSizePerChange", totalRrdataSizePerChange) + .toString(); + } + } + + /** + * A builder for {@code ProjectInfo}. + */ + static class Builder { + private String id; + private BigInteger number; + private Quota quota; + + private Builder() { + } + + /** + * Sets an id of the project. + */ + Builder id(String id) { + this.id = checkNotNull(id); + return this; + } + + /** + * Sets a number of the project. + */ + Builder number(BigInteger number) { + this.number = checkNotNull(number); + return this; + } + + /** + * Sets quotas assigned to the project. + */ + Builder quota(Quota quota) { + this.quota = checkNotNull(quota); + return this; + } + + /** + * Builds an instance of the {@code ProjectInfo}. + */ + ProjectInfo build() { + return new ProjectInfo(this); + } + } + + private ProjectInfo(Builder b) { + this.id = b.id; + this.number = b.number; + this.quota = b.quota; + } + + /** + * Returns a builder for {@code ProjectInfo}. + */ + static Builder builder() { + return new Builder(); + } + + /** + * Returns the user-assigned unique identifier for the project. + */ + public String id() { + return id; + } + + /** + * Returns the unique numeric identifier for the project. + */ + public BigInteger number() { + return number; + } + + /** + * Returns the {@code Quota} object which contains quotas assigned to this project. + */ + public Quota quota() { + return quota; + } + + com.google.api.services.dns.model.Project toPb() { + com.google.api.services.dns.model.Project pb = new com.google.api.services.dns.model.Project(); + pb.setId(id()); + pb.setNumber(number()); + if (this.quota() != null) { + pb.setQuota(quota().toPb()); + } + return pb; + } + + static ProjectInfo fromPb(com.google.api.services.dns.model.Project pb) { + Builder b = builder(); + if (pb.getId() != null) { + b.id(pb.getId()); + } + if (pb.getNumber() != null) { + b.number(pb.getNumber()); + } + if (pb.getQuota() != null) { + b.quota(Quota.fromPb(pb.getQuota())); + } + return b.build(); + } + + @Override + public boolean equals(Object o) { + return (o instanceof ProjectInfo) && this.toPb().equals(((ProjectInfo) o).toPb()); + } + + @Override + public int hashCode() { + return Objects.hash(id, number, quota); + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("id", id) + .add("number", number) + .add("quota", quota) + .toString(); + } +} diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java new file mode 100644 index 000000000000..2c5e1ffa7100 --- /dev/null +++ b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java @@ -0,0 +1,118 @@ +/* + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.gcloud.dns; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Test; + +import java.math.BigInteger; + +public class ProjectInfoTest { + + private static final String ID = "project-id-123"; + private static final BigInteger NUMBER = new BigInteger("123"); + private static final ProjectInfo.Quota QUOTA = new ProjectInfo.Quota(1, 2, 3, 4, 5, 6); + private static final ProjectInfo PROJECT_INFO = ProjectInfo.builder() + .id(ID).number(NUMBER).quota(QUOTA).build(); + + @Test + public void testBuilder() { + ProjectInfo withId = ProjectInfo.builder().id(ID).build(); + assertEquals(ID, withId.id()); + assertNull(withId.number()); + assertNull(withId.quota()); + ProjectInfo withNumber = ProjectInfo.builder().number(NUMBER).build(); + assertEquals(NUMBER, withNumber.number()); + assertNull(withNumber.quota()); + assertNull(withNumber.id()); + ProjectInfo withQuota = ProjectInfo.builder().quota(QUOTA).build(); + assertEquals(QUOTA, withQuota.quota()); + assertNull(withQuota.id()); + assertNull(withQuota.number()); + assertEquals(QUOTA, PROJECT_INFO.quota()); + assertEquals(NUMBER, PROJECT_INFO.number()); + assertEquals(ID, PROJECT_INFO.id()); + } + + @Test + public void testQuotaConstructor() { + assertEquals(Integer.valueOf(1), QUOTA.zones()); + assertEquals(Integer.valueOf(2), QUOTA.resourceRecordsPerRrset()); + assertEquals(Integer.valueOf(3), QUOTA.rrsetAdditionsPerChange()); + assertEquals(Integer.valueOf(4), QUOTA.rrsetDeletionsPerChange()); + assertEquals(Integer.valueOf(5), QUOTA.rrsetsPerManagedZone()); + assertEquals(Integer.valueOf(6), QUOTA.totalRrdataSizePerChange()); + } + + @Test + public void testEqualsAndNotEqualsQuota() { + ProjectInfo.Quota clone = new ProjectInfo.Quota(6, 5, 4, 3, 2, 1); + assertNotEquals(QUOTA, clone); + clone = ProjectInfo.Quota.fromPb(QUOTA.toPb()); + assertEquals(QUOTA, clone); + } + + @Test + public void testSameHashCodeOnEqualsQuota() { + ProjectInfo.Quota clone = ProjectInfo.Quota.fromPb(QUOTA.toPb()); + assertEquals(QUOTA, clone); + assertEquals(QUOTA.hashCode(), clone.hashCode()); + } + + @Test + public void testEqualsAndNotEquals() { + ProjectInfo clone = ProjectInfo.builder().build(); + assertNotEquals(PROJECT_INFO, clone); + clone = ProjectInfo.builder().id(PROJECT_INFO.id()).number(PROJECT_INFO.number()).build(); + assertNotEquals(PROJECT_INFO, clone); + clone = ProjectInfo.builder().id(PROJECT_INFO.id()).quota(PROJECT_INFO.quota()).build(); + assertNotEquals(PROJECT_INFO, clone); + clone = ProjectInfo.builder().number(PROJECT_INFO.number()).quota(PROJECT_INFO.quota()).build(); + assertNotEquals(PROJECT_INFO, clone); + clone = ProjectInfo.fromPb(PROJECT_INFO.toPb()); + assertEquals(PROJECT_INFO, clone); + } + + @Test + public void testSameHashCodeOnEquals() { + ProjectInfo clone = ProjectInfo.fromPb(PROJECT_INFO.toPb()); + assertEquals(PROJECT_INFO, clone); + assertEquals(PROJECT_INFO.hashCode(), clone.hashCode()); + } + + @Test + public void testToAndFromPb() { + assertEquals(PROJECT_INFO, ProjectInfo.fromPb(PROJECT_INFO.toPb())); + ProjectInfo partial = ProjectInfo.builder().id(ID).build(); + assertEquals(partial, PROJECT_INFO.fromPb(partial.toPb())); + partial = ProjectInfo.builder().number(NUMBER).build(); + assertEquals(partial, PROJECT_INFO.fromPb(partial.toPb())); + partial = ProjectInfo.builder().quota(QUOTA).build(); + assertEquals(partial, PROJECT_INFO.fromPb(partial.toPb())); + assertNotEquals(PROJECT_INFO, partial); + } + + @Test + public void testToAndFromPbQuota() { + assertEquals(QUOTA, ProjectInfo.Quota.fromPb(QUOTA.toPb())); + ProjectInfo.Quota wrong = new ProjectInfo.Quota(5, 6, 3, 6, 2, 1); + assertNotEquals(QUOTA, ProjectInfo.Quota.fromPb(wrong.toPb())); + } +} From a47158db527eeb220534189ee24c7837f75bddda Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 27 Jan 2016 12:35:32 -0800 Subject: [PATCH 2/4] Fixed serialization, javadoc and checkstyle. --- .../com/google/gcloud/dns/ProjectInfo.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java index 614b9033a18e..dc9c2e6ef55e 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java @@ -26,14 +26,14 @@ /** * The class that encapsulates information about a project in Google Cloud DNS. A project is a top - * level container for resources including {@link ManagedZone}s. Projects can be created only in the + * level container for resources including {@code ManagedZone}s. Projects can be created only in the * APIs console. * * @see Google Cloud DNS documentation */ public class ProjectInfo implements Serializable { - private static final long serialVersionUID = 201601251420L; + private static final long serialVersionUID = 8696578863323485036L; private final String id; private final BigInteger number; private final Quota quota; @@ -55,8 +55,9 @@ public static class Quota { /** * Creates an instance of {@code Quota}. * - * This is the only way of creating an instance of {@code Quota}. As the service does not allow - * for specifying options, quota is an "all-or-nothing object" and we do not need a builder. + *

This is the only way of creating an instance of {@code Quota}. As the service does not + * allow for specifying options, quota is an "all-or-nothing object" and we do not need a + * builder. */ Quota(Integer zones, Integer resourceRecordsPerRrset, @@ -102,7 +103,7 @@ public Integer rrsetDeletionsPerChange() { } /** - * Returns the maximum allowed number of {@link DnsRecord}s per {@link ManagedZone} in the + * Returns the maximum allowed number of {@link DnsRecord}s per {@code ManagedZone} in the * project. */ public Integer rrsetsPerManagedZone() { @@ -117,8 +118,8 @@ public Integer totalRrdataSizePerChange() { } @Override - public boolean equals(Object o) { - return (o instanceof Quota) && this.toPb().equals(((Quota) o).toPb()); + public boolean equals(Object other) { + return (other instanceof Quota) && this.toPb().equals(((Quota) other).toPb()); } @Override @@ -139,14 +140,14 @@ com.google.api.services.dns.model.Quota toPb() { } static Quota fromPb(com.google.api.services.dns.model.Quota pb) { - Quota q = new Quota(pb.getManagedZones(), + Quota quota = new Quota(pb.getManagedZones(), pb.getResourceRecordsPerRrset(), pb.getRrsetAdditionsPerChange(), pb.getRrsetDeletionsPerChange(), pb.getRrsetsPerManagedZone(), pb.getTotalRrdataSizePerChange() ); - return q; + return quota; } @Override @@ -205,10 +206,10 @@ ProjectInfo build() { } } - private ProjectInfo(Builder b) { - this.id = b.id; - this.number = b.number; - this.quota = b.quota; + private ProjectInfo(Builder builder) { + this.id = builder.id; + this.number = builder.number; + this.quota = builder.quota; } /** @@ -250,22 +251,22 @@ com.google.api.services.dns.model.Project toPb() { } static ProjectInfo fromPb(com.google.api.services.dns.model.Project pb) { - Builder b = builder(); + Builder builder = builder(); if (pb.getId() != null) { - b.id(pb.getId()); + builder.id(pb.getId()); } if (pb.getNumber() != null) { - b.number(pb.getNumber()); + builder.number(pb.getNumber()); } if (pb.getQuota() != null) { - b.quota(Quota.fromPb(pb.getQuota())); + builder.quota(Quota.fromPb(pb.getQuota())); } - return b.build(); + return builder.build(); } @Override - public boolean equals(Object o) { - return (o instanceof ProjectInfo) && this.toPb().equals(((ProjectInfo) o).toPb()); + public boolean equals(Object other) { + return (other instanceof ProjectInfo) && this.toPb().equals(((ProjectInfo) other).toPb()); } @Override From 9db27d44a072233955a57670c4c77a8a1f72afca Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 27 Jan 2016 16:00:44 -0800 Subject: [PATCH 3/4] Implements comment from @aozarov and @ajkannan into ProjectInfo. --- .../com/google/gcloud/dns/ProjectInfo.java | 83 ++++++++++--------- .../google/gcloud/dns/ProjectInfoTest.java | 12 +-- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java index dc9c2e6ef55e..f8b2e33a1e9f 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java @@ -25,9 +25,9 @@ import java.util.Objects; /** - * The class that encapsulates information about a project in Google Cloud DNS. A project is a top - * level container for resources including {@code ManagedZone}s. Projects can be created only in the - * APIs console. + * The class provides the Google Cloud DNS information associated with this project. A project is a + * top level container for resources including {@code ManagedZone}s. Projects can be created only in + * the APIs console. * * @see Google Cloud DNS documentation */ @@ -41,16 +41,17 @@ public class ProjectInfo implements Serializable { /** * This class represents quotas assigned to the {@code ProjectInfo}. * - * @see Google Cloud DNS documentation + * @see Google Cloud DNS + * documentation */ public static class Quota { - private Integer zones; - private Integer resourceRecordsPerRrset; - private Integer rrsetAdditionsPerChange; - private Integer rrsetDeletionsPerChange; - private Integer rrsetsPerManagedZone; - private Integer totalRrdataSizePerChange; + private final int zones; + private final int resourceRecordsPerRrset; + private final int rrsetAdditionsPerChange; + private final int rrsetDeletionsPerChange; + private final int rrsetsPerManagedZone; + private final int totalRrdataSizePerChange; /** * Creates an instance of {@code Quota}. @@ -59,38 +60,38 @@ public static class Quota { * allow for specifying options, quota is an "all-or-nothing object" and we do not need a * builder. */ - Quota(Integer zones, - Integer resourceRecordsPerRrset, - Integer rrsetAdditionsPerChange, - Integer rrsetDeletionsPerChange, - Integer rrsetsPerManagedZone, - Integer totalRrdataSizePerChange) { - this.zones = checkNotNull(zones); - this.resourceRecordsPerRrset = checkNotNull(resourceRecordsPerRrset); - this.rrsetAdditionsPerChange = checkNotNull(rrsetAdditionsPerChange); - this.rrsetDeletionsPerChange = checkNotNull(rrsetDeletionsPerChange); - this.rrsetsPerManagedZone = checkNotNull(rrsetsPerManagedZone); - this.totalRrdataSizePerChange = checkNotNull(totalRrdataSizePerChange); + Quota(int zones, + int resourceRecordsPerRrset, + int rrsetAdditionsPerChange, + int rrsetDeletionsPerChange, + int rrsetsPerManagedZone, + int totalRrdataSizePerChange) { + this.zones = zones; + this.resourceRecordsPerRrset = resourceRecordsPerRrset; + this.rrsetAdditionsPerChange = rrsetAdditionsPerChange; + this.rrsetDeletionsPerChange = rrsetDeletionsPerChange; + this.rrsetsPerManagedZone = rrsetsPerManagedZone; + this.totalRrdataSizePerChange = totalRrdataSizePerChange; } /** * Returns the maximum allowed number of managed zones in the project. */ - public Integer zones() { + public int zones() { return zones; } /** * Returns the maximum allowed number of records per {@link DnsRecord}. */ - public Integer resourceRecordsPerRrset() { + public int resourceRecordsPerRrset() { return resourceRecordsPerRrset; } /** * Returns the maximum allowed number of {@link DnsRecord}s to add per {@code ChangesRequest}. */ - public Integer rrsetAdditionsPerChange() { + public int rrsetAdditionsPerChange() { return rrsetAdditionsPerChange; } @@ -98,7 +99,7 @@ public Integer rrsetAdditionsPerChange() { * Returns the maximum allowed number of {@link DnsRecord}s to delete per {@code * ChangesRequest}. */ - public Integer rrsetDeletionsPerChange() { + public int rrsetDeletionsPerChange() { return rrsetDeletionsPerChange; } @@ -106,14 +107,14 @@ public Integer rrsetDeletionsPerChange() { * Returns the maximum allowed number of {@link DnsRecord}s per {@code ManagedZone} in the * project. */ - public Integer rrsetsPerManagedZone() { + public int rrsetsPerManagedZone() { return rrsetsPerManagedZone; } /** * Returns the maximum allowed size for total records in one ChangesRequest in bytes. */ - public Integer totalRrdataSizePerChange() { + public int totalRrdataSizePerChange() { return totalRrdataSizePerChange; } @@ -220,32 +221,32 @@ static Builder builder() { } /** - * Returns the user-assigned unique identifier for the project. + * Returns the {@code Quota} object which contains quotas assigned to this project. */ - public String id() { - return id; + public Quota quota() { + return quota; } /** - * Returns the unique numeric identifier for the project. + * Returns project number. For internal use only. */ - public BigInteger number() { + BigInteger number() { return number; } /** - * Returns the {@code Quota} object which contains quotas assigned to this project. + * Returns project id. For internal use only. */ - public Quota quota() { - return quota; + String id() { + return id; } com.google.api.services.dns.model.Project toPb() { com.google.api.services.dns.model.Project pb = new com.google.api.services.dns.model.Project(); - pb.setId(id()); - pb.setNumber(number()); - if (this.quota() != null) { - pb.setQuota(quota().toPb()); + pb.setId(id); + pb.setNumber(number); + if (this.quota != null) { + pb.setQuota(quota.toPb()); } return pb; } @@ -266,7 +267,7 @@ static ProjectInfo fromPb(com.google.api.services.dns.model.Project pb) { @Override public boolean equals(Object other) { - return (other instanceof ProjectInfo) && this.toPb().equals(((ProjectInfo) other).toPb()); + return (other instanceof ProjectInfo) && toPb().equals(((ProjectInfo) other).toPb()); } @Override diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java index 2c5e1ffa7100..2af8b5ad3995 100644 --- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java +++ b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ProjectInfoTest.java @@ -53,12 +53,12 @@ public void testBuilder() { @Test public void testQuotaConstructor() { - assertEquals(Integer.valueOf(1), QUOTA.zones()); - assertEquals(Integer.valueOf(2), QUOTA.resourceRecordsPerRrset()); - assertEquals(Integer.valueOf(3), QUOTA.rrsetAdditionsPerChange()); - assertEquals(Integer.valueOf(4), QUOTA.rrsetDeletionsPerChange()); - assertEquals(Integer.valueOf(5), QUOTA.rrsetsPerManagedZone()); - assertEquals(Integer.valueOf(6), QUOTA.totalRrdataSizePerChange()); + assertEquals(1, QUOTA.zones()); + assertEquals(2, QUOTA.resourceRecordsPerRrset()); + assertEquals(3, QUOTA.rrsetAdditionsPerChange()); + assertEquals(4, QUOTA.rrsetDeletionsPerChange()); + assertEquals(5, QUOTA.rrsetsPerManagedZone()); + assertEquals(6, QUOTA.totalRrdataSizePerChange()); } @Test From 4412c7304cda6bd5d3846161b6451740972bc929 Mon Sep 17 00:00:00 2001 From: Martin Derka Date: Wed, 27 Jan 2016 16:13:37 -0800 Subject: [PATCH 4/4] Changed documentation @code to @link where applicable. --- .../src/main/java/com/google/gcloud/dns/ProjectInfo.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java index f8b2e33a1e9f..e65524913920 100644 --- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java +++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/ProjectInfo.java @@ -89,22 +89,22 @@ public int resourceRecordsPerRrset() { } /** - * Returns the maximum allowed number of {@link DnsRecord}s to add per {@code ChangesRequest}. + * Returns the maximum allowed number of {@link DnsRecord}s to add per {@link ChangeRequest}. */ public int rrsetAdditionsPerChange() { return rrsetAdditionsPerChange; } /** - * Returns the maximum allowed number of {@link DnsRecord}s to delete per {@code - * ChangesRequest}. + * Returns the maximum allowed number of {@link DnsRecord}s to delete per {@link + * ChangeRequest}. */ public int rrsetDeletionsPerChange() { return rrsetDeletionsPerChange; } /** - * Returns the maximum allowed number of {@link DnsRecord}s per {@code ManagedZone} in the + * Returns the maximum allowed number of {@link DnsRecord}s per {@link ManagedZoneInfo} in the * project. */ public int rrsetsPerManagedZone() {