Skip to content

Commit 49c0086

Browse files
committed
Adjusted documentation, removed getProjectId and getProjectNumber
1 parent e083dfd commit 49c0086

3 files changed

Lines changed: 36 additions & 44 deletions

File tree

gcloud-java-dns/src/main/java/com/google/gcloud/dns/Dns.java

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -523,16 +523,6 @@ public static ChangeRequestListOption sortOrder(SortingOrder order) {
523523
*/
524524
ProjectInfo getProjectInfo(ProjectOption... fields);
525525

526-
/**
527-
* Returns the current project id.
528-
*/
529-
String getProjectId();
530-
531-
/**
532-
* Returns the current project number.
533-
*/
534-
BigInteger getProjectNumber();
535-
536526
/**
537527
* Submits a change request for the specified zone. The returned object contains the following
538528
* 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,
566556
* @throws DnsException upon failure or if the zone cannot be found
567557
* @see <a href="https://cloud.google.com/dns/api/v1/changes/get">Cloud DNS Chages: get</a>
568558
*/
569-
ChangeRequest getChangeRequest(String changeRequestId, BigInteger zoneId,
559+
ChangeRequest getChangeRequest(BigInteger zoneId, String changeRequestId,
570560
ChangeRequestOption... options);
571561

572562
/**
@@ -578,7 +568,7 @@ ChangeRequest getChangeRequest(String changeRequestId, BigInteger zoneId,
578568
* @throws DnsException upon failure or if the zone cannot be found
579569
* @see <a href="https://cloud.google.com/dns/api/v1/changes/get">Cloud DNS Chages: get</a>
580570
*/
581-
ChangeRequest getChangeRequest(String changeRequestId, String zoneName,
571+
ChangeRequest getChangeRequest(String zoneName, String changeRequestId,
582572
ChangeRequestOption... options);
583573

584574
/**

gcloud-java-dns/src/main/java/com/google/gcloud/dns/Zone.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ public boolean delete() {
130130
* Lists all {@link DnsRecord}s associated with this zone. First searches for zone by ID and if
131131
* not found then by name.
132132
*
133-
* @param options optional restriction on listing and on what fields of {@link DnsRecord} should
134-
* be returned by the service
133+
* @param options optional restriction on listing and fields of {@link DnsRecord}s returned
135134
* @return a page of DNS records
136135
* @throws DnsException upon failure or if the zone is not found
137136
* @throws NullPointerException if both zone ID and name are not initialized
@@ -191,11 +190,11 @@ public ChangeRequest getChangeRequest(String changeRequestId,
191190
checkNotNull(changeRequestId);
192191
ChangeRequest updated = null;
193192
if (zoneInfo.id() != null) {
194-
updated = dns.getChangeRequest(changeRequestId, zoneInfo.id(), options);
193+
updated = dns.getChangeRequest(zoneInfo.id(), changeRequestId, options);
195194
}
196195
if (updated == null && zoneInfo.name() != null) {
197196
// zone was not found by id or id is not set at all
198-
updated = dns.getChangeRequest(changeRequestId, zoneInfo.name(), options);
197+
updated = dns.getChangeRequest(zoneInfo.name(), changeRequestId, options);
199198
}
200199
return updated;
201200
}
@@ -205,8 +204,7 @@ public ChangeRequest getChangeRequest(String changeRequestId,
205204
* then by name. Returns a page of {@link ChangeRequest}s or {@code null} if the zone is not
206205
* found.
207206
*
208-
* @param options optional restriction on listing and on what fields of {@link ChangeRequest}s
209-
* should be returned by the service
207+
* @param options optional restriction on listing and fields to be returned
210208
* @return a page of change requests
211209
* @throws DnsException upon failure or if the zone is not found
212210
* @throws NullPointerException if both zone ID and name are not initialized

gcloud-java-dns/src/test/java/com/google/gcloud/dns/ZoneTest.java

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ public void testGetById() {
101101
Zone retrieved = Zone.get(dns, ZONE_ID);
102102
assertSame(dns, retrieved.dns());
103103
assertEquals(ZONE_INFO, retrieved.info());
104-
BigInteger id = null;
105104
try {
106-
Zone.get(dns, id);
107-
fail("Cannot get null zone.");
105+
Zone.get(dns, (BigInteger) null);
106+
fail("Cannot get by null id.");
108107
} catch (NullPointerException e) {
109108
// expected
110109
}
111110
try {
112-
Zone.get(null, id);
113-
fail("Cannot get null zone.");
111+
Zone.get(null, (BigInteger) null);
112+
fail("Cannot get by null id.");
114113
} catch (NullPointerException e) {
115114
// expected
116115
}
@@ -126,16 +125,15 @@ public void testGetByName() {
126125
Zone retrieved = Zone.get(dns, ZONE_NAME);
127126
assertSame(dns, retrieved.dns());
128127
assertEquals(ZONE_INFO, retrieved.info());
129-
String name = null;
130128
try {
131-
Zone.get(dns, name);
132-
fail("Cannot get null zone.");
129+
Zone.get(dns, (String) null);
130+
fail("Cannot get by null name.");
133131
} catch (NullPointerException e) {
134132
// expected
135133
}
136134
try {
137-
Zone.get(null, name);
138-
fail("Cannot get null zone.");
135+
Zone.get(null, (String) null);
136+
fail("Cannot get by null name.");
139137
} catch (NullPointerException e) {
140138
// expected
141139
}
@@ -195,6 +193,7 @@ public void deleteByNameAndNotFound() {
195193

196194
@Test
197195
public void listDnsRecordsByIdAndFound() {
196+
@SuppressWarnings("unchecked")
198197
Page<DnsRecord> pageMock = createStrictMock(Page.class);
199198
replay(pageMock);
200199
expect(dns.listDnsRecords(ZONE_ID)).andReturn(pageMock);
@@ -210,6 +209,7 @@ public void listDnsRecordsByIdAndFound() {
210209

211210
@Test
212211
public void listDnsRecordsByIdAndNotFoundAndNameSetAndFound() {
212+
@SuppressWarnings("unchecked")
213213
Page<DnsRecord> pageMock = createStrictMock(Page.class);
214214
replay(pageMock);
215215
expect(dns.listDnsRecords(ZONE_ID)).andReturn(null);
@@ -251,6 +251,7 @@ public void listDnsRecordsByIdAndNotFoundAndNameNotSet() {
251251

252252
@Test
253253
public void listDnsRecordsByNameAndFound() {
254+
@SuppressWarnings("unchecked")
254255
Page<DnsRecord> pageMock = createStrictMock(Page.class);
255256
replay(pageMock);
256257
expect(dns.listDnsRecords(ZONE_NAME)).andReturn(pageMock);
@@ -486,9 +487,9 @@ public void applyNullChangeRequest() {
486487

487488
@Test
488489
public void getChangeByIdAndFound() {
489-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(CHANGE_REQUEST_AFTER);
490+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(CHANGE_REQUEST_AFTER);
490491
// again for options
491-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
492+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
492493
.andReturn(CHANGE_REQUEST_AFTER);
493494
replay(dns);
494495
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -503,13 +504,13 @@ public void getChangeByIdAndFound() {
503504

504505
@Test
505506
public void getChangeByIdAndNotFoundAndNameSetAndFound() {
506-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
507-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME))
507+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
508+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id()))
508509
.andReturn(CHANGE_REQUEST_AFTER);
509510
// again for options
510-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
511+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
511512
.andReturn(null);
512-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
513+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
513514
.andReturn(CHANGE_REQUEST_AFTER);
514515
replay(dns);
515516
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -523,12 +524,12 @@ public void getChangeByIdAndNotFoundAndNameSetAndFound() {
523524

524525
@Test
525526
public void getChangeIdAndNotFoundAndNameSetAndNotFound() {
526-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
527-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME)).andReturn(null);
527+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
528+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id())).andReturn(null);
528529
// again with options
529-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
530+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
530531
.andReturn(null);
531-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
532+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
532533
.andReturn(null);
533534
replay(dns);
534535
ChangeRequest result = zone.getChangeRequest(CHANGE_REQUEST.id());
@@ -540,8 +541,8 @@ public void getChangeIdAndNotFoundAndNameSetAndNotFound() {
540541

541542
@Test
542543
public void getChangeRequestByIdAndNotFoundAndNameNotSet() {
543-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID)).andReturn(null);
544-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_ID, CHANGE_REQUEST_FIELD_OPTIONS))
544+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id())).andReturn(null);
545+
expect(dns.getChangeRequest(ZONE_ID, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
545546
.andReturn(null); // for options
546547
replay(dns);
547548
ChangeRequest result = zoneNoName.getChangeRequest(CHANGE_REQUEST.id());
@@ -554,10 +555,10 @@ public void getChangeRequestByIdAndNotFoundAndNameNotSet() {
554555
@Test
555556
public void getChangeByNameAndFound() {
556557
// ID is not set
557-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME))
558+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id()))
558559
.andReturn(CHANGE_REQUEST_AFTER);
559560
// again for options
560-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
561+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
561562
.andReturn(CHANGE_REQUEST_AFTER);
562563
replay(dns);
563564
ChangeRequest result = zoneNoId.getChangeRequest(CHANGE_REQUEST.id());
@@ -570,9 +571,9 @@ public void getChangeByNameAndFound() {
570571
@Test
571572
public void getChangeByNameAndNotFound() {
572573
// ID is not set
573-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME)).andReturn(null);
574+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id())).andReturn(null);
574575
// again for options
575-
expect(dns.getChangeRequest(CHANGE_REQUEST.id(), ZONE_NAME, CHANGE_REQUEST_FIELD_OPTIONS))
576+
expect(dns.getChangeRequest(ZONE_NAME, CHANGE_REQUEST.id(), CHANGE_REQUEST_FIELD_OPTIONS))
576577
.andReturn(null);
577578
replay(dns);
578579
ChangeRequest result = zoneNoId.getChangeRequest(CHANGE_REQUEST.id());
@@ -666,6 +667,7 @@ public void getChangeRequestWithNoId() {
666667

667668
@Test
668669
public void listChangeRequestsByIdAndFound() {
670+
@SuppressWarnings("unchecked")
669671
Page<ChangeRequest> pageMock = createStrictMock(Page.class);
670672
replay(pageMock);
671673
expect(dns.listChangeRequests(ZONE_ID)).andReturn(pageMock);
@@ -681,6 +683,7 @@ public void listChangeRequestsByIdAndFound() {
681683

682684
@Test
683685
public void listChangeRequestsByIdAndNotFoundAndNameSetAndFound() {
686+
@SuppressWarnings("unchecked")
684687
Page<ChangeRequest> pageMock = createStrictMock(Page.class);
685688
replay(pageMock);
686689
expect(dns.listChangeRequests(ZONE_ID)).andReturn(null);
@@ -724,6 +727,7 @@ public void listChangeRequestsByIdAndNotFoundAndNameNotSet() {
724727

725728
@Test
726729
public void listChangeRequestsByNameAndFound() {
730+
@SuppressWarnings("unchecked")
727731
Page<ChangeRequest> pageMock = createStrictMock(Page.class);
728732
replay(pageMock);
729733
expect(dns.listChangeRequests(ZONE_NAME)).andReturn(pageMock);

0 commit comments

Comments
 (0)