@Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, KeystoneProperties.CREDENTIAL_TYPE); return props; }
@Test @Parameters( { "jclouds.blobstore.httpstream.url", "jclouds.blobstore.httpstream.md5" }) public void testCopyUrl(@Optional String httpStreamUrl, @Optional String httpStreamMD5) throws Exception { httpStreamUrl = checkNotNull(httpStreamUrl != null ? httpStreamUrl : sysHttpStreamUrl, "httpStreamUrl"); httpStreamMD5 = checkNotNull(httpStreamMD5 != null ? httpStreamMD5 : sysHttpStreamMD5, "httpStreamMd5"); HttpResponse response = view.utils().http().invoke(HttpRequest.builder().method("GET").endpoint(httpStreamUrl).build()); long length = response.getPayload().getContentMetadata().getContentLength(); String name = "hello"; byte[] md5 = base16().lowerCase().decode(httpStreamMD5); Blob blob = view.getBlobStore().blobBuilder(name).payload(response.getPayload()).contentLength(length) .contentMD5(md5).build(); String container = getContainerName(); try { view.getBlobStore().putBlob(container, blob); checkMD5(container, name, md5); } finally { returnContainer(container); } }
@Override public void testCopyUrl(@Optional String httpStreamUrl, @Optional String httpStreamMD5) throws Exception { try { super.testCopyUrl(httpStreamUrl, httpStreamMD5); failBecauseExceptionWasNotThrown(IllegalArgumentException.class); } catch (IllegalArgumentException iae) { throw new SkipException("B2 requires repeatable payloads to calculate SHA1 hash", iae); } } }
@Test @Parameters( { "jclouds.blobstore.httpstream.url", "jclouds.blobstore.httpstream.md5" }) public void testCopyUrl(@Optional String httpStreamUrl, @Optional String httpStreamMD5) throws Exception { httpStreamUrl = checkNotNull(httpStreamUrl != null ? httpStreamUrl : sysHttpStreamUrl, "httpStreamUrl"); httpStreamMD5 = checkNotNull(httpStreamMD5 != null ? httpStreamMD5 : sysHttpStreamMD5, "httpStreamMd5"); HttpResponse response = view.utils().http().invoke(HttpRequest.builder().method("GET").endpoint(httpStreamUrl).build()); long length = response.getPayload().getContentMetadata().getContentLength(); String name = "hello"; byte[] md5 = base16().lowerCase().decode(httpStreamMD5); Blob blob = view.getBlobStore().blobBuilder(name).payload(response.getPayload()).contentLength(length) .contentMD5(md5).build(); String container = getContainerName(); try { view.getBlobStore().putBlob(container, blob); checkMD5(container, name, md5); } finally { returnContainer(container); } }
@Override protected Properties setupProperties() { Properties props = super.setupProperties(); setIfTestSystemPropertyPresent(props, CREDENTIAL_TYPE); return props; } }
@Override protected Properties setupProperties() { TestProperties.setGoogleCredentialsFromJson(provider); return TestProperties.apply(provider, super.setupProperties()); }