Search in sources :

Example 1 with Dimension

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));
}
Also used : Dimension(tech.aroma.thrift.Dimension) Image(tech.aroma.thrift.Image) Test(org.junit.Test)

Example 2 with Dimension

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));
}
Also used : Dimension(tech.aroma.thrift.Dimension) Image(tech.aroma.thrift.Image) Test(org.junit.Test)

Example 3 with Dimension

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));
}
Also used : Dimension(tech.aroma.thrift.Dimension) Image(tech.aroma.thrift.Image) Test(org.junit.Test)

Example 4 with Dimension

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));
}
Also used : Dimension(tech.aroma.thrift.Dimension) Image(tech.aroma.thrift.Image) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest) Test(org.junit.Test)

Example 5 with Dimension

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);
}
Also used : StringAssertions.nonEmptyString(tech.sirwellington.alchemy.arguments.assertions.StringAssertions.nonEmptyString) Dimension(tech.aroma.thrift.Dimension) StringAssertions.validUUID(tech.sirwellington.alchemy.arguments.assertions.StringAssertions.validUUID) UUID(java.util.UUID)

Aggregations

Dimension (tech.aroma.thrift.Dimension)6 Test (org.junit.Test)5 Image (tech.aroma.thrift.Image)5 UUID (java.util.UUID)1 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)1 StringAssertions.nonEmptyString (tech.sirwellington.alchemy.arguments.assertions.StringAssertions.nonEmptyString)1 StringAssertions.validUUID (tech.sirwellington.alchemy.arguments.assertions.StringAssertions.validUUID)1