use of tech.aroma.thrift.Dimension in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testDeleteAllThumbnails.
@Test
public void testDeleteAllThumbnails() throws Exception {
for (Image thumbnail : thumbnails) {
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
assertThat(instance.containsThumbnail(mediaId, dimension), is(true));
}
instance.deleteAllThumbnails(mediaId);
assertThat(instance.containsThumbnail(mediaId, image.getDimension()), is(false));
}
use of tech.aroma.thrift.Dimension in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testSaveThumbnail.
@Test
public void testSaveThumbnail() throws Exception {
Image thumbnail = Lists.oneOf(thumbnails);
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
assertThat(instance.containsThumbnail(mediaId, dimension), is(true));
}
use of tech.aroma.thrift.Dimension in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testGetThumbnail.
@Test
public void testGetThumbnail() throws Exception {
Image thumbnail = Lists.oneOf(thumbnails);
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
Image result = instance.getThumbnail(mediaId, dimension);
assertThat(result, is(thumbnail));
}
use of tech.aroma.thrift.Dimension in project aroma-data-operations by RedRoma.
the class CassandraMediaRepositoryIT method testDeleteAllThumbnails.
@Test
public void testDeleteAllThumbnails() throws Exception {
for (Image thumbnail : thumbnails) {
Dimension dimension = thumbnail.dimension;
instance.saveThumbnail(mediaId, dimension, thumbnail);
}
instance.deleteAllThumbnails(mediaId);
Image oneThumbnail = Lists.oneOf(thumbnails);
assertThat(instance.containsThumbnail(mediaId, oneThumbnail.dimension), is(false));
}
use of tech.aroma.thrift.Dimension in project aroma-data-operations by RedRoma.
the class CassandraMediaRepository method createStatementToSaveImage.
private Statement createStatementToSaveImage(String mediaId, Image image) {
UUID mediaUuid = UUID.fromString(mediaId);
String type = image.imageType != null ? image.imageType.toString() : null;
Dimension dimension = image.dimension != null ? image.dimension : new Dimension();
return QueryBuilder.insertInto(Tables.Media.TABLE_NAME).value(Media.MEDIA_ID, mediaUuid).value(Media.MEDIA_TYPE, type).value(Media.CREATION_TIME, Instant.now().toEpochMilli()).value(Media.BINARY, image.data).value(Media.WIDTH, dimension.width).value(Media.HEIGHT, dimension.height);
}
Aggregations