Package org.jclouds.openstack.swift.v1.options

Examples of org.jclouds.openstack.swift.v1.options.UpdateContainerOptions


   }

   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

   public void testUpdate() throws Exception {
      for (String regionId : regions) {
         ImmutableMultimap<String, String> headers =
               ImmutableMultimap.of(SwiftHeaders.STATIC_WEB_INDEX, "__index.html",
                                    SwiftHeaders.STATIC_WEB_ERROR, "__error.html");
         UpdateContainerOptions opts = new UpdateContainerOptions().headers(headers);

         assertNotNull(api.getContainerApiForRegion(regionId).create(name));

         Container container = api.getContainerApiForRegion(regionId).get(name);
         assertNotNull(container);
View Full Code Here

      System.out.format("Enable CDN%n");
      Multimap<String, String> enableStaticWebHeaders =
            ImmutableMultimap.of(STATIC_WEB_INDEX, "index.html",
                                 STATIC_WEB_ERROR, "error.html");

      UpdateContainerOptions opts = new UpdateContainerOptions().headers(enableStaticWebHeaders);
      cloudFiles.getContainerApiForRegion(REGION).update(container, opts);

      // enable the CDN container
      URI cdnURI = cloudFiles.getCDNApiForRegion(REGION).enable(container);
      System.out.format("  Go to %s/%n", cdnURI);
View Full Code Here

   public void testUpdate() throws Exception {
      for (String regionId : regions) {
         ImmutableMultimap<String, String> headers =
               ImmutableMultimap.of(SwiftHeaders.STATIC_WEB_INDEX, "__index.html",
                                    SwiftHeaders.STATIC_WEB_ERROR, "__error.html");
         UpdateContainerOptions opts = new UpdateContainerOptions().headers(headers);

         assertNotNull(api.getContainerApi(regionId).create(name));

         Container container = api.getContainerApi(regionId).get(name);
         assertNotNull(container);
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.options.UpdateContainerOptions

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.