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

Examples of org.jclouds.openstack.swift.v1.functions.ParseObjectListFromResponse$InternalObject


            // note silly casing
            .addHeader("X-Object-Meta-Apiname", "swift") //
            .addHeader("X-Object-Meta-Apiversion", "v1.1"));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         SwiftObject object = api.objectApiInRegionForContainer("DFW", "myContainer").get("myObject", tail(1));
         assertEquals(object.name(), "myObject");
         assertEquals(object.etag(), "8a964ee2a5e88be344f36c22562a6486");
         assertEquals(object.lastModified(), dates.rfc822DateParse("Fri, 12 Jun 2010 13:40:18 GMT"));
         for (Entry<String, String> entry : object.metadata().entrySet()) {
            assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue());
View Full Code Here


      server.enqueue(objectResponse() //
            .addHeader("X-Object-Meta-ApiName", "swift") //
            .addHeader("X-Object-Meta-ApiVersion", "v1.1"));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertTrue(api.objectApiInRegionForContainer("DFW", "myContainer").updateMetadata("myObject", metadata));

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         RecordedRequest replaceRequest = server.takeRequest();
         assertEquals(replaceRequest.getRequestLine(),
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(objectResponse());

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertTrue(api.objectApiInRegionForContainer("DFW", "myContainer").deleteMetadata("myObject", metadata));

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         RecordedRequest deleteRequest = server.takeRequest();
         assertEquals(deleteRequest.getRequestLine(),
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(204));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         api.objectApiInRegionForContainer("DFW", "myContainer").delete("myObject");

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         RecordedRequest deleteRequest = server.takeRequest();
         assertEquals(deleteRequest.getRequestLine(),
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(new MockResponse().setBody(accessRackspace));
      server.enqueue(new MockResponse().setResponseCode(404));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         api.objectApiInRegionForContainer("DFW", "myContainer").delete("myObject");

         assertEquals(server.getRequestCount(), 2);
         assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
         RecordedRequest deleteRequest = server.takeRequest();
         assertEquals(deleteRequest.getRequestLine(),
View Full Code Here

               return Optional.fromNullable(api.containerApiInRegion(region.getId()).get(container));
            }
         });

   protected Function<SwiftObject, MutableBlobMetadata> toBlobMetadata(String container) {
      return new ToBlobMetadata(containerCache.getUnchecked(container).get());
   }
View Full Code Here

         @Memoized Supplier<Set<? extends Location>> locations, @Assisted String regionId) {
      checkNotNull(regionId, "regionId");
      Optional<? extends Location> found = tryFind(locations.get(), idEquals(regionId));
      checkArgument(found.isPresent(), "region %s not in %s", regionId, locations.get());
      this.region = found.get();
      this.toResourceMetadata = new ToResourceMetadata(found.get());
      this.context = context;
      this.api = api;
      // until we parameterize ClearListStrategy with a factory
      this.clearList = baseGraph.createChildInjector(new AbstractModule() {
         @Override
View Full Code Here

   @Test
   public void testGetAccountMetadata() throws Exception {
      for (String regionId : api.getConfiguredRegions()) {
         AccountApi accountApi = api.getAccountApiForRegion(regionId);
         Account account = accountApi.get();
         assertNotNull(account);
         assertTrue(account.getContainerCount() >= 0);
         assertTrue(account.getBytesUsed() >= 0);
      }
   }
View Full Code Here

public class AccountApiLiveTest extends BaseSwiftApiLiveTest {

   public void get() throws Exception {
      for (String regionId : regions) {
         AccountApi accountApi = api.accountApiInRegion(regionId);
         Account account = accountApi.get();

         assertNotNull(account);
         assertTrue(account.containerCount() >= 0);
         assertTrue(account.objectCount() >= 0);
         assertTrue(account.bytesUsed() >= 0);
      }
   }
View Full Code Here

         assertTrue(accountApi.updateMetadata(meta));
         accountHasMetadata(accountApi, meta);

         assertTrue(accountApi.deleteMetadata(meta));
         Account account = accountApi.get();
         for (Entry<String, String> entry : meta.entrySet()) {
            // note keys are returned in lower-case!
            assertFalse(account.metadata().containsKey(entry.getKey().toLowerCase()));
         }
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.swift.v1.functions.ParseObjectListFromResponse$InternalObject

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.