use of cz.o2.proxima.direct.s3.S3BlobPath.S3Blob in project proxima-platform by O2-Czech-Republic.
the class S3BlobPathTest method testBlobGetSizeOnException.
@Test
public void testBlobGetSizeOnException() {
final S3FileSystem fs = Mockito.mock(S3FileSystem.class, Mockito.RETURNS_DEEP_STUBS);
Mockito.when(fs.getObject(Mockito.any())).thenThrow(new IllegalStateException());
final S3Blob blob = new S3Blob("name", fs);
Assert.assertEquals(0L, blob.getSize());
}
use of cz.o2.proxima.direct.s3.S3BlobPath.S3Blob in project proxima-platform by O2-Czech-Republic.
the class S3BlobPathTest method testBlobGetSize.
@Test
public void testBlobGetSize() {
final S3FileSystem fs = Mockito.mock(S3FileSystem.class);
final ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(1337L);
final S3Object object = new S3Object();
object.setObjectMetadata(objectMetadata);
Mockito.when(fs.getObject(Mockito.eq("name"))).thenReturn(object);
final S3Blob blob = new S3Blob("name", fs);
Assert.assertEquals(1337L, blob.getSize());
}
use of cz.o2.proxima.direct.s3.S3BlobPath.S3Blob in project proxima-platform by O2-Czech-Republic.
the class S3BlobPathTest method testSerializable.
@Test
public void testSerializable() throws IOException, ClassNotFoundException {
Context context = op.getContext();
S3FileSystem fs = new S3FileSystem(new S3Accessor(TestUtils.createTestFamily(entity, URI.create("s3://bucket"), S3FileSystemTest.cfg())), context);
S3BlobPath path = new S3BlobPath(context, fs, new S3Blob("name", fs));
S3BlobPath path2 = TestUtils.assertSerializable(path);
TestUtils.assertHashCodeAndEquals(path, path2);
}
Aggregations