use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepositoryIT method testGetThumbnail.
@Test
public void testGetThumbnail() throws Exception {
instance.saveThumbnail(mediaId, dimension, image);
Image result = instance.getThumbnail(mediaId, dimension);
assertThat(result, notNullValue());
assertThat(result.data, is(image.data));
assertThat(result.imageType, is(image.imageType));
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepository method getThumbnail.
@Override
public Image getThumbnail(String mediaId, Dimension dimension) throws DoesNotExistException, TException {
checkMediaId(mediaId);
checkDimension(dimension);
Statement query = createQueryToGetThumbnail(mediaId, dimension);
ResultSet results = tryToExecute(query, "Failed to Query Cassandra for Thumbnail with Media ID: " + mediaId + " Dimension: " + dimension);
checkResultsNotMissing(results);
Row row = results.one();
ensureRowExists(row, mediaId);
Image thumbnail = converRowToImage(row);
return thumbnail;
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepository method getMedia.
@Override
public Image getMedia(String mediaId) throws DoesNotExistException, TException {
checkMediaId(mediaId);
Statement query = createQueryToGetImage(mediaId);
ResultSet results = tryToExecute(query, "Could not query Cassandra for Media with ID:" + mediaId);
checkResultsNotMissing(results);
Row row = results.one();
ensureRowExists(row, mediaId);
Image image = converRowToImage(row);
return image;
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class CassandraMediaRepositoryIT method testGetMedia.
@Test
public void testGetMedia() throws Exception {
instance.saveMedia(mediaId, image);
Image result = instance.getMedia(mediaId);
assertImagesTheSame(result, image);
}
use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.
the class MemoryMediaRepositoryTest method testDeleteThumbnail.
@Test
public void testDeleteThumbnail() throws Exception {
Image thumbnail = Lists.oneOf(thumbnails);
Dimension dimension = thumbnail.getDimension();
instance.saveThumbnail(mediaId, dimension, thumbnail);
instance.deleteThumbnail(mediaId, dimension);
assertThat(instance.containsThumbnail(mediaId, dimension), is(false));
}
Aggregations