@Test public void test413WithRetryAfterExceptionFolsom() { fn.handleError(command, retryAfter); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 54 seconds"); }
@Test public void test413WithRetryAfterTrumpsRetryAt() { fn.handleError(command, retryAfterTrumps); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 54 seconds"); }
@Test public void test413WithRetryAtExceptionParsesDelta() { fn.handleError(command, retryAt); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 3600 seconds"); }
@Test public void test413WithRetryAfterTrumpsRetryAt() { fn.handleError(command, retryAfterTrumps); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 54 seconds"); }
@Test public void test413WithRetryAtExceptionParsesDelta() { fn.handleError(command, retryAt); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 3600 seconds"); }
@Test public void test413WithRetryAfterExceptionFolsom() { fn.handleError(command, retryAfter); assertEquals(command.getException().getClass(), RetryAfterException.class); assertEquals(command.getException().getMessage(), "retry in 54 seconds"); }
@Test public void test400MakesIllegalStateExceptionOnQuotaExceededOnNoFixedIps() { fn.handleError(command, noFixedIps); assertEquals(command.getException().getClass(), IllegalStateException.class); assertEquals(command.getException().getMessage(), noFixedIps.getPayload().getRawContent()); }
@Test public void test400MakesIllegalStateExceptionOnAlreadyExists() { fn.handleError(command, alreadyExists); assertEquals(command.getException().getClass(), IllegalStateException.class); assertEquals(command.getException().getMessage(), alreadyExists.getPayload().getRawContent()); }
@Test public void test400MakesInsufficientResourcesExceptionOnQuotaExceeded() { fn.handleError(command, quotaExceeded); assertEquals(command.getException().getClass(), InsufficientResourcesException.class); assertEquals(command.getException().getMessage(), quotaExceeded.getPayload().getRawContent()); }
@Test public void test413WithBadRetryAtFormatFallsBack() { fn.handleError(command, badRetryAt); assertEquals(command.getException().getClass(), InsufficientResourcesException.class); assertEquals(command.getException().getMessage(), badRetryAt.getPayload().getRawContent()); }
@Test public void test413MakesInsufficientResourcesException() { fn.handleError(command, tooLarge); assertEquals(command.getException().getClass(), InsufficientResourcesException.class); assertEquals(command.getException().getMessage(), tooLarge.getPayload().getRawContent()); }
@Test public void test400MakesInsufficientResourcesExceptionOnQuotaExceeded() { fn.handleError(command, quotaExceeded); assertEquals(command.getException().getClass(), InsufficientResourcesException.class); assertEquals(command.getException().getMessage(), quotaExceeded.getPayload().getRawContent()); }
@Test public void test400MakesIllegalStateExceptionOnQuotaExceededOnNoFixedIps() { fn.handleError(command, noFixedIps); assertEquals(command.getException().getClass(), IllegalStateException.class); assertEquals(command.getException().getMessage(), noFixedIps.getPayload().getRawContent()); }
@Test public void test413MakesInsufficientResourcesException() { fn.handleError(command, tooLarge); assertEquals(command.getException().getClass(), InsufficientResourcesException.class); assertEquals(command.getException().getMessage(), tooLarge.getPayload().getRawContent()); }
@Test public void test404MakesResourceNotFoundException() { fn.handleError(command, HttpResponse.builder().statusCode(404).message("Not Found").build()); assertEquals(command.getException().getClass(), ResourceNotFoundException.class); assertEquals(command.getException().getMessage(), "POST https://nova/v1.1/servers HTTP/1.1 -> HTTP/1.1 404 Not Found"); }
@Test public void test401MakesAuthorizationException() { fn.handleError(command, HttpResponse.builder().statusCode(401).message("Unauthorized").build()); assertEquals(command.getException().getClass(), AuthorizationException.class); assertEquals(command.getException().getMessage(), "POST https://nova/v1.1/servers HTTP/1.1 -> HTTP/1.1 401 Unauthorized"); }
@Test public void test401MakesAuthorizationException() { fn.handleError(command, HttpResponse.builder().statusCode(401).message("Unauthorized").build()); assertEquals(command.getException().getClass(), AuthorizationException.class); assertEquals(command.getException().getMessage(), "POST https://nova/v2/servers HTTP/1.1 -> HTTP/1.1 401 Unauthorized"); }
@Test public void test404MakesResourceNotFoundException() { fn.handleError(command, HttpResponse.builder().statusCode(404).message("Not Found").build()); assertEquals(command.getException().getClass(), ResourceNotFoundException.class); assertEquals(command.getException().getMessage(), "POST https://nova/v2/servers HTTP/1.1 -> HTTP/1.1 404 Not Found"); }
@Test public void testInvalidChangeBatchException() throws IOException { HttpResponse response = HttpResponse.builder().statusCode(BAD_REQUEST.getStatusCode()) .payload(payloadFromResource("/invalid_change_batch.xml")).build(); function.handleError(command, response); InvalidChangeBatchException exception = InvalidChangeBatchException.class.cast(command.getException()); assertEquals(exception.getMessages(), ImmutableSet.of( "Tried to create resource record set duplicate.example.com. type A, but it already exists", "Tried to delete resource record set noexist.example.com. type A, but it was not found")); }
@Test public void testInvalidChangeBatchException() throws IOException { HttpResponse response = HttpResponse.builder().statusCode(BAD_REQUEST.getStatusCode()) .payload(payloadFromResource("/invalid_change_batch.xml")).build(); function.handleError(command, response); InvalidChangeBatchException exception = InvalidChangeBatchException.class.cast(command.getException()); assertEquals(exception.getMessages(), ImmutableSet.of( "Tried to create resource record set duplicate.example.com. type A, but it already exists", "Tried to delete resource record set noexist.example.com. type A, but it was not found")); }