mirror of https://github.com/apache/jclouds.git
Merge pull request #1395 from jclouds/dynect-listnf
remove exception handling when a record set is not found
This commit is contained in:
commit
2c92822b6c
|
@ -35,6 +35,7 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
|
|
||||||
|
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
|
||||||
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
|
||||||
import org.jclouds.dynect.v3.DynECTExceptions.JobStillRunningException;
|
import org.jclouds.dynect.v3.DynECTExceptions.JobStillRunningException;
|
||||||
import org.jclouds.dynect.v3.domain.CreateRecord;
|
import org.jclouds.dynect.v3.domain.CreateRecord;
|
||||||
|
@ -94,6 +95,7 @@ public interface RecordAsyncApi {
|
||||||
@GET
|
@GET
|
||||||
@Path("/{type}Record/{zone}/{fqdn}")
|
@Path("/{type}Record/{zone}/{fqdn}")
|
||||||
@ResponseParser(ToRecordIds.class)
|
@ResponseParser(ToRecordIds.class)
|
||||||
|
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
|
||||||
ListenableFuture<FluentIterable<RecordId>> listByFQDNAndType(@PathParam("fqdn") String fqdn,
|
ListenableFuture<FluentIterable<RecordId>> listByFQDNAndType(@PathParam("fqdn") String fqdn,
|
||||||
@PathParam("type") String type) throws JobStillRunningException;
|
@PathParam("type") String type) throws JobStillRunningException;
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,14 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.dynect.v3.features;
|
package org.jclouds.dynect.v3.features;
|
||||||
|
|
||||||
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
|
|
||||||
import static com.google.common.net.HttpHeaders.ACCEPT;
|
import static com.google.common.net.HttpHeaders.ACCEPT;
|
||||||
|
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
|
||||||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
|
||||||
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
import static org.jclouds.dynect.v3.domain.RecordId.recordIdBuilder;
|
||||||
import static org.jclouds.dynect.v3.domain.rdata.AData.a;
|
import static org.jclouds.dynect.v3.domain.rdata.AData.a;
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
import static org.testng.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import org.jclouds.dynect.v3.DynECTApi;
|
import org.jclouds.dynect.v3.DynECTApi;
|
||||||
import org.jclouds.dynect.v3.domain.CreateRecord;
|
import org.jclouds.dynect.v3.domain.CreateRecord;
|
||||||
|
@ -318,6 +319,11 @@ public class RecordApiExpectTest extends BaseDynECTApiExpectTest {
|
||||||
assertEquals(success.getRecordApiForZone("jclouds.org").listByFQDNAndType("www.foo.com", "A").toString(),
|
assertEquals(success.getRecordApiForZone("jclouds.org").listByFQDNAndType("www.foo.com", "A").toString(),
|
||||||
new ListRecordsResponseTest().expected().toString());
|
new ListRecordsResponseTest().expected().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testListByFQDNAndTypeWhenResponseIs404() {
|
||||||
|
DynECTApi fail = requestsSendResponses(createSession, createSessionResponse, listByFQDNAndType, notFound);
|
||||||
|
assertTrue(fail.getRecordApiForZone("jclouds.org").listByFQDNAndType("www.foo.com", "A").isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
HttpRequest create = HttpRequest.builder().method("POST")
|
HttpRequest create = HttpRequest.builder().method("POST")
|
||||||
.endpoint("https://api2.dynect.net/REST/ARecord/jclouds.org/www.jclouds.org")
|
.endpoint("https://api2.dynect.net/REST/ARecord/jclouds.org/www.jclouds.org")
|
||||||
|
|
Loading…
Reference in New Issue