Package org.jclouds.rest

Examples of org.jclouds.rest.ResourceNotFoundException


         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


      Image image = createNiceMock(Image.class);
      Set<? extends org.jclouds.ec2.domain.Image> images = ImmutableSet.<org.jclouds.ec2.domain.Image> of(ec2Image);

      expect(caller.getAMIServices()).andReturn(client).atLeastOnce();
      expect(client.describeImagesInRegion("region", imageIds("ami"))).andReturn(Set.class.cast(images));
      expect(parser.apply(ec2Image)).andThrow(new ResourceNotFoundException());

      replay(caller);
      replay(image);
      replay(parser);
      replay(client);
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

   public URI apply(Object from) {
      try {
         return orgVDCMap.get().get(from == null ? defaultVDC.get().getHref() : from).getPublicIps().getHref();
      } catch (NullPointerException e) {
         throw new ResourceNotFoundException("vdc " + from + " not found in " + orgVDCMap.get());
      }
   }
View Full Code Here

      });
      try {
         Org org = uriToOrg.get(from == null ? defaultOrg.get().getHref() : from);
         return getUriFromOrg(org);
      } catch (NullPointerException e) {
         throw new ResourceNotFoundException("org " + from + " not found in: " + uriToOrg, e);
      }
   }
View Full Code Here

         switch (response.getStatusCode()) {
            case 401:
               exception = new AuthorizationException(response.getMessage(), exception);
               break;
            case 404:
               exception = new ResourceNotFoundException(response.getMessage(), exception);
               break;
            default:
               exception = new HttpResponseException(response.getMessage(), command, response);
               break;
         }
View Full Code Here

      verify(exception);
   }

   public void testFalseIfResourceNotFound() throws Exception {
      FalseIfNotAvailable function = new FalseIfNotAvailable();
      ResourceNotFoundException exception = new ResourceNotFoundException();

      assertFalse(function.createOrPropagate(exception));
   }
View Full Code Here

      }
   }

   public void testOriginalExceptionIfNotAbiquoException() {
      PropagateAbiquoExceptionOnNotFoundOr4xx function = new PropagateAbiquoExceptionOnNotFoundOr4xx();
      ResourceNotFoundException exception = new ResourceNotFoundException();

      try {
         function.create(exception);
      } catch (Exception ex) {
         assertEquals(ex, exception);
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.