public StorageMetadata apply(ContainerProperties from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setLocation(defaultLocation.get()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setUri(from.getUrl()); to.setType(StorageType.CONTAINER); to.setUserMetadata(from.getMetadata()); return to; } }
/** *{@inheritDoc} */ public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); }
@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) public void testCreatePublicContainer() throws Exception { boolean created = false; while (!created) { publicContainer = CONTAINER_PREFIX + containerIndex.incrementAndGet(); try { created = getApi().createContainer(publicContainer, withPublicAccess(PublicAccess.BLOB)); } catch (UndeclaredThrowableException e) { HttpResponseException htpe = (HttpResponseException) e.getCause().getCause(); if (htpe.getResponse().getStatusCode() == 409) continue; throw e; } } ContainerProperties properties = null; for (ContainerProperties p : getApi().listContainers(includeMetadata())) { if (p.getName().equals(publicContainer)) { properties = p; break; } } assertThat(properties.getPublicAccess()).isEqualTo(PublicAccess.BLOB); properties = getApi().getContainerProperties(publicContainer); assertThat(properties.getPublicAccess()).isEqualTo(PublicAccess.BLOB); }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); } /**
@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); }
public StorageMetadata apply(ContainerProperties from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setLocation(defaultLocation.get()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setUri(from.getUrl()); to.setType(StorageType.CONTAINER); to.setUserMetadata(from.getMetadata()); return to; } }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); }
public StorageMetadata apply(ContainerProperties from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setLocation(defaultLocation.get()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setUri(from.getUrl()); to.setType(StorageType.CONTAINER); to.setUserMetadata(from.getMetadata()); return to; } }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); } /**
public StorageMetadata apply(ContainerProperties from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setLocation(defaultLocation.get()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setUri(from.getUrl()); to.setType(StorageType.CONTAINER); to.setUserMetadata(from.getMetadata()); return to; } }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); } /**
public StorageMetadata apply(ContainerProperties from) { MutableStorageMetadata to = new MutableStorageMetadataImpl(); to.setName(from.getName()); to.setLocation(defaultLocation.get()); to.setETag(from.getETag()); to.setLastModified(from.getLastModified()); to.setUri(from.getUrl()); to.setType(StorageType.CONTAINER); to.setUserMetadata(from.getMetadata()); return to; } }
/** *{@inheritDoc} */ public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); } /**
/** *{@inheritDoc} */ public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); }
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); } /**
/** *{@inheritDoc} */ @Override public int compareTo(ContainerProperties o) { return (this == o) ? 0 : getName().compareTo(o.getName()); }