Search in sources :

Example 66 with ServiceException

use of org.jets3t.service.ServiceException in project cyberduck by iterate-ch.

the class S3ExceptionMappingServiceTest method testLoginFailure403.

@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);
}
Also used : AccessDeniedException(ch.cyberduck.core.exception.AccessDeniedException) LoginFailureException(ch.cyberduck.core.exception.LoginFailureException) ServiceException(org.jets3t.service.ServiceException) S3ServiceException(org.jets3t.service.S3ServiceException) Test(org.junit.Test)

Example 67 with ServiceException

use of org.jets3t.service.ServiceException in project cyberduck by iterate-ch.

the class S3ExceptionMappingServiceTest method testCustomMessage.

@Test
public void testCustomMessage() {
    assertEquals("Custom.", new S3ExceptionMappingService().map("custom", new ServiceException("message")).getMessage());
    assertEquals("Message. Please contact your web hosting service provider for assistance.", new S3ExceptionMappingService().map("custom", new ServiceException("message")).getDetail());
}
Also used : ServiceException(org.jets3t.service.ServiceException) S3ServiceException(org.jets3t.service.S3ServiceException) Test(org.junit.Test)

Aggregations

ServiceException (org.jets3t.service.ServiceException)67 S3ServiceException (org.jets3t.service.S3ServiceException)24 Path (ch.cyberduck.core.Path)22 IOException (java.io.IOException)18 S3Object (org.jets3t.service.model.S3Object)16 StorageObject (org.jets3t.service.model.StorageObject)9 Test (org.junit.Test)9 AccessDeniedException (ch.cyberduck.core.exception.AccessDeniedException)8 InteroperabilityException (ch.cyberduck.core.exception.InteroperabilityException)8 NotfoundException (ch.cyberduck.core.exception.NotfoundException)8 ArrayList (java.util.ArrayList)7 BackgroundException (ch.cyberduck.core.exception.BackgroundException)6 MultipartUpload (org.jets3t.service.model.MultipartUpload)6 PathAttributes (ch.cyberduck.core.PathAttributes)4 HostPreferences (ch.cyberduck.core.preferences.HostPreferences)4 SegmentLoadingException (io.druid.segment.loading.SegmentLoadingException)4 BufferedInputStream (java.io.BufferedInputStream)4 InputStream (java.io.InputStream)4 AttributedList (ch.cyberduck.core.AttributedList)3 DefaultIOExceptionMappingService (ch.cyberduck.core.DefaultIOExceptionMappingService)3