use of org.webpieces.googlecloud.storage.api.CopyInterface in project webpieces by deanhiller.
the class TestLocalStorage method testCopyFromClassPath.
@Test
public void testCopyFromClassPath() throws IOException {
String bucketName = "testbucket";
String blobName = "mytest.txt";
String copyBlobName = "mytest_copy.txt";
Storage.CopyRequest request = Storage.CopyRequest.newBuilder().setSource(BlobId.of(bucketName, blobName)).setTarget(BlobId.of(bucketName, copyBlobName)).build();
Page<GCPBlob> testbucket = instance.list("copybucket");
CopyInterface copy = instance.copy(request);
ReadableByteChannel readFile = instance.reader("copybucket", "mytest_copy.txt");
InputStream i = Channels.newInputStream(readFile);
String text = new BufferedReader(new InputStreamReader(i, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
// Passed.
Assert.assertEquals("Some Test", text);
}
Aggregations