use of org.opencastproject.composer.api.ComposerService in project opencast by opencast.
the class ComposeWorkflowOperationHandlerTest method testComposeEncodedTrack.
@Test
public void testComposeEncodedTrack() throws Exception {
// set up mock profile
profile = EasyMock.createNiceMock(EncodingProfile.class);
EasyMock.expect(profile.getIdentifier()).andReturn(PROFILE_ID);
EasyMock.expect(profile.getApplicableMediaType()).andReturn(MediaType.Stream);
EasyMock.expect(profile.getOutputType()).andReturn(MediaType.AudioVisual);
EasyMock.expect(profile.getMimeType()).andReturn(MimeTypes.MPEG4.toString()).times(2);
profileList = new EncodingProfile[] { profile };
EasyMock.replay(profile);
// set up mock composer service
composerService = EasyMock.createNiceMock(ComposerService.class);
EasyMock.expect(composerService.getProfile(PROFILE_ID)).andReturn(profile);
EasyMock.expect(composerService.encode((Track) EasyMock.anyObject(), (String) EasyMock.anyObject())).andReturn(job);
EasyMock.replay(composerService);
operationHandler.setComposerService(composerService);
// operation configuration
String targetTags = "engage,rss";
Map<String, String> configurations = new HashMap<String, String>();
configurations.put("source-flavors", "presentation/source");
configurations.put("target-tags", targetTags);
configurations.put("target-flavor", "presenter/delivery");
configurations.put("encoding-profiles", "flash.http");
// run the operation handler
WorkflowOperationResult result = getWorkflowOperationResult(mp, configurations);
// check track metadata
MediaPackage mpNew = result.getMediaPackage();
Track trackEncoded = mpNew.getTrack(ENCODED_TRACK_ID);
Assert.assertEquals("presenter/delivery", trackEncoded.getFlavor().toString());
Assert.assertArrayEquals(targetTags.split("\\W"), trackEncoded.getTags());
Assert.assertEquals(SOURCE_TRACK_ID, trackEncoded.getReference().getIdentifier());
}
use of org.opencastproject.composer.api.ComposerService in project opencast by opencast.
the class PartialImportWorkflowOperationHandlerTest method checkForMuxingInputPresenterVideoPresenterAudioNoAudioSuffixExpectsNoMux.
@Test
public void checkForMuxingInputPresenterVideoPresenterAudioNoAudioSuffixExpectsNoMux() throws EncoderException, MediaPackageException, WorkflowOperationException, NotFoundException, ServiceRegistryException, IOException, URISyntaxException {
// Setup tracks
Track audioTrack = createTrack(PRESENTER_TARGET_FLAVOR, "audio.mp4", false, true);
Track videoTrack = createTrack(PRESENTER_TARGET_FLAVOR, "video.mp4", true, false);
Track[] tracks = { audioTrack, videoTrack };
// Setup media package
MediaPackage mediaPackage = EasyMock.createMock(MediaPackage.class);
EasyMock.expect(mediaPackage.getTracks()).andReturn(tracks).anyTimes();
ComposerService composerService = EasyMock.createMock(ComposerService.class);
// Replay all mocks
EasyMock.replay(composerService, mediaPackage);
// Make sure that the composer service was not called.
EasyMock.verify(composerService);
PartialImportWorkflowOperationHandler handler = new PartialImportWorkflowOperationHandler();
handler.setComposerService(composerService);
handler.checkForMuxing(mediaPackage, PRESENTATION_TARGET_FLAVOR, PRESENTER_TARGET_FLAVOR, false, new ArrayList<MediaPackageElement>());
}
use of org.opencastproject.composer.api.ComposerService in project opencast by opencast.
the class PartialImportWorkflowOperationHandlerTest method checkForMuxingInputPresenterVideoPresentationAudioExpectsMux.
@Test
public void checkForMuxingInputPresenterVideoPresentationAudioExpectsMux() throws EncoderException, MediaPackageException, WorkflowOperationException, NotFoundException, ServiceRegistryException, IOException, URISyntaxException {
// Setup tracks
Track audioTrack = createTrack(PRESENTER_TARGET_FLAVOR, "audio.mp4", false, true);
Track videoTrack = createTrack(PRESENTATION_TARGET_FLAVOR, "video.mp4", true, false);
Track[] tracks = { audioTrack, videoTrack };
// Setup media package
MediaPackage mediaPackage = EasyMock.createMock(MediaPackage.class);
EasyMock.expect(mediaPackage.getTracks()).andReturn(tracks).anyTimes();
// Create a Job for the mux Job to return.
Job muxJob = EasyMock.createMock(Job.class);
EasyMock.expect(muxJob.getId()).andReturn(1L);
// Create the composer service to track muxing of tracks.
ComposerService composerService = EasyMock.createMock(ComposerService.class);
EasyMock.expect(composerService.mux(videoTrack, audioTrack, PrepareAVWorkflowOperationHandler.MUX_AV_PROFILE)).andReturn(muxJob);
// Service Registry
ServiceRegistry serviceRegistry = EasyMock.createMock(ServiceRegistry.class);
EasyMock.expect(serviceRegistry.getJob(1L)).andReturn(muxJob);
// Replay all mocks
EasyMock.replay(composerService, mediaPackage, serviceRegistry);
TestPartialImportWorkflowOperationHandler handler = new TestPartialImportWorkflowOperationHandler(videoTrack, audioTrack);
handler.setComposerService(composerService);
handler.setServiceRegistry(serviceRegistry);
handler.checkForMuxing(mediaPackage, PRESENTATION_TARGET_FLAVOR, PRESENTER_TARGET_FLAVOR, false, new ArrayList<MediaPackageElement>());
}
use of org.opencastproject.composer.api.ComposerService in project opencast by opencast.
the class PartialImportWorkflowOperationHandlerTest method checkForMuxingInputPresentationVideoPresentationAudioExpectsNoMux.
@Test
public void checkForMuxingInputPresentationVideoPresentationAudioExpectsNoMux() throws EncoderException, MediaPackageException, WorkflowOperationException, NotFoundException, ServiceRegistryException, IOException, URISyntaxException {
// Setup tracks
Track audioTrack = createTrack(PRESENTATION_TARGET_FLAVOR, "audio.mp4", false, true);
Track videoTrack = createTrack(PRESENTATION_TARGET_FLAVOR, "video.mp4", true, false);
Track[] tracks = { audioTrack, videoTrack };
// Setup media package
MediaPackage mediaPackage = EasyMock.createMock(MediaPackage.class);
EasyMock.expect(mediaPackage.getTracks()).andReturn(tracks).anyTimes();
ComposerService composerService = EasyMock.createMock(ComposerService.class);
// Replay all mocks
EasyMock.replay(composerService, mediaPackage);
// Make sure that the composer service was not called.
EasyMock.verify(composerService);
PartialImportWorkflowOperationHandler handler = new PartialImportWorkflowOperationHandler();
handler.setComposerService(composerService);
handler.checkForMuxing(mediaPackage, PRESENTATION_TARGET_FLAVOR, PRESENTER_TARGET_FLAVOR, false, new ArrayList<MediaPackageElement>());
}
use of org.opencastproject.composer.api.ComposerService in project opencast by opencast.
the class PartialImportWorkflowOperationHandlerTest method checkForMuxingInputPresentationVideoPresenterAudioExpectsMux.
@Test
public void checkForMuxingInputPresentationVideoPresenterAudioExpectsMux() throws EncoderException, MediaPackageException, WorkflowOperationException, NotFoundException, ServiceRegistryException, IOException, URISyntaxException {
// Setup tracks
Track audioTrack = createTrack(PRESENTATION_TARGET_FLAVOR, "audio.mp4", false, true);
Track videoTrack = createTrack(PRESENTER_TARGET_FLAVOR, "video.mp4", true, false);
Track[] tracks = { audioTrack, videoTrack };
// Setup media package
MediaPackage mediaPackage = EasyMock.createMock(MediaPackage.class);
EasyMock.expect(mediaPackage.getTracks()).andReturn(tracks).anyTimes();
// Create a Job for the mux Job to return.
Job muxJob = EasyMock.createMock(Job.class);
EasyMock.expect(muxJob.getId()).andReturn(1L);
// Create the composer service to track muxing of tracks.
ComposerService composerService = EasyMock.createMock(ComposerService.class);
EasyMock.expect(composerService.mux(videoTrack, audioTrack, PrepareAVWorkflowOperationHandler.MUX_AV_PROFILE)).andReturn(muxJob);
// Service Registry
ServiceRegistry serviceRegistry = EasyMock.createMock(ServiceRegistry.class);
EasyMock.expect(serviceRegistry.getJob(1L)).andReturn(muxJob);
// Replay all mocks
EasyMock.replay(composerService, mediaPackage, serviceRegistry);
TestPartialImportWorkflowOperationHandler handler = new TestPartialImportWorkflowOperationHandler(videoTrack, audioTrack);
handler.setComposerService(composerService);
handler.setServiceRegistry(serviceRegistry);
handler.checkForMuxing(mediaPackage, PRESENTATION_TARGET_FLAVOR, PRESENTER_TARGET_FLAVOR, false, new ArrayList<MediaPackageElement>());
}
Aggregations