@@ -0,0 +1,1924 @@
+/*%0A * The Alluxio Open Foundation licenses this work under the Apache License, version 2.0%0A * (the %22License%22). You may not use this work except in compliance with the License, which is%0A * available at www.apache.org/licenses/LICENSE-2.0%0A *%0A * This software is distributed on an %22AS IS%22 basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,%0A * either express or implied, as more fully set forth in the License.%0A *%0A * See the NOTICE file distributed with this work for information regarding copyright ownership.%0A */%0A%0Apackage alluxio.underfs.s3a;%0A%0Aimport com.amazonaws.services.s3.model.ObjectMetadata;%0Aimport com.amazonaws.services.s3.model.PutObjectRequest;%0Aimport com.amazonaws.services.s3.transfer.TransferManager;%0Aimport com.amazonaws.services.s3.transfer.Upload;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mockito;%0A%0Aimport java.io.File;%0A%0A/**%0A * Unit tests for the %7B@link S3ADirectOutputStream%7D.%0A */%0Apublic class S3ADirectOutputStreamTest %7B%0A  private static final String BUCKET_NAME = %22testBucket%22;%0A  private static final String KEY = %22testKey%22;%0A%0A  private File mFile;%0A  private TransferManager mManager;%0A  private S3ADirectOutputStream mStream;%0A%0A  /**%0A   * Sets the properties and configuration before each test runs.%0A   */%0A  @Before%0A  public void before() throws Exception %7B%0A    mFile = Mockito.mock(File.class);%0A    mManager = Mockito.mock(TransferManager.class);%0A    Upload result = Mockito.mock(Upload.class);%0A%0A    Mockito.when(mManager.upload(Mockito.any(PutObjectRequest.class))).thenReturn(result);%0A    mStream = new S3ADirectOutputStream(BUCKET_NAME, KEY, mManager);%0A  %7D%0A%0A  /**%0A   * Tests to ensure the permanent file path is used when upload is called.%0A   */%0A  @Test%0A  public void close() throws Exception %7B%0A    mStream.close();%0A    Mockito.verify(mManager).upload(%0A        new PutObjectRequest(BUCKET_NAME, KEY, mFile).withMetadata(Mockito%0A            .any(ObjectMetadata.class)));%0A  %7D%0A%7D%0A

Add a test for s3a direct output stream.