Skip to content

Commit 7597618

Browse files
committed
---
yaml --- r: 4587 b: refs/heads/logging-alpha c: 767be65 h: refs/heads/master i: 4585: ca47632 4583: 5edf496
1 parent 50f9822 commit 7597618

3 files changed

Lines changed: 18 additions & 9 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: a26bd5985685c8bc5a764a57cd5140d6934c6d83
15+
refs/heads/logging-alpha: 767be657b14e8f6e86167389e9af8d65a7fff19d
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-dns/src/main/java/com/google/gcloud/dns/testing/LocalDnsHelper.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,15 @@ Response createZone(String projectId, ManagedZone zone, String... fields) {
680680
completeZone.setId(BigInteger.valueOf(Math.abs(ID_GENERATOR.nextLong() % Long.MAX_VALUE)));
681681
completeZone.setNameServers(randomNameservers());
682682
ZoneContainer zoneContainer = new ZoneContainer(completeZone);
683-
zoneContainer.dnsRecords().set(defaultRecords(completeZone));
683+
ImmutableSortedMap<String, ResourceRecordSet> defaultsRecords = defaultRecords(completeZone);
684+
zoneContainer.dnsRecords().set(defaultsRecords);
685+
Change change = new Change();
686+
change.setAdditions(ImmutableList.copyOf(defaultsRecords.values()));
687+
change.setStatus("done");
688+
change.setId("0");
689+
change.setStartTime(ISODateTimeFormat.dateTime().withZoneUTC()
690+
.print(System.currentTimeMillis()));
691+
zoneContainer.changes().add(change);
684692
ProjectContainer projectContainer = findProject(projectId);
685693
ZoneContainer oldValue = projectContainer.zones().putIfAbsent(
686694
completeZone.getName(), zoneContainer);
@@ -718,8 +726,9 @@ Response createChange(String projectId, String zoneName, Change change, String..
718726
completeChange.setDeletions(ImmutableList.copyOf(change.getDeletions()));
719727
}
720728
/* We need to set ID for the change. We are working in concurrent environment. We know that the
721-
element fell on an index between 0 and maxId, so we will reset all IDs in this range (all of
722-
them are valid for the respective objects). */
729+
element fell on an index between 1 and maxId (index 0 is the default change which creates SOA
730+
and NS), so we will reset all IDs between 0 and maxId (all of them are valid for the respective
731+
objects). */
723732
ConcurrentLinkedQueue<Change> changeSequence = zoneContainer.changes();
724733
changeSequence.add(completeChange);
725734
int maxId = changeSequence.size();
@@ -728,7 +737,7 @@ Response createChange(String projectId, String zoneName, Change change, String..
728737
if (index == maxId) {
729738
break;
730739
}
731-
c.setId(String.valueOf(++index));
740+
c.setId(String.valueOf(index++));
732741
}
733742
completeChange.setStatus("pending");
734743
completeChange.setStartTime(ISODateTimeFormat.dateTime().withZoneUTC()

branches/logging-alpha/gcloud-java-dns/src/test/java/com/google/gcloud/dns/testing/LocalDnsHelperTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -850,14 +850,14 @@ public void testListChanges() {
850850
RPC.create(ZONE1, EMPTY_RPC_OPTIONS);
851851
Iterable<Change> results = RPC.listChangeRequests(ZONE1.getName(), EMPTY_RPC_OPTIONS).results();
852852
ImmutableList<Change> changes = ImmutableList.copyOf(results);
853-
assertEquals(0, changes.size());
853+
assertEquals(1, changes.size());
854854
// zone has changes
855855
RPC.applyChangeRequest(ZONE1.getName(), CHANGE1, EMPTY_RPC_OPTIONS);
856856
RPC.applyChangeRequest(ZONE1.getName(), CHANGE2, EMPTY_RPC_OPTIONS);
857857
RPC.applyChangeRequest(ZONE1.getName(), CHANGE_KEEP, EMPTY_RPC_OPTIONS);
858858
results = RPC.listChangeRequests(ZONE1.getName(), EMPTY_RPC_OPTIONS).results();
859859
changes = ImmutableList.copyOf(results);
860-
assertEquals(3, changes.size());
860+
assertEquals(4, changes.size());
861861
// error in options
862862
Map<DnsRpc.Option, Object> options = new HashMap<>();
863863
options.put(DnsRpc.Option.PAGE_SIZE, 0);
@@ -881,14 +881,14 @@ public void testListChanges() {
881881
options.put(DnsRpc.Option.PAGE_SIZE, 15);
882882
results = RPC.listChangeRequests(ZONE1.getName(), options).results();
883883
changes = ImmutableList.copyOf(results);
884-
assertEquals(3, changes.size());
884+
assertEquals(4, changes.size());
885885
options = new HashMap<>();
886886
options.put(DnsRpc.Option.SORTING_ORDER, "descending");
887887
results = RPC.listChangeRequests(ZONE1.getName(), options).results();
888888
ImmutableList<Change> descending = ImmutableList.copyOf(results);
889889
results = RPC.listChangeRequests(ZONE1.getName(), EMPTY_RPC_OPTIONS).results();
890890
ImmutableList<Change> ascending = ImmutableList.copyOf(results);
891-
int size = 3;
891+
int size = 4;
892892
assertEquals(size, descending.size());
893893
for (int i = 0; i < size; i++) {
894894
assertEquals(descending.get(i), ascending.get(size - i - 1));

0 commit comments

Comments
 (0)