Merge pull request #1395 from jclouds/dynect-listnf

remove exception handling when a record set is not found
This commit is contained in:
Adrian Cole 2013-03-08 14:14:28 -08:00
commit 2c92822b6c
2 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.jclouds.Fallbacks.EmptyFluentIterableOnNotFoundOr404;
import org.jclouds.Fallbacks.NullOnNotFoundOr404;
import org.jclouds.dynect.v3.DynECTExceptions.JobStillRunningException;
import org.jclouds.dynect.v3.domain.CreateRecord;
@ -94,6 +95,7 @@ public interface RecordAsyncApi {
@GET
@Path("/{type}Record/{zone}/{fqdn}")
@ResponseParser(ToRecordIds.class)
@Fallback(EmptyFluentIterableOnNotFoundOr404.class)
ListenableFuture<FluentIterable<RecordId>> listByFQDNAndType(@PathParam("fqdn") String fqdn,
@PathParam("type") String type) throws JobStillRunningException;

View File

@ -18,13 +18,14 @@
*/
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.CONTENT_TYPE;
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.rdata.AData.a;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
import org.jclouds.dynect.v3.DynECTApi;
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(),
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")
.endpoint("https://api2.dynect.net/REST/ARecord/jclouds.org/www.jclouds.org")