Search in sources :

Example 1 with Image

use of tech.aroma.thrift.Image in project aroma-data-operations by RedRoma.

the class CassandraMediaRepositoryTest method testSaveMediaWithBadArgs.

@DontRepeat
@Test
public void testSaveMediaWithBadArgs() throws Exception {
    // Missing media id
    assertThrows(() -> instance.saveMedia("", image)).isInstanceOf(InvalidArgumentException.class);
    // Missing Image
    assertThrows(() -> instance.saveMedia(mediaId, null)).isInstanceOf(InvalidArgumentException.class);
    // bad Id
    assertThrows(() -> instance.saveMedia(badId, image)).isInstanceOf(InvalidArgumentException.class);
    // Empty Image
    Image emptyImage = new Image();
    assertThrows(() -> instance.saveMedia(badId, emptyImage)).isInstanceOf(InvalidArgumentException.class);
}
Also used : Image(tech.aroma.thrift.Image) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 2 with Image

use of tech.aroma.thrift.Image 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 3 with Image

use of tech.aroma.thrift.Image 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 4 with Image

use of tech.aroma.thrift.Image 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 5 with Image

use of tech.aroma.thrift.Image 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)

Aggregations

Image (tech.aroma.thrift.Image)11 Test (org.junit.Test)9 Dimension (tech.aroma.thrift.Dimension)5 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)3 ResultSet (com.datastax.driver.core.ResultSet)2 Row (com.datastax.driver.core.Row)2 Statement (com.datastax.driver.core.Statement)2 DontRepeat (tech.sirwellington.alchemy.test.junit.runners.DontRepeat)1