diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java
index 130e8bb99f5e..644814fa201b 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java
+++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java
@@ -523,16 +523,6 @@ public static ChangeRequestListOption sortOrder(SortingOrder order) {
*/
ProjectInfo getProjectInfo(ProjectOption... fields);
- /**
- * Returns the current project id.
- */
- String getProjectId();
-
- /**
- * Returns the current project number.
- */
- BigInteger getProjectNumber();
-
/**
* Submits a change request for the specified zone. The returned object contains the following
* read-only fields supplied by the server: id, start time and status. time, id, and list of name
@@ -566,7 +556,7 @@ ChangeRequest applyChangeRequest(String zoneName, ChangeRequest changeRequest,
* @throws DnsException upon failure or if the zone cannot be found
* @see Cloud DNS Chages: get
*/
- ChangeRequest getChangeRequest(String changeRequestId, BigInteger zoneId,
+ ChangeRequest getChangeRequest(BigInteger zoneId, String changeRequestId,
ChangeRequestOption... options);
/**
@@ -578,7 +568,7 @@ ChangeRequest getChangeRequest(String changeRequestId, BigInteger zoneId,
* @throws DnsException upon failure or if the zone cannot be found
* @see Cloud DNS Chages: get
*/
- ChangeRequest getChangeRequest(String changeRequestId, String zoneName,
+ ChangeRequest getChangeRequest(String zoneName, String changeRequestId,
ChangeRequestOption... options);
/**
diff --git a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java
index dc0be8b94b44..86fc86bc3688 100644
--- a/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java
+++ b/gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java
@@ -130,8 +130,7 @@ public boolean delete() {
* Lists all {@link DnsRecord}s associated with this zone. First searches for zone by ID and if
* not found then by name.
*
- * @param options optional restriction on listing and on what fields of {@link DnsRecord} should
- * be returned by the service
+ * @param options optional restriction on listing and fields of {@link DnsRecord}s returned
* @return a page of DNS records
* @throws DnsException upon failure or if the zone is not found
* @throws NullPointerException if both zone ID and name are not initialized
@@ -191,11 +190,11 @@ public ChangeRequest getChangeRequest(String changeRequestId,
checkNotNull(changeRequestId);
ChangeRequest updated = null;
if (zoneInfo.id() != null) {
- updated = dns.getChangeRequest(changeRequestId, zoneInfo.id(), options);
+ updated = dns.getChangeRequest(zoneInfo.id(), changeRequestId, options);
}
if (updated == null && zoneInfo.name() != null) {
// zone was not found by id or id is not set at all
- updated = dns.getChangeRequest(changeRequestId, zoneInfo.name(), options);
+ updated = dns.getChangeRequest(zoneInfo.name(), changeRequestId, options);
}
return updated;
}
@@ -205,8 +204,7 @@ public ChangeRequest getChangeRequest(String changeRequestId,
* then by name. Returns a page of {@link ChangeRequest}s or {@code null} if the zone is not
* found.
*
- * @param options optional restriction on listing and on what fields of {@link ChangeRequest}s
- * should be returned by the service
+ * @param options optional restriction on listing and fields to be returned
* @return a page of change requests
* @throws DnsException upon failure or if the zone is not found
* @throws NullPointerException if both zone ID and name are not initialized
@@ -236,7 +234,7 @@ private void checkNameOrIdNotNull() {
* Returns the {@link ZoneInfo} object containing information about this zone.
*/
public ZoneInfo info() {
- return this.zoneInfo;
+ return zoneInfo;
}
/**
diff --git a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java
index a87bb969855b..c746140ce599 100644
--- a/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java
+++ b/gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java
@@ -101,16 +101,15 @@ public void testGetById() {
Zone retrieved = Zone.get(dns, ZONE_ID);
assertSame(dns, retrieved.dns());
assertEquals(ZONE_INFO, retrieved.info());
- BigInteger id = null;
try {
- Zone.get(dns, id);
- fail("Cannot get null zone.");
+ Zone.get(dns, (BigInteger) null);
+ fail("Cannot get by null id.");
} catch (NullPointerException e) {
// expected
}
try {
- Zone.get(null, id);
- fail("Cannot get null zone.");
+ Zone.get(null, new BigInteger("12"));
+ fail("Cannot get anything from null service.");
} catch (NullPointerException e) {
// expected
}
@@ -126,16 +125,15 @@ public void testGetByName() {
Zone retrieved = Zone.get(dns, ZONE_NAME);
assertSame(dns, retrieved.dns());
assertEquals(ZONE_INFO, retrieved.info());
- String name = null;
try {
- Zone.get(dns, name);
- fail("Cannot get null zone.");
+ Zone.get(dns, (String) null);
+ fail("Cannot get by null name.");
} catch (NullPointerException e) {
// expected
}
try {
- Zone.get(null, name);
- fail("Cannot get null zone.");
+ Zone.get(null, "Not null");
+ fail("Cannot get anything from null service.");
} catch (NullPointerException e) {
// expected
}
@@ -195,6 +193,7 @@ public void deleteByNameAndNotFound() {
@Test
public void listDnsRecordsByIdAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listDnsRecords(ZONE_ID)).andReturn(pageMock);
@@ -210,6 +209,7 @@ public void listDnsRecordsByIdAndFound() {
@Test
public void listDnsRecordsByIdAndNotFoundAndNameSetAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listDnsRecords(ZONE_ID)).andReturn(null);
@@ -251,6 +251,7 @@ public void listDnsRecordsByIdAndNotFoundAndNameNotSet() {
@Test
public void listDnsRecordsByNameAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listDnsRecords(ZONE_NAME)).andReturn(pageMock);
@@ -486,9 +487,9 @@ public void applyNullChangeRequest() {
@Test
public void getChangeByIdAndFound() {
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(CHANGE_REQUEST_AFTER);
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(CHANGE_REQUEST_AFTER);
// again for options
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(CHANGE_REQUEST_AFTER);
replay(dns);
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -503,13 +504,13 @@ public void getChangeByIdAndFound() {
@Test
public void getChangeByIdAndNotFoundAndNameSetAndFound() {
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME))
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id()))
.andReturn(CHANGE_REQUEST_AFTER);
// again for options
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(null);
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(CHANGE_REQUEST_AFTER);
replay(dns);
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -523,12 +524,12 @@ public void getChangeByIdAndNotFoundAndNameSetAndFound() {
@Test
public void getChangeIdAndNotFoundAndNameSetAndNotFound() {
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME)).andReturn(null);
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id())).andReturn(null);
// again with options
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(null);
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(null);
replay(dns);
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -540,8 +541,8 @@ public void getChangeIdAndNotFoundAndNameSetAndNotFound() {
@Test
public void getChangeRequestByIdAndNotFoundAndNameNotSet() {
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
+ expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(null); // for options
replay(dns);
ChangeRequest result = zoneNoName.getChangeRequest(CHANGE_REQUEST.id());
@@ -554,10 +555,10 @@ public void getChangeRequestByIdAndNotFoundAndNameNotSet() {
@Test
public void getChangeByNameAndFound() {
// ID is not set
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME))
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id()))
.andReturn(CHANGE_REQUEST_AFTER);
// again for options
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(CHANGE_REQUEST_AFTER);
replay(dns);
ChangeRequest result = zoneNoId.getChangeRequest(CHANGE_REQUEST.id());
@@ -570,9 +571,9 @@ public void getChangeByNameAndFound() {
@Test
public void getChangeByNameAndNotFound() {
// ID is not set
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME)).andReturn(null);
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id())).andReturn(null);
// again for options
- expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
+ expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
.andReturn(null);
replay(dns);
ChangeRequest result = zoneNoId.getChangeRequest(CHANGE_REQUEST.id());
@@ -666,6 +667,7 @@ public void getChangeRequestWithNoId() {
@Test
public void listChangeRequestsByIdAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listChangeRequests(ZONE_ID)).andReturn(pageMock);
@@ -681,6 +683,7 @@ public void listChangeRequestsByIdAndFound() {
@Test
public void listChangeRequestsByIdAndNotFoundAndNameSetAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listChangeRequests(ZONE_ID)).andReturn(null);
@@ -724,6 +727,7 @@ public void listChangeRequestsByIdAndNotFoundAndNameNotSet() {
@Test
public void listChangeRequestsByNameAndFound() {
+ @SuppressWarnings("unchecked")
Page pageMock = createStrictMock(Page.class);
replay(pageMock);
expect(dns.listChangeRequests(ZONE_NAME)).andReturn(pageMock);