Java Code Examples for org.jets3t.service.ServiceException#setResponseCode()

The following examples show how to use org.jets3t.service.ServiceException#setResponseCode() . 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: S3ExceptionMappingServiceTest.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testLoginFailure() {
    final ServiceException f = new ServiceException("m", "<null/>");
    f.setResponseCode(401);
    f.setErrorMessage("m");
    assertTrue(new S3ExceptionMappingService().map(f) instanceof LoginFailureException);
}
 
Example 2
Source File: S3ExceptionMappingServiceTest.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testLoginFailure403() {
    final ServiceException f = new ServiceException("m", "<null/>");
    f.setResponseCode(403);
    f.setErrorMessage("m");
    f.setErrorCode("AccessDenied");
    assertTrue(new S3ExceptionMappingService().map(f) instanceof AccessDeniedException);
    f.setErrorCode("InvalidAccessKeyId");
    assertTrue(new S3ExceptionMappingService().map(f) instanceof LoginFailureException);
    f.setErrorCode("SignatureDoesNotMatch");
    assertTrue(new S3ExceptionMappingService().map(f) instanceof LoginFailureException);
}
 
Example 3
Source File: S3ExceptionMappingServiceTest.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testBadRequest() {
    final ServiceException f = new ServiceException("m", "<null/>");
    f.setErrorMessage("m");
    f.setResponseCode(400);
    assertTrue(new S3ExceptionMappingService().map(f) instanceof InteroperabilityException);
}
 
Example 4
Source File: S3ExceptionMappingServiceTest.java    From cyberduck with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void test403NoXml() {
    final ServiceException f = new ServiceException();
    f.setResponseCode(403);
    assertTrue(new S3ExceptionMappingService().map(f) instanceof AccessDeniedException);
}