-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Zone.ttl is the SOA ttl. This is not always the default for new records. See #357
- Loading branch information
Adrian Cole
committed
Apr 1, 2015
1 parent
5859f54
commit dae431d
Showing
27 changed files
with
258 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,11 @@ | |
import denominator.ResourceRecordSetApi; | ||
import denominator.model.ResourceRecordSet; | ||
import denominator.model.rdata.AData; | ||
import denominator.model.rdata.SOAData; | ||
|
||
import static denominator.assertj.ModelAssertions.assertThat; | ||
import static denominator.clouddns.RackspaceApisTest.domainId; | ||
import static denominator.clouddns.RackspaceApisTest.soaResponse; | ||
import static org.junit.Assert.assertFalse; | ||
import static org.junit.Assert.assertNull; | ||
|
||
|
@@ -151,6 +153,30 @@ public void getByNameAndTypeWhenPresent() throws Exception { | |
.hasPath("/v1.0/123123/domains/1234/records?name=www.denominator.io&type=A"); | ||
} | ||
|
||
@Test | ||
public void getByNameAndType_SOA() throws Exception { | ||
server.enqueueAuthResponse(); | ||
server.enqueue(new MockResponse().setBody(soaResponse)); | ||
|
||
ResourceRecordSetApi api = server.connect().api().basicRecordSetsInZone(domainId + ""); | ||
|
||
assertThat(api.getByNameAndType("denominator.io", "SOA")) | ||
.hasName("denominator.io") | ||
.hasType("SOA") | ||
.hasTtl(3600) | ||
.containsExactlyRecords(SOAData.builder() | ||
.mname("ns.rackspace.com") | ||
.rname("[email protected]") | ||
.serial(1427817447) | ||
.refresh(3600).retry(3600) | ||
.expire(3600).minimum(3600).build()); | ||
|
||
server.assertAuthRequest(); | ||
server.assertRequest() | ||
.hasMethod("GET") | ||
.hasPath("/v1.0/123123/domains/1234/records?name=denominator.io&type=SOA"); | ||
} | ||
|
||
@Test | ||
public void getByNameAndTypeWhenAbsent() throws Exception { | ||
server.enqueueAuthResponse(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
|
||
import static denominator.assertj.ModelAssertions.assertThat; | ||
import static denominator.clouddns.RackspaceApisTest.domainsResponse; | ||
import static denominator.clouddns.RackspaceApisTest.soaResponse; | ||
|
||
public class CloudDNSZoneApiMockTest { | ||
|
||
|
@@ -20,15 +21,18 @@ public class CloudDNSZoneApiMockTest { | |
public void iteratorWhenPresent() throws Exception { | ||
server.enqueueAuthResponse(); | ||
server.enqueue(new MockResponse().setBody(domainsResponse)); | ||
server.enqueue(new MockResponse().setBody(soaResponse)); | ||
|
||
ZoneApi api = server.connect().api().zones(); | ||
|
||
assertThat(api.iterator()).containsExactly( | ||
Zone.create("denominator.io", "1234", "[email protected]") | ||
Zone.create("1234", "denominator.io", 3600, "[email protected]") | ||
); | ||
|
||
server.assertAuthRequest(); | ||
server.assertRequest().hasPath("/v1.0/123123/domains"); | ||
server.assertRequest() | ||
.hasPath("/v1.0/123123/domains/1234/records?name=denominator.io&type=SOA"); | ||
} | ||
|
||
@Test | ||
|
@@ -47,15 +51,18 @@ public void iteratorWhenAbsent() throws Exception { | |
public void iteratorByNameWhenPresent() throws Exception { | ||
server.enqueueAuthResponse(); | ||
server.enqueue(new MockResponse().setBody(domainsResponse)); | ||
server.enqueue(new MockResponse().setBody(soaResponse)); | ||
|
||
ZoneApi api = server.connect().api().zones(); | ||
|
||
assertThat(api.iterateByName("denominator.io")).containsExactly( | ||
Zone.create("denominator.io", "1234", "[email protected]") | ||
Zone.create("1234", "denominator.io", 3600, "[email protected]") | ||
); | ||
|
||
server.assertAuthRequest(); | ||
server.assertRequest().hasPath("/v1.0/123123/domains?name=denominator.io"); | ||
server.assertRequest() | ||
.hasPath("/v1.0/123123/domains/1234/records?name=denominator.io&type=SOA"); | ||
} | ||
|
||
@Test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,13 +74,17 @@ public void domainsPresent() throws Exception { | |
.hasPath("/v1.0/123123/domains"); | ||
} | ||
|
||
/** | ||
* Rackspace doesn't expose the ttl in domain list. A dummy TTL of zero is added as this result is | ||
* never used directly. | ||
*/ | ||
@Test | ||
public void domainsByNamePresent() throws Exception { | ||
server.enqueueAuthResponse(); | ||
server.enqueue(new MockResponse().setBody(domainsResponse)); | ||
|
||
assertThat(mockApi().domainsByName("denominator.io")).containsExactly( | ||
Zone.create("denominator.io", "1234", "[email protected]") | ||
Zone.create("1234", "denominator.io", 0, "[email protected]") | ||
); | ||
|
||
server.assertAuthRequest(); | ||
|
@@ -279,6 +283,9 @@ public Credentials get() { | |
static String | ||
domainsResponse = | ||
"{\"domains\":[{\"name\":\"denominator.io\",\"id\":1234,\"accountId\":123123,\"emailAddress\":\"[email protected]\",\"updated\":\"2013-09-02T19:46:56.000+0000\",\"created\":\"2013-09-02T19:45:51.000+0000\"}],\"totalEntries\":1}"; | ||
static String | ||
soaResponse = | ||
"{\"records\":[{\"name\":\"denominator.io\",\"id\":\"SOA-4612221\",\"type\":\"SOA\",\"data\":\"ns.rackspace.com [email protected] 1427817447\",\"ttl\":3600}]}"; | ||
// NOTE records are allowed to be out of order by type | ||
static String | ||
recordsResponse = | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.