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

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


               String path = command.getCurrentRequest().getEndpoint().getPath();
               int startOfDestinationPath = path.lastIndexOf("/", path.lastIndexOf("/") - 1);
               // get the "/destContainer/destObject" portion of the path
               String destinationPath = path.substring(startOfDestinationPath);
              
               exception = new CopyObjectException(sourcePath, destinationPath, message);
               exception.initCause(oldException);
            } else if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               String path = command.getCurrentRequest().getEndpoint().getPath();
               Matcher matcher = CONTAINER_PATH.matcher(path);
              
View Full Code Here


      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201).setBody("{\"Number Files Created\": 10, \"Errors\": []}")));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ExtractArchiveResponse response = api.bulkApiInRegion("DFW").extractArchive("myContainer",
               newByteArrayPayload(tarGz), "tar.gz");
         assertEquals(response.created(), 10);
         assertTrue(response.errors().isEmpty());

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

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setBody(containerList)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ImmutableList<Container> containers = api.containerApiInRegion("DFW").listFirstPage().toList();
         assertEquals(containers, ImmutableList.of(//
               Container.builder() //
                     .name("test_container_1") //
                     .objectCount(2) //
                     .bytesUsed(78).build(), //
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setBody(containerList)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         ImmutableList<Container> containers = api.containerApiInRegion("DFW").listAt("test").toList();
         assertEquals(containers, ImmutableList.of(//
               Container.builder() //
                     .name("test_container_1") //
                     .objectCount(2) //
                     .bytesUsed(78).build(), //
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertTrue(api.containerApiInRegion("DFW").createIfAbsent("myContainer", CreateContainerOptions.NONE));

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

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(201)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertTrue(api.containerApiInRegion("DFW").createIfAbsent("myContainer", anybodyRead().metadata(metadata)));

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

            .addHeader("X-Auth-Token", authToken).build();

      HttpResponse listResponse = HttpResponse.builder().statusCode(200)
            .payload(payloadFromResource("/container_list.json")).build();

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

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

            .addHeader("Accept", "application/json")
            .addHeader("X-Auth-Token", authToken).build();

      HttpResponse listResponse = HttpResponse.builder().statusCode(404).build();

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

      assertEquals(apiWhenNoContainersExist.getContainerApiForRegion("region-a.geo-1").list().toSet(),
               ImmutableSet.of());

   }
View Full Code Here

      HttpResponse listResponse = HttpResponse.builder().statusCode(204)
            .addHeader("X-Account-Container-Count", "3")
            .addHeader("X-Account-Bytes-Used", "323479").build();

      SwiftApi apiWhenExists = requestsSendResponses(keystoneAuthWithUsernameAndPassword,
            responseWithKeystoneAccess, get, listResponse);

      assertEquals(
            apiWhenExists.getAccountApiForRegion("region-a.geo-1").get(),
            Account.builder().containerCount(3).bytesUsed(323479).build());
   }
View Full Code Here

      MockWebServer server = mockOpenStackServer();
      server.enqueue(addCommonHeaders(new MockResponse().setBody(stringFromResource("/access.json"))));
      server.enqueue(addCommonHeaders(new MockResponse().setResponseCode(202)));

      try {
         SwiftApi api = api(server.getUrl("/").toString(), "openstack-swift");
         assertFalse(api.containerApiInRegion("DFW").createIfAbsent("myContainer", CreateContainerOptions.NONE));

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

TOP

Related Classes of org.jclouds.openstack.swift.v1.options.ListContainerOptions

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.