LiveScheduleServiceImpl implements LiveScheduleService { Snapshot getSnapshot(String mpId) throws LiveScheduleException { AQueryBuilder query = assetManager.createQuery(); AResult result = query.select(query.snapshot()).where(query.mediaPackageId(mpId).and(query.version().isLatest())) .run(); if (result.getSize() == 0) { throw new LiveScheduleException(String.format("Unexpected error: media package %s has not been archived.", mpId)); } Opt<ARecord> record = result.getRecords().head(); if (record.isNone()) { throw new LiveScheduleException(String.format("Unexpected error: media package %s has not been archived.", mpId)); } return record.get().getSnapshot().get(); }  @Override boolean createOrUpdateLiveEvent(String mpId, DublinCoreCatalog episodeDC); @Override boolean deleteLiveEvent(String mpId); @Override boolean updateLiveEventAcl(String mpId, AccessControlList acl); void setDublinCoreService(DublinCoreCatalogService service); void setSearchService(SearchService service); void setSeriesService(SeriesService service); void setServiceRegistry(ServiceRegistry service); void setCaptureAgentService(CaptureAgentStateService service); void setDownloadDistributionService(DownloadDistributionService service); void setWorkspace(Workspace ws); void setAssetManager(AssetManager assetManager); void setAuthorizationService(AuthorizationService service); void setOrganizationService(OrganizationDirectoryService service); static final String CA_PROPERTY_RESOLUTION_URL_PREFIX; static final String REPLACE_ID; static final String REPLACE_FLAVOR; static final String REPLACE_CA_NAME; static final String REPLACE_RESOLUTION; static final String LIVE_STREAMING_URL; static final String LIVE_STREAM_NAME; static final String LIVE_STREAM_MIME_TYPE; static final String LIVE_STREAM_RESOLUTION; static final String LIVE_TARGET_FLAVORS; static final String LIVE_DISTRIBUTION_SERVICE; static final String LIVE_PUBLISH_STREAMING; }
@Test public void testGetSnapshot() throws Exception { URI mpURI = LiveScheduleServiceImplTest.class.getResource("/assetmanager-mp.xml").toURI(); MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder() .loadFromXml(mpURI.toURL().openStream()); setUpAssetManager(mp); replayServices(); Snapshot s = service.getSnapshot(MP_ID); Assert.assertNotNull(s); MediaPackage mp1 = s.getMediaPackage(); Assert.assertNotNull(mp1); Assert.assertEquals(MP_ID, mp1.getIdentifier().toString()); Assert.assertEquals("Live Test", mp1.getTitle()); Assert.assertEquals("2017-10-12T18:10:59Z", DateTimeSupport.toUTC(mp1.getDate().getTime())); Assert.assertEquals("20170119999", mp1.getSeries()); Assert.assertEquals("Test Fall 2017", mp1.getSeriesTitle()); }