Package org.jclouds.openstack.swift.v1.functions

Examples of org.jclouds.openstack.swift.v1.functions.ParseObjectFromResponse


      return list(container, ListContainerOptions.NONE);
   }

   @Override
   public PageSet<? extends StorageMetadata> list(final String container, ListContainerOptions options) {
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      ObjectList objects = objectApi.list(toListContainerOptions.apply(options));
      if (objects == null) {
         containerCache.put(container, Optional.<Container> absent());
         return new PageSetImpl<StorageMetadata>(ImmutableList.<StorageMetadata> of(), null);
      } else {
         containerCache.put(container, Optional.of(objects.container()));
View Full Code Here


   @Override
   public String putBlob(String container, Blob blob, PutOptions options) {
      if (options.isMultipart()) {
         throw new UnsupportedOperationException();
      }
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      return objectApi.replace(blob.getMetadata().getName(), blob.getPayload(), blob.getMetadata().getUserMetadata());
   }
View Full Code Here

      return getBlob(container, key, GetOptions.NONE);
   }

   @Override
   public Blob getBlob(String container, String name, GetOptions options) {
      ObjectApi objectApi = api.objectApiInRegionForContainer(region.getId(), container);
      SwiftObject object = objectApi.get(name, toGetOptions.apply(options));
      if (object == null) {
         return null;
      }
      Blob blob = new BlobImpl(toBlobMetadata(container).apply(object));
      blob.setPayload(object.payload());
View Full Code Here

   }

   private void assertCodeMakes(String method, URI uri, int statusCode, String message, String contentType,
            String content, Class<? extends Exception> expected) {

      SwiftErrorHandler function = new SwiftErrorHandler();

      HttpCommand command = createMock(HttpCommand.class);
      HttpRequest request = HttpRequest.builder().method(method).endpoint(uri).build();
      HttpResponse response = HttpResponse.builder().statusCode(statusCode).message(message).payload(content).build();
      response.getPayload().getContentMetadata().setContentType(contentType);

      expect(command.getCurrentRequest()).andReturn(request).atLeastOnce();
      command.setException(classEq(expected));

      replay(command);

      function.handleError(command, response);

      verify(command);
   }
View Full Code Here

   @Override
   @BeforeClass(groups = "live")
   public void setup() {
      super.setup();
      for (String regionId : api.configuredRegions()) {
         api.containerApiInRegion(regionId).createIfAbsent(name, new CreateContainerOptions());
      }
   }
View Full Code Here

            .addHeader("X-Container-Read", ".r:*,.rlistings") //
            .setBody(objectList)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ObjectList objects = api.objectApiInRegionForContainer("DFW", "myContainer").list(new ListContainerOptions());
         assertEquals(objects, parsedObjectsForUrl(server.getUrl("/").toString()));
         assertEquals(objects.container().name(), "myContainer");
         assertTrue(objects.container().anybodyRead().get());

         assertEquals(server.getRequestCount(), 2);
View Full Code Here

   }

   public void list() throws Exception {
      for (String regionId : regions) {
         ObjectApi objectApi = api.objectApiInRegionForContainer(regionId, containerName);
         ObjectList response = objectApi.list(new ListContainerOptions());
         assertEquals(response.container(), api.containerApiInRegion(regionId).get(containerName));
         assertNotNull(response);
         for (SwiftObject object : response) {
            checkObject(object);
         }
View Full Code Here

      setIfTestSystemPropertyPresent(props, LocationConstants.PROPERTY_REGION);
      return props;
   }

   protected void deleteAllObjectsInContainer(String regionId, final String containerName) {
      ObjectList objects = api.objectApiInRegionForContainer(regionId, containerName).list(new ListContainerOptions());
      if (objects == null) {
         return;
      }
      List<String> pathsToDelete = Lists.transform(objects, new Function<SwiftObject, String>() {
         public String apply(SwiftObject input) {
View Full Code Here

            responseWithKeystoneAccess, list, listResponse);

      assertEquals(apiWhenContainersExist.getConfiguredRegions(), ImmutableSet.of("region-a.geo-1"));

      assertEquals(apiWhenContainersExist.getContainerApiForRegion("region-a.geo-1").list().toString(),
            new ParseContainerListTest().expected().toString());
   }
View Full Code Here

      SwiftApi apiWhenContainersExist = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
            responseWithKeystoneAccess, list, listResponse);

      assertEquals(
            apiWhenContainersExist.getContainerApiForRegion("region-a.geo-1").list()
                  .toString(), new ParseContainerListTest().expected().toString());
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.swift.v1.functions.ParseObjectFromResponse

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.