public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); this.tier = from.getTier() == null ? Tier.STANDARD : from.getTier(); }
public MutableBlobMetadataImpl(BlobMetadata from) { super(from); this.contentMetadata = new BaseMutableContentMetadata(); HttpUtils.copy(from.getContentMetadata(), this.contentMetadata); this.publicUri = from.getPublicUri(); this.container = from.getContainer(); this.tier = from.getTier() == null ? Tier.STANDARD : from.getTier(); }
@Test(groups = "live") public void testPublicAccess() throws InterruptedException, MalformedURLException, IOException { final String containerName = getScratchContainerName(); try { view.getBlobStore().createContainerInLocation(null, containerName, publicRead()); assertConsistencyAwareContainerExists(containerName); defaultLocation = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() { @Override public boolean apply(@Nullable StorageMetadata input) { return input.getName().equals(containerName); } }).getLocation(); view.getBlobStore().putBlob(containerName, view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build()); assertConsistencyAwareContainerSize(containerName, 1); BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello"); assertNotNull(metadata.getPublicUri(), metadata.toString()); SocketOpen socketOpen = context.utils().injector().getInstance(SocketOpen.class); Predicate<HostAndPort> socketTester = retry(socketOpen, 60, 5, SECONDS); int port = metadata.getPublicUri().getPort(); HostAndPort hostAndPort = HostAndPort.fromParts(metadata.getPublicUri().getHost(), port != -1 ? port : 80); assertTrue(socketTester.apply(hostAndPort), metadata.getPublicUri().toString()); assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING); } finally { // this container is now public, so we can't reuse it directly recycleContainerAndAddToPool(containerName); } }
@Override public BlobMetadata apply(@Nullable org.jclouds.blobstore.domain.BlobMetadata input) { if (input == null) { return null; } return BlobMetadata.builder() .publicUri(input.getPublicUri()).type(input.getType().name()).providerId(input.getProviderId()) .name(input.getName()).uri(input.getUri()).userMetadata(input.getUserMetadata()) .eTag(input.getETag()).creationDate(input.getCreationDate()).lastModifiedDate(input.getLastModified()) .content(ToContentContentMetadata.INSTANCE.apply(input.getContentMetadata())) .build(); } }
@Test(groups = "live") public void testPublicAccess() throws InterruptedException, MalformedURLException, IOException { final String containerName = getScratchContainerName(); try { view.getBlobStore().createContainerInLocation(null, containerName, publicRead()); assertConsistencyAwareContainerExists(containerName); defaultLocation = Iterables.find(view.getBlobStore().list(), new Predicate<StorageMetadata>() { @Override public boolean apply(@Nullable StorageMetadata input) { return input.getName().equals(containerName); } }).getLocation(); view.getBlobStore().putBlob(containerName, view.getBlobStore().blobBuilder("hello").payload(TEST_STRING).build()); assertConsistencyAwareContainerSize(containerName, 1); BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, "hello"); assert metadata.getPublicUri() != null : metadata; assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), TEST_STRING); } finally { // this container is now public, so we can't reuse it directly recycleContainer(containerName); } }
private void runCreateContainerInLocation(String payload, Location nonDefault) throws InterruptedException, IOException { String blobName = "hello"; BlobStore blobStore = view.getBlobStore(); final String containerName = getScratchContainerName(); try { Logger.getAnonymousLogger().info( String.format("creating public container %s in location %s", containerName, nonDefault.getId())); blobStore.createContainerInLocation(nonDefault, containerName, publicRead()); assertConsistencyAwareContainerExists(containerName); assertConsistencyAwareContainerInLocation(containerName, nonDefault); blobStore.putBlob(containerName, blobStore.blobBuilder(blobName).payload(payload).build()); assertConsistencyAwareContainerSize(containerName, 1); BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, blobName); assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), payload); assertConsistencyAwareBlobInLocation(containerName, blobName, nonDefault); } finally { // this container is now public, so we can't reuse it directly recycleContainer(containerName); } }
private void runCreateContainerInLocation(String payload, Location nonDefault) throws InterruptedException, IOException { String blobName = "hello"; BlobStore blobStore = view.getBlobStore(); final String containerName = getScratchContainerName(); try { Logger.getAnonymousLogger().info( String.format("creating public container %s in location %s", containerName, nonDefault.getId())); blobStore.createContainerInLocation(nonDefault, containerName, publicRead()); assertConsistencyAwareContainerExists(containerName); assertConsistencyAwareContainerInLocation(containerName, nonDefault); blobStore.putBlob(containerName, blobStore.blobBuilder(blobName).payload(payload).build()); assertConsistencyAwareContainerSize(containerName, 1); BlobMetadata metadata = view.getBlobStore().blobMetadata(containerName, blobName); assertEquals(Strings2.toStringAndClose(view.utils().http().get(metadata.getPublicUri())), payload); assertConsistencyAwareBlobInLocation(containerName, blobName, nonDefault); } finally { // this container is now public, so we can't reuse it directly recycleContainerAndAddToPool(containerName); } } }