Java Code Examples for com.amazonaws.AmazonServiceException#setErrorType()

The following examples show how to use com.amazonaws.AmazonServiceException#setErrorType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleDbOperationRetrierTest.java    From spring-data-simpledb with MIT License 6 votes vote down vote up
@Test
public void executeWithRetries_should_fail_for_exceeded_retries() throws Exception {

	AbstractServiceUnavailableOperationRetrier retrier = new AbstractServiceUnavailableOperationRetrier(SERVICE_UNAVAILABLE_RETRIES) {

		@Override
		public void execute() {
			AmazonServiceException serviceException = new AmazonServiceException("Test message");
			serviceException.setStatusCode(SERVICE_UNAVAILABLE_STATUS_CODE);
			serviceException.setErrorType(AmazonServiceException.ErrorType.Service);
			throw serviceException;
		}
	};

	try {
		retrier.executeWithRetries();
		fail("Number of retries should be exceeded");
	} catch(DataAccessResourceFailureException e) {
		// Our Exception -- ...times
		assertThat(e.getMessage(), StringContains.containsString("times"));
	}
}
 
Example 2
Source File: AbstractDynamoDBTest.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
protected AmazonServiceException getSampleAwsServiceException() {
    final AmazonServiceException testServiceException = new AmazonServiceException("Test AWS Service Exception");
    testServiceException.setErrorCode("8673509");
    testServiceException.setErrorMessage("This request cannot be serviced right now.");
    testServiceException.setErrorType(ErrorType.Service);
    testServiceException.setServiceName("Dynamo DB");
    testServiceException.setRequestId("TestRequestId-1234567890");

    return testServiceException;
}
 
Example 3
Source File: AbstractDynamoDBTest.java    From nifi with Apache License 2.0 5 votes vote down vote up
protected AmazonServiceException getSampleAwsServiceException() {
    final AmazonServiceException testServiceException = new AmazonServiceException("Test AWS Service Exception");
    testServiceException.setErrorCode("8673509");
    testServiceException.setErrorMessage("This request cannot be serviced right now.");
    testServiceException.setErrorType(ErrorType.Service);
    testServiceException.setServiceName("Dynamo DB");
    testServiceException.setRequestId("TestRequestId-1234567890");

    return testServiceException;
}
 
Example 4
Source File: KinesisProxyTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithServiceException() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(ErrorType.Service);
	assertTrue(KinesisProxy.isRecoverableException(ex));
}
 
Example 5
Source File: KinesisProxyTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithNullErrorType() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(null);
	assertFalse(KinesisProxy.isRecoverableException(ex));
}
 
Example 6
Source File: KinesisProxyTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithServiceException() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(ErrorType.Service);
	assertTrue(KinesisProxy.isRecoverableException(ex));
}
 
Example 7
Source File: KinesisProxyTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithNullErrorType() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(null);
	assertFalse(KinesisProxy.isRecoverableException(ex));
}
 
Example 8
Source File: SimplifiedKinesisClientTest.java    From beam with Apache License 2.0 4 votes vote down vote up
private AmazonServiceException newAmazonServiceException(ErrorType errorType) {
  AmazonServiceException exception = new AmazonServiceException("");
  exception.setErrorType(errorType);
  return exception;
}
 
Example 9
Source File: KinesisProxyTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithServiceException() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(ErrorType.Service);
	assertTrue(KinesisProxy.isRecoverableException(ex));
}
 
Example 10
Source File: KinesisProxyTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Test
public void testIsRecoverableExceptionWithNullErrorType() {
	final AmazonServiceException ex = new AmazonServiceException("asdf");
	ex.setErrorType(null);
	assertFalse(KinesisProxy.isRecoverableException(ex));
}