use of org.apache.hop.vfs.s3.s3.vfs.S3FileSystem in project hop by apache.
the class S3FileSystemTest method getTestInstance.
public S3FileSystem getTestInstance() throws Exception {
FileName rootName = mock(FileName.class);
FileSystemOptions fileSystemOptions = new FileSystemOptions();
return new S3FileSystem(rootName, fileSystemOptions);
}
use of org.apache.hop.vfs.s3.s3.vfs.S3FileSystem in project hop by apache.
the class S3FileSystemTest method getPartSize.
@Test
public void getPartSize() throws Exception {
S3FileSystem s3FileSystem = getTestInstance();
s3FileSystem.storageUnitConverter = new StorageUnitConverter();
S3HopProperty s3HopProperty = mock(S3HopProperty.class);
when(s3HopProperty.getPartSize()).thenReturn("6MB");
s3FileSystem.s3HopProperty = s3HopProperty;
// TEST 1: Below max
assertEquals(6 * 1024 * 1024, s3FileSystem.getPartSize());
// TEst 2: above max
when(s3HopProperty.getPartSize()).thenReturn("600GB");
assertEquals(Integer.MAX_VALUE, s3FileSystem.getPartSize());
}
use of org.apache.hop.vfs.s3.s3.vfs.S3FileSystem in project hop by apache.
the class S3FileSystemTest method testConvertToInt.
@Test
public void testConvertToInt() throws Exception {
S3FileSystem s3FileSystem = getTestInstance();
// TEST 1: below int max
assertEquals(10, s3FileSystem.convertToInt(10L));
// TEST 2: at int max
assertEquals(Integer.MAX_VALUE, s3FileSystem.convertToInt((long) Integer.MAX_VALUE));
// TEST 3: above int max
assertEquals(Integer.MAX_VALUE, s3FileSystem.convertToInt(5L * 1024L * 1024L * 1024L));
}
Aggregations