コード例 #1
0
  @Test(
      timeOut = 5 * 60 * 1000,
      dependsOnMethods = {"testCreateContainer", "testCreatePublicContainer"})
  public void testListOwnedContainers() throws Exception {

    // Test default listing
    Set<ContainerProperties> response = getApi().listContainers();
    // assertEquals(response.size(), initialContainerCount + 2);// if the
    // containers already
    // exist, this will fail

    // Test listing with options
    response =
        getApi()
            .listContainers(
                ListOptions.Builder.prefix(
                        privateContainer.substring(0, privateContainer.length() - 1))
                    .maxResults(1)
                    .includeMetadata());
    assertEquals(response.size(), 1);
    assertEquals(Iterables.getOnlyElement(response).getName(), privateContainer);
    assertEquals(Iterables.getOnlyElement(response).getMetadata(), ImmutableMap.of("foo", "bar"));

    response = getApi().listContainers(ListOptions.Builder.prefix(publicContainer).maxResults(1));
    assertEquals(response.size(), 1);
    assertEquals(Iterables.getOnlyElement(response).getName(), publicContainer);
  }
コード例 #2
0
  @Test
  public void testListContainersWithOptions() throws Exception {

    BoundedSet<ContainerProperties> response =
        client.listContainers(
            ListOptions.Builder.prefix(privateContainer).maxResults(1).includeMetadata());
    assert null != response;
    long initialContainerCount = response.size();
    assertTrue(initialContainerCount >= 0);
    assertEquals(privateContainer, response.getPrefix());
    assertEquals(1, response.getMaxResults());
  }