@Test public void testMergesImagesAndDescriptionsForHDAndSD() { BtVodEntry btVodEntrySD = filmRow("About Alex"); btVodEntrySD.setProductTargetBandwidth("SD"); btVodEntrySD.setDescription("sd"); btVodEntrySD.setProductLongDescription("sdLong"); BtVodEntry btVodEntryHD = filmRow("About Alex - HD"); btVodEntryHD.setGuid(PRODUCT_GUID + "_HD"); btVodEntryHD.setProductTargetBandwidth("HD"); btVodEntryHD.setDescription("hd"); btVodEntryHD.setProductLongDescription("hdLong"); Image sdImage = new Image("sdImage"); Image hdImage = new Image("hdImage"); when(imageExtractor.imagesFor(btVodEntrySD)).thenReturn(ImmutableSet.of(sdImage)); when(imageExtractor.imagesFor(btVodEntryHD)).thenReturn(ImmutableSet.of(hdImage)); when(btVodBrandProvider.brandRefFor(btVodEntrySD)).thenReturn(Optional.<ParentRef>absent()); when(btVodBrandProvider.brandRefFor(btVodEntryHD)).thenReturn(Optional.<ParentRef>absent()); when(seriesProvider.seriesFor(btVodEntryHD)).thenReturn(Optional.<Series>absent()); when(seriesProvider.seriesFor(btVodEntrySD)).thenReturn(Optional.<Series>absent()); itemExtractor.process(btVodEntrySD); itemExtractor.process(btVodEntryHD); Item item = Iterables.get(itemExtractor.getProcessedItems().values(), 0); verify(descriptionAndImageUpdater) .updateDescriptionsAndImages( eq(item), eq(btVodEntryHD), eq(ImmutableSet.of(hdImage)), anySet()); }
private BtVodEntry episodeRow(String title, String guid) { BtVodEntry entry = new BtVodEntry(); entry.setGuid(guid); entry.setId(PRODUCT_ID); entry.setTitle(title); entry.setProductOfferStartDate(1364774400000L); // "Apr 1 2013 12:00AM" entry.setProductOfferEndDate(1398816000000L); // "Apr 30 2014 12:00AM" entry.setDescription(SYNOPSIS); entry.setProductType("episode"); entry.setProductPricingPlan(new BtVodProductPricingPlan()); entry.setProductTrailerMediaId(TRAILER_URI); BtVodProductScope productScope = new BtVodProductScope(); BtVodProductMetadata productMetadata = new BtVodProductMetadata(); productMetadata.setEpisodeNumber("1"); productScope.setProductMetadata(productMetadata); entry.setProductScopes(ImmutableList.of(productScope)); entry.setProductRatings(ImmutableList.<BtVodProductRating>of()); BtVodPlproduct$productTag tag = new BtVodPlproduct$productTag(); tag.setPlproduct$scheme("subscription"); tag.setPlproduct$title(SUBSCRIPTION_CODE); BtVodPlproduct$productTag trailerCdnAvailabilityTag = new BtVodPlproduct$productTag(); trailerCdnAvailabilityTag.setPlproduct$scheme("trailerServiceType"); trailerCdnAvailabilityTag.setPlproduct$title("OTG"); BtVodPlproduct$productTag itemCdnAvailabilityTag = new BtVodPlproduct$productTag(); itemCdnAvailabilityTag.setPlproduct$scheme("serviceType"); itemCdnAvailabilityTag.setPlproduct$title("OTG"); BtVodPlproduct$productTag itemMasterAgreementAvailabilityTag = new BtVodPlproduct$productTag(); itemMasterAgreementAvailabilityTag.setPlproduct$scheme("masterAgreementOtgTvodPlay"); itemMasterAgreementAvailabilityTag.setPlproduct$title("TRUE"); entry.setProductTags( ImmutableList.of( tag, trailerCdnAvailabilityTag, itemCdnAvailabilityTag, itemMasterAgreementAvailabilityTag)); return entry; }
private BtVodEntry filmRow(String title) { BtVodEntry entry = new BtVodEntry(); entry.setGuid(PRODUCT_GUID); entry.setId(PRODUCT_ID); entry.setTitle(title); entry.setProductOfferStartDate( new DateTime(2013, DateTimeConstants.APRIL, 1, 0, 0, 0, 0).getMillis()); entry.setProductOfferEndDate( new DateTime(2014, DateTimeConstants.APRIL, 30, 0, 0, 0).getMillis()); entry.setDescription(SYNOPSIS); entry.setProductType("film"); entry.setProductPricingPlan(new BtVodProductPricingPlan()); entry.setProductTrailerMediaId(TRAILER_URI); BtVodProductScope productScope = new BtVodProductScope(); BtVodProductMetadata productMetadata = new BtVodProductMetadata(); productMetadata.setReleaseYear("2015"); productScope.setProductMetadata(productMetadata); entry.setProductScopes(ImmutableList.of(productScope)); entry.setProductRatings(ImmutableList.<BtVodProductRating>of()); BtVodPlproduct$productTag tag = new BtVodPlproduct$productTag(); tag.setPlproduct$scheme("subscription"); tag.setPlproduct$title(SUBSCRIPTION_CODE); BtVodPlproduct$productTag itemCdnAvailabilityTag = new BtVodPlproduct$productTag(); itemCdnAvailabilityTag.setPlproduct$scheme("serviceType"); itemCdnAvailabilityTag.setPlproduct$title("OTG"); BtVodPlproduct$productTag itemMasterAgreementAvailabilityTag = new BtVodPlproduct$productTag(); itemMasterAgreementAvailabilityTag.setPlproduct$scheme("masterAgreementOtgTvodPlay"); itemMasterAgreementAvailabilityTag.setPlproduct$title("TRUE"); entry.setProductTags( ImmutableList.of(tag, itemCdnAvailabilityTag, itemMasterAgreementAvailabilityTag)); return entry; }