Package org.jclouds.rest

Examples of org.jclouds.rest.ResourceNotFoundException


      AccessControlList acl = createMock(AccessControlList.class);

      int attempts = 5;
      BackoffOnNotFoundWhenGetBucketACL backoff = new BackoffOnNotFoundWhenGetBucketACL(mock);

      expect(mock.getBucketACL("foo")).andThrow(new ResourceNotFoundException()).times(attempts - 1);
      expect(mock.getBucketACL("foo")).andReturn(acl);

      replay(mock);
      assertSame(backoff.load("foo"), acl);
      verify(mock);
View Full Code Here


   @Test(expectedExceptions = ResourceNotFoundException.class)
   void testMaxRetriesExceededThrowsException() {
      int attempts = 5;
      BackoffOnNotFoundWhenGetBucketACL backoff = new BackoffOnNotFoundWhenGetBucketACL(mock);

      expect(mock.getBucketACL("foo")).andThrow(new ResourceNotFoundException()).times(attempts);

      replay(mock);
      backoff.load("foo");
   }
View Full Code Here

   @Override
   public void rebootNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      setStateOnNode(Status.PENDING, node);
      setStateOnNodeAfterDelay(Status.RUNNING, node, 50);
   }
View Full Code Here

   @Override
   public void resumeNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      if (node.getStatus() == Status.RUNNING)
         return;
      if (node.getStatus() != Status.SUSPENDED)
         throw new IllegalStateException("to resume a node, it must be in suspended status, not: " + formatStatus(node));
      setStateOnNode(Status.PENDING, node);
View Full Code Here

   @Override
   public void suspendNode(String id) {
      NodeMetadata node = nodes.get(id);
      if (node == null)
         throw new ResourceNotFoundException("node not found: " + id);
      if (node.getStatus() == Status.SUSPENDED)
         return;
      if (node.getStatus() != Status.RUNNING)
         throw new IllegalStateException("to suspend a node, it must be in running status, not: " + formatStatus(node));
      setStateOnNode(Status.PENDING, node);
View Full Code Here

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

      this.client = client;
   }

   @Override
   public AccessControlList load(String bucketName) {
      ResourceNotFoundException last = null;
      for (int currentTries = 0; currentTries < maxTries; currentTries++) {
         try {
            return client.getBucketACL(bucketName);
         } catch (ResourceNotFoundException e) {
            imposeBackoffExponentialDelay(100l, 200l, 2, currentTries, maxTries);
View Full Code Here

                  if (matcher.find()) {
                     message = String.format("%s %s not found", matcher.group(1), matcher.group(2));
                  } else {
                     message = path;
                  }
                  exception = new ResourceNotFoundException(message);
               }
               break;
            case 409:
               exception = new IllegalStateException(content);
               break;
View Full Code Here

               URI defaultS3Endpoint = URI.create(new S3ApiMetadata().getDefaultEndpoint().get());
               URI requestEndpoint = command.getCurrentRequest().getEndpoint();
               boolean wasPathBasedRequest = requestEndpoint.getHost().contains(defaultS3Endpoint.getHost()) &&
                     requestEndpoint.getHost().equals(defaultS3Endpoint.getHost());

               exception = new ResourceNotFoundException(message, exception);
               if (isVhostStyle && !wasPathBasedRequest) {
                  String container = command.getCurrentRequest().getEndpoint().getHost();
                  String key = command.getCurrentRequest().getEndpoint().getPath();
                  if (key == null || key.equals("/"))
                     exception = new ContainerNotFoundException(container, message);
View Full Code Here

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

TOP

Related Classes of org.jclouds.rest.ResourceNotFoundException

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.