public void testPrefixStatic() { ListOptions options = ListOptions.Builder.prefix("a"); assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix")); }
public void testPrefixStatic() { ListOptions options = ListOptions.Builder.prefix("a"); assertEquals(ImmutableList.of("a"), options.buildQueryParameters().get("prefix")); }
@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); }
@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); }
@Test public void testListContainersWithOptions() throws Exception { BoundedSet<ContainerProperties> response = getApi().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()); }
@Test public void testListContainersWithOptions() throws Exception { BoundedSet<ContainerProperties> response = getApi().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()); }