@Test public void flush() throws Exception { int partSize = (int) FormatUtils.parseSpaceSize(PARTITION_SIZE); byte[] b = new byte[2 * partSize - 1]; mStream.write(b, 0, b.length); Mockito.verify(mMockS3Client) .initiateMultipartUpload(any(InitiateMultipartUploadRequest.class)); Mockito.verify(mMockOutputStream).write(b, 0, partSize); Mockito.verify(mMockOutputStream).write(b, partSize, partSize - 1); Mockito.verify(mMockExecutor).submit(any(Callable.class)); mStream.flush(); Mockito.verify(mMockExecutor, times(2)).submit(any(Callable.class)); Mockito.verify(mMockTag, times(2)).get(); mStream.close(); Mockito.verify(mMockS3Client) .completeMultipartUpload(any(CompleteMultipartUploadRequest.class)); }
@Override public void flush() throws IOException { if (mUploadId == null) { return; } if (mLocalOutputStream != null) { mLocalOutputStream.flush(); } if (mPartitionOffset > UPLOAD_THRESHOLD) { uploadPart(); } waitForAllPartsUpload(); }
S3ALowLevelOutputStream extends OutputStream { @Override public void flush() throws IOException { if (mUploadId == null) { return; } if (mLocalOutputStream != null) { mLocalOutputStream.flush(); } if (mPartitionOffset > UPLOAD_THRESHOLD) { uploadPart(); } waitForAllPartsUpload(); } }
S3ALowLevelOutputStream extends OutputStream { @Override public void flush() throws IOException { if (mUploadId == null) { return; } if (mLocalOutputStream != null) { mLocalOutputStream.flush(); } if (mPartitionOffset > UPLOAD_THRESHOLD) { uploadPart(); } waitForAllPartsUpload(); } S3ALowLevelOutputStream(String bucketName, String key, AmazonS3 s3Client,
      ListeningExecutorService executor, long streamingUploadPartitionSize, List<String> tmpDirs,
      boolean sseEnabled); }
S3ALowLevelOutputStream extends OutputStream { @Override public void flush() throws IOException { if (mUploadId == null) { return; } if (mLocalOutputStream != null) { mLocalOutputStream.flush(); } if (mPartitionOffset > UPLOAD_THRESHOLD) { uploadPart(); } waitForAllPartsUpload(); } S3ALowLevelOutputStream(String bucketName, String key, AmazonS3 s3Client,
      ListeningExecutorService executor, long streamingUploadPartitionSize, List<String> tmpDirs,
      boolean sseEnabled); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close(); }
S3ALowLevelOutputStream extends OutputStream { @Override public void flush() throws IOException { if (mUploadId == null) { return; } if (mLocalOutputStream != null) { mLocalOutputStream.flush(); } if (mPartitionOffset > UPLOAD_THRESHOLD) { uploadPart(); } waitForAllPartsUpload(); } S3ALowLevelOutputStream(String bucketName, String key, AmazonS3 s3Client,
      ListeningExecutorService executor, long streamingUploadPartitionSize, List<String> tmpDirs,
      boolean sseEnabled); @Override void write(int b); @Override void write(byte[] b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override void close();  }