Package org.jclouds.rest

Examples of org.jclouds.rest.AuthorizationException


            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }

   @Test(expectedExceptions = AuthorizationException.class)
   public void testPropagateCreationExceptionAuthorizationException() throws Throwable {
      Exception e = new AuthorizationException();
      propagateIfPossible(
            new CreationException(ImmutableSet.of(new Message(ImmutableList.of(), "Error in custom provider", e))),
            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }
View Full Code Here


            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }

   @Test(expectedExceptions = AuthorizationException.class)
   public void testPropagateStandardExceptionAuthorizationExceptionNestedInHttpResponseException() throws Throwable {
      Exception e = new AuthorizationException();
      propagateIfPossible(new HttpResponseException("goo", createNiceMock(HttpCommand.class), null, e),
            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }
View Full Code Here

      }

      @Provides
      @Named("exception")
      Set<String> exception() {
         throw new AuthorizationException();
      }
View Full Code Here

      try {
         new SetAndThrowAuthorizationExceptionSupplier<String>(new Supplier<String>() {

            @Override
            public String get() {
               throw new AuthorizationException();
            }
         }, authException).get();
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

      try {
         new SetAndThrowAuthorizationExceptionSupplier<String>(new Supplier<String>() {

            @Override
            public String get() {
               throw new RuntimeException(new ExecutionException(new AuthorizationException()));
            }
         }, authException).get();
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

   public void testLoaderThrowsAuthorizationExceptionAndAlsoSetsExceptionType() {
      AtomicReference<AuthorizationException> authException = newReference();
      try {
         new SetAndThrowAuthorizationExceptionSupplierBackedLoader<String>(new Supplier<String>() {
            public String get() {
               throw new AuthorizationException();
            }
         }, authException).load("KEY");
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

   public void testLoaderThrowsAuthorizationExceptionAndAlsoSetsExceptionTypeWhenNested() {
      AtomicReference<AuthorizationException> authException = newReference();
      try {
         new SetAndThrowAuthorizationExceptionSupplierBackedLoader<String>(new Supplier<String>() {
            public String get() {
               throw new RuntimeException(new ExecutionException(new AuthorizationException()));
            }
         }, authException).load("KEY");
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

   public void testLoaderThrowsAuthorizationExceptionAndAlsoSetsExceptionTypeWhenInUncheckedExecutionException() {
      AtomicReference<AuthorizationException> authException = newReference();
      try {
         new SetAndThrowAuthorizationExceptionSupplierBackedLoader<String>(new Supplier<String>() {
            public String get() {
               throw new UncheckedExecutionException(new AuthorizationException());
            }
         }, authException).load("KEY");
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

      switch (response.getStatusCode()) {
         case 400:
            break;
         case 401:
         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
View Full Code Here

                    .privateKey(privateKey).build();
         } catch (IOException e) {
            throw propagate(e);
            // catch security exceptions InvalidKeySpecException and NoSuchAlgorithmException as GSE
         } catch (GeneralSecurityException e) {
            throw new AuthorizationException("security exception loading credentials. " + e.getMessage(), e);
            // catch IAE that is thrown when parsing the pk fails
         } catch (IllegalArgumentException e) {
            throw new AuthorizationException("cannot parse pk. " + e.getMessage(), e);
         }
      }
View Full Code Here

TOP

Related Classes of org.jclouds.rest.AuthorizationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.