Package org.jclouds.openstack.swift.v1.domain

Examples of org.jclouds.openstack.swift.v1.domain.Account


   }

   public void listOptions() throws Exception {
      String lexicographicallyBeforeName = name.substring(0, name.length() - 1);
      for (String regionId : regions) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName)
               .list(marker(lexicographicallyBeforeName)).get(0);
         assertEquals(object.name(), name);
         checkObject(object);
      }
   }
View Full Code Here


         assertTrue(objectApi.updateMetadata(name, meta));
         containerHasMetadata(objectApi, name, meta);

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

         }
      }
   }

   static void containerHasMetadata(ObjectApi objectApi, String name, Map<String, String> meta) {
      SwiftObject object = objectApi.head(name);
      for (Entry<String, String> entry : meta.entrySet()) {
         // note keys are returned in lower-case!
         assertEquals(object.metadata().get(entry.getKey().toLowerCase()), entry.getValue(), //
               object + " didn't have metadata: " + entry);
      }
   }
View Full Code Here

   private String name = getClass().getSimpleName();
   private String containerName = getClass().getSimpleName() + "Container";

   public void signForPublicAccess() throws Exception {
      for (String regionId : api.configuredRegions()) {
         SwiftObject object = api.objectApiInRegionForContainer(regionId, containerName).head(name);

         long expires = System.currentTimeMillis() / 1000 + 5;
         String signature = TemporaryUrlSigner.checkApiEvery(api.accountApiInRegion(regionId), 5) //
               .sign("GET", object.uri().getPath(), expires);

         URI signed = URI.create(format("%s?temp_url_sig=%s&temp_url_expires=%s", object.uri(), signature, expires));

         InputStream publicStream = signed.toURL().openStream();
         assertEquals(Strings2.toStringAndClose(publicStream), "swifty");

         // let it expire
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

            .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.domain.Account

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.