Search in sources :

Example 1 with SeriesRef

use of org.atlasapi.content.SeriesRef in project atlas-deer by atlasapi.

the class CqlContentGenerator method makeBrand.

private static Brand makeBrand() {
    Brand brand = new Brand();
    setContainerFields(brand);
    brand.setSeriesRefs(ImmutableList.of(new SeriesRef(Id.valueOf(2322), Publisher.C4, "title", 32, DateTime.now(DateTimeZone.UTC), 2015, ImmutableList.of(new Certificate("some kind of class", Countries.FR)))));
    return brand;
}
Also used : Brand(org.atlasapi.content.Brand) SeriesRef(org.atlasapi.content.SeriesRef) Certificate(org.atlasapi.content.Certificate)

Example 2 with SeriesRef

use of org.atlasapi.content.SeriesRef in project atlas-deer by atlasapi.

the class ItemDisplayTitleWriterTest method testEpisodeWithoutContainerButWithSeriesIsHandledGracefully.

// This should never happen
@Test
public void testEpisodeWithoutContainerButWithSeriesIsHandledGracefully() throws Exception {
    Episode entity = new Episode();
    entity.setSpecial(false);
    entity.setContainerSummary(null);
    entity.setSeriesRef(new SeriesRef(Id.valueOf(1L), Publisher.METABROADCAST, "Series Title", 24, new DateTime(), null, null));
    entity.setEpisodeNumber(42);
    entity.setTitle("Sausages");
    titleWriter.write(entity, fieldWriter, outputContext);
    verifyTitle("Sausages");
    verifySubtitle(null);
}
Also used : Episode(org.atlasapi.content.Episode) SeriesRef(org.atlasapi.content.SeriesRef) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 3 with SeriesRef

use of org.atlasapi.content.SeriesRef in project atlas-deer by atlasapi.

the class ItemDisplayTitleWriterTest method testEpisodeWithContainerAndSeriesWithTitleAndTitleAndEpisodeNumberHasContainerTitleAndSeriesPrefixedSubtitle.

@Test
public void testEpisodeWithContainerAndSeriesWithTitleAndTitleAndEpisodeNumberHasContainerTitleAndSeriesPrefixedSubtitle() throws Exception {
    Episode entity = new Episode();
    entity.setSpecial(false);
    entity.setContainerSummary(ContainerSummary.create("brand", "Brand Title", "Brand Desc", null, null));
    entity.setSeriesRef(new SeriesRef(Id.valueOf(1L), Publisher.METABROADCAST, "Series Title", 24, new DateTime(), null, null));
    entity.setEpisodeNumber(42);
    entity.setTitle("Sausages");
    titleWriter.write(entity, fieldWriter, outputContext);
    verifyTitle(entity.getContainerSummary().getTitle());
    verifySubtitle("Series Title, Episode 42: Sausages");
}
Also used : Episode(org.atlasapi.content.Episode) SeriesRef(org.atlasapi.content.SeriesRef) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 4 with SeriesRef

use of org.atlasapi.content.SeriesRef in project atlas-deer by atlasapi.

the class ItemDisplayTitleWriterTest method testEpisodeWithContainerAndSeriesWithNumberAndTitleAndEpisodeNumberHasContainerTitleAndSeriesNumberPrefixedSubtitle.

@Test
public void testEpisodeWithContainerAndSeriesWithNumberAndTitleAndEpisodeNumberHasContainerTitleAndSeriesNumberPrefixedSubtitle() throws Exception {
    Episode entity = new Episode();
    entity.setSpecial(false);
    entity.setContainerSummary(ContainerSummary.create("brand", "Brand Title", "Brand Desc", null, null));
    entity.setSeriesRef(new SeriesRef(Id.valueOf(1L), Publisher.METABROADCAST, null, 24, new DateTime(), null, null));
    entity.setEpisodeNumber(42);
    entity.setTitle("Sausages");
    titleWriter.write(entity, fieldWriter, outputContext);
    verifyTitle(entity.getContainerSummary().getTitle());
    verifySubtitle("Series 24, Episode 42: Sausages");
}
Also used : Episode(org.atlasapi.content.Episode) SeriesRef(org.atlasapi.content.SeriesRef) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 5 with SeriesRef

use of org.atlasapi.content.SeriesRef in project atlas-deer by atlasapi.

the class ItemDisplayTitleWriterTest method testEpisodeWithPartTitle.

@Test
public void testEpisodeWithPartTitle() throws Exception {
    Episode entity = new Episode();
    entity.setSpecial(false);
    entity.setContainerSummary(ContainerSummary.create("brand", "Silent Witness", "Shhh", null, null));
    entity.setSeriesRef(new SeriesRef(Id.valueOf(1L), Publisher.METABROADCAST, "Series 17", 17, new DateTime(), null, null));
    entity.setEpisodeNumber(5);
    entity.setTitle("Fraternity Part 2");
    titleWriter.write(entity, fieldWriter, outputContext);
    verifyTitle("Silent Witness");
    verifySubtitle("Series 17, Episode 5: Fraternity Part 2");
}
Also used : Episode(org.atlasapi.content.Episode) SeriesRef(org.atlasapi.content.SeriesRef) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Aggregations

SeriesRef (org.atlasapi.content.SeriesRef)21 Episode (org.atlasapi.content.Episode)10 DateTime (org.joda.time.DateTime)9 Test (org.junit.Test)7 ContainerRef (org.atlasapi.content.ContainerRef)6 BatchStatement (com.datastax.driver.core.BatchStatement)4 Id (org.atlasapi.entity.Id)4 Statement (com.datastax.driver.core.Statement)3 Certificate (org.atlasapi.content.Certificate)3 ResourceUpdatedMessage (org.atlasapi.messaging.ResourceUpdatedMessage)3 Broadcast (org.atlasapi.content.Broadcast)2 ContainerSummary (org.atlasapi.content.ContainerSummary)2 Content (org.atlasapi.content.Content)2 WriteResult (org.atlasapi.entity.util.WriteResult)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 MapStream (com.codepoetics.protonpack.maps.MapStream)1 ConsistencyLevel (com.datastax.driver.core.ConsistencyLevel)1 Session (com.datastax.driver.core.Session)1 Mapper (com.datastax.driver.mapping.Mapper)1 MappingManager (com.datastax.driver.mapping.MappingManager)1