@Test public void testRetractLiveEvent() throws Exception { URI mpURI = LiveScheduleServiceImplTest.class.getResource("/assetmanager-mp-with-live.xml").toURI(); MediaPackage mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder() .loadFromXml(mpURI.toURL().openStream()); setUpAssetManager(mp); mpURI = LiveScheduleServiceImplTest.class.getResource("/live-mp.xml").toURI(); mp = MediaPackageBuilderFactory.newInstance().newMediaPackageBuilder().loadFromXml(mpURI.toURL().openStream()); Job job1 = createJob(1L, "anything", "anything"); Capture<String> capturedMpId = Capture.newInstance(); EasyMock.expect(searchService.delete(EasyMock.capture(capturedMpId))).andReturn(job1); EasyMock.expect(serviceRegistry.getJob(1L)).andReturn(job1).anyTimes(); Job job2 = createJob(2L, "anything", "anything"); EasyMock.expect(downloadDistributionService.retract(EasyMock.anyString(), EasyMock.anyObject(MediaPackage.class), EasyMock.anyObject(Set.class))).andReturn(job2); EasyMock.expect(serviceRegistry.getJob(2L)).andReturn(job2).anyTimes(); Capture<MediaPackage> capturedSnapshotMp = Capture.newInstance(); Version v = EasyMock.createNiceMock(Version.class); Snapshot s = EasyMock.createNiceMock(Snapshot.class); EasyMock.expect(s.getVersion()).andReturn(v); EasyMock.replay(s, v); EasyMock.expect(assetManager.takeSnapshot(EasyMock.capture(capturedSnapshotMp))).andReturn(s); replayServices(); service.setDownloadDistributionService(downloadDistributionService); service.retractLiveEvent(mp); MediaPackage archivedMp = capturedSnapshotMp.getValue(); Assert.assertEquals(MP_ID, archivedMp.getIdentifier().toString()); Assert.assertEquals(0, archivedMp.getPublications().length); EasyMock.verify(searchService, downloadDistributionService); }
boolean retractLiveEvent(MediaPackage mp) throws LiveScheduleException { retract(mp); try { String mpId = mp.getIdentifier().toString(); Snapshot snapshot = getSnapshot(mpId); MediaPackage archivedMp = snapshot.getMediaPackage(); removeLivePublicationChannel(archivedMp); logger.debug("Removed live pub channel from archived media package {}", mp); snapshotVersionCache.put(mpId, assetManager.takeSnapshot(archivedMp).getVersion()); } catch (LiveScheduleException e) { } return true; }
LiveScheduleServiceImpl implements LiveScheduleService { boolean retractLiveEvent(MediaPackage mp) throws LiveScheduleException { retract(mp); try { String mpId = mp.getIdentifier().toString(); Snapshot snapshot = getSnapshot(mpId); MediaPackage archivedMp = snapshot.getMediaPackage(); removeLivePublicationChannel(archivedMp); logger.debug("Removed live pub channel from archived media package {}", mp); snapshotVersionCache.put(mpId, assetManager.takeSnapshot(archivedMp).getVersion()); } catch (LiveScheduleException e) { } return true; } }
LiveScheduleServiceImpl implements LiveScheduleService { boolean retractLiveEvent(MediaPackage mp) throws LiveScheduleException { retract(mp); try { String mpId = mp.getIdentifier().toString(); Snapshot snapshot = getSnapshot(mpId); MediaPackage archivedMp = snapshot.getMediaPackage(); removeLivePublicationChannel(archivedMp); logger.debug("Removed live pub channel from archived media package {}", mp); snapshotVersionCache.put(mpId, assetManager.takeSnapshot(archivedMp).getVersion()); } catch (LiveScheduleException e) { } return true; }  }
LiveScheduleServiceImpl implements LiveScheduleService { boolean retractLiveEvent(MediaPackage mp) throws LiveScheduleException { retract(mp); try { String mpId = mp.getIdentifier().toString(); Snapshot snapshot = getSnapshot(mpId); MediaPackage archivedMp = snapshot.getMediaPackage(); removeLivePublicationChannel(archivedMp); logger.debug("Removed live pub channel from archived media package {}", mp); snapshotVersionCache.put(mpId, assetManager.takeSnapshot(archivedMp).getVersion()); } catch (LiveScheduleException e) { } return true; }  @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); }
LiveScheduleServiceImpl implements LiveScheduleService { boolean retractLiveEvent(MediaPackage mp) throws LiveScheduleException { retract(mp); try { String mpId = mp.getIdentifier().toString(); Snapshot snapshot = getSnapshot(mpId); MediaPackage archivedMp = snapshot.getMediaPackage(); removeLivePublicationChannel(archivedMp); logger.debug("Removed live pub channel from archived media package {}", mp); snapshotVersionCache.put(mpId, assetManager.takeSnapshot(archivedMp).getVersion()); } catch (LiveScheduleException e) { } return true; }  @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; }