Search in sources :

Example 1 with SmilService

use of org.opencastproject.smil.api.SmilService in project opencast by opencast.

the class VideoEditorTest method setUpClass.

/**
 * Copies test files to the local file system, since jmf is not able to access movies from the resource section of a
 * bundle.
 *
 * @throws Exception
 *           if setup fails
 */
@BeforeClass
public static void setUpClass() throws Exception {
    /* Set up the 2 tracks for merging */
    track1 = TrackImpl.fromURI(VideoEditorTest.class.getResource(mediaResource).toURI());
    track1.setIdentifier("track-1");
    track1.setFlavor(new MediaPackageElementFlavor("source", "presentater"));
    track1.setMimeType(MimeTypes.MJPEG);
    track1.addStream(new VideoStreamImpl());
    track1.setDuration(movieDuration);
    track2 = TrackImpl.fromURI(VideoEditorTest.class.getResource(mediaResource).toURI());
    track2.setIdentifier("track-2");
    track2.setFlavor(new MediaPackageElementFlavor("source", "presentater"));
    track2.setMimeType(MimeTypes.MJPEG);
    track2.addStream(new VideoStreamImpl());
    track2.setDuration(movieDuration);
    /* Start of Smil mockups */
    URL mediaUrl = VideoEditorTest.class.getResource(mediaResource);
    URL smilUrl = VideoEditorTest.class.getResource(smilResource);
    String smilString = IOUtils.toString(smilUrl);
    String trackParamGroupId = "pg-a6d8e576-495f-44c7-8ed7-b5b47c807f0f";
    SmilMediaParam param1 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param1.getName()).andReturn("track-id").anyTimes();
    EasyMock.expect(param1.getValue()).andReturn("track-1").anyTimes();
    EasyMock.expect(param1.getId()).andReturn("param-e2f41e7d-caba-401b-a03a-e524296cb235").anyTimes();
    SmilMediaParam param2 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param2.getName()).andReturn("track-src").anyTimes();
    EasyMock.expect(param2.getValue()).andReturn("file:" + mediaUrl.getPath()).anyTimes();
    EasyMock.expect(param2.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    SmilMediaParam param3 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param3.getName()).andReturn("track-flavor").anyTimes();
    EasyMock.expect(param3.getValue()).andReturn("source/presenter").anyTimes();
    EasyMock.expect(param3.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    EasyMock.replay(param1, param2, param3);
    List<SmilMediaParam> params = new ArrayList<SmilMediaParam>();
    params.add(param1);
    params.add(param2);
    params.add(param3);
    SmilMediaParamGroup group1 = EasyMock.createNiceMock(SmilMediaParamGroup.class);
    EasyMock.expect(group1.getParams()).andReturn(params).anyTimes();
    EasyMock.expect(group1.getId()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.replay(group1);
    List<SmilMediaParamGroup> paramGroups = new ArrayList<SmilMediaParamGroup>();
    paramGroups.add(group1);
    SmilHead head = EasyMock.createNiceMock(SmilHead.class);
    EasyMock.expect(head.getParamGroups()).andReturn(paramGroups).anyTimes();
    EasyMock.replay(head);
    SmilMediaElement object1 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object1.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object1.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object1.getClipBeginMS()).andReturn(1000L).anyTimes();
    EasyMock.expect(object1.getClipEndMS()).andReturn(12000L).anyTimes();
    EasyMock.expect(object1.getSrc()).andReturn(mediaUrl.toURI()).anyTimes();
    EasyMock.replay(object1);
    SmilMediaElement object2 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object2.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object2.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object2.getClipBeginMS()).andReturn(1000L).anyTimes();
    EasyMock.expect(object2.getClipEndMS()).andReturn(13000L).anyTimes();
    EasyMock.expect(object2.getSrc()).andReturn(mediaUrl.toURI()).anyTimes();
    EasyMock.replay(object2);
    List<SmilMediaObject> objects = new ArrayList<SmilMediaObject>();
    objects.add(object1);
    objects.add(object2);
    SmilMediaContainer objectContainer = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer.getElements()).andReturn(objects).anyTimes();
    EasyMock.replay(objectContainer);
    List<SmilMediaObject> containerObjects = new ArrayList<SmilMediaObject>();
    containerObjects.add(objectContainer);
    SmilBody body = EasyMock.createNiceMock(SmilBody.class);
    EasyMock.expect(body.getMediaElements()).andReturn(containerObjects).anyTimes();
    EasyMock.replay(body);
    smil = EasyMock.createNiceMock(Smil.class);
    EasyMock.expect(smil.get(trackParamGroupId)).andReturn(group1).anyTimes();
    EasyMock.expect(smil.getBody()).andReturn(body).anyTimes();
    EasyMock.expect(smil.getHead()).andReturn(head).anyTimes();
    EasyMock.expect(smil.toXML()).andReturn(smilString).anyTimes();
    EasyMock.expect(smil.getId()).andReturn("s-ec404c2a-5092-4cd4-8717-7b7bbc244656").anyTimes();
    EasyMock.replay(smil);
    SmilResponse response = EasyMock.createNiceMock(SmilResponse.class);
    EasyMock.expect(response.getSmil()).andReturn(smil).anyTimes();
    EasyMock.replay(response);
    smilService = EasyMock.createNiceMock(SmilService.class);
    EasyMock.expect(smilService.fromXml((String) EasyMock.anyObject())).andReturn(response).anyTimes();
    EasyMock.replay(smilService);
/* End of Smil mockups */
}
Also used : SmilMediaParam(org.opencastproject.smil.entity.media.param.api.SmilMediaParam) ArrayList(java.util.ArrayList) VideoStreamImpl(org.opencastproject.mediapackage.track.VideoStreamImpl) MediaPackageElementFlavor(org.opencastproject.mediapackage.MediaPackageElementFlavor) URL(java.net.URL) SmilService(org.opencastproject.smil.api.SmilService) SmilHead(org.opencastproject.smil.entity.api.SmilHead) SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilBody(org.opencastproject.smil.entity.api.SmilBody) Smil(org.opencastproject.smil.entity.api.Smil) SmilMediaElement(org.opencastproject.smil.entity.media.element.api.SmilMediaElement) SmilMediaObject(org.opencastproject.smil.entity.media.api.SmilMediaObject) SmilMediaParamGroup(org.opencastproject.smil.entity.media.param.api.SmilMediaParamGroup) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer) BeforeClass(org.junit.BeforeClass)

Example 2 with SmilService

use of org.opencastproject.smil.api.SmilService in project opencast by opencast.

the class ToolsEndpointTest method setUpClass.

@BeforeClass
public static void setUpClass() throws Exception {
    /* Start of Smil mockups */
    // Ugly, but strictly the smil APIs
    String trackSrc = "http://mh-allinone.localdomain/archive/archive/mediapackage/0f2a2ada-0584-4d4d-a248-111f654aa217/6ec443e7-b097-4470-a618-5e0d848f5252/0/track.mp4";
    URL smilUrl = ToolsEndpoint.class.getResource("/tools/smil1.xml");
    String smilString = IOUtils.toString(smilUrl);
    String trackParamGroupId = "pg-a6d8e576-495f-44c7-8ed7-b5b47c807f0f";
    SmilMediaParam param1 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param1.getName()).andReturn("track-id").anyTimes();
    EasyMock.expect(param1.getValue()).andReturn("track-1").anyTimes();
    EasyMock.expect(param1.getId()).andReturn("param-e2f41e7d-caba-401b-a03a-e524296cb235").anyTimes();
    SmilMediaParam param2 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param2.getName()).andReturn("track-src").anyTimes();
    EasyMock.expect(param2.getValue()).andReturn(trackSrc).anyTimes();
    EasyMock.expect(param2.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    SmilMediaParam param3 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param3.getName()).andReturn("track-flavor").anyTimes();
    EasyMock.expect(param3.getValue()).andReturn("presenter/work").anyTimes();
    EasyMock.expect(param3.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    EasyMock.replay(param1, param2, param3);
    List<SmilMediaParam> params = new ArrayList<>();
    params.add(param1);
    params.add(param2);
    params.add(param3);
    SmilMediaParamGroup group1 = EasyMock.createNiceMock(SmilMediaParamGroup.class);
    EasyMock.expect(group1.getParams()).andReturn(params).anyTimes();
    EasyMock.expect(group1.getId()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.replay(group1);
    List<SmilMediaParamGroup> paramGroups = new ArrayList<>();
    paramGroups.add(group1);
    SmilHead head = EasyMock.createNiceMock(SmilHead.class);
    EasyMock.expect(head.getParamGroups()).andReturn(paramGroups).anyTimes();
    EasyMock.replay(head);
    SmilMediaElement object1 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object1.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object1.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object1.getClipBeginMS()).andReturn(0L).anyTimes();
    EasyMock.expect(object1.getClipEndMS()).andReturn(2449L).anyTimes();
    EasyMock.expect(object1.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object1);
    SmilMediaElement object2 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object2.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object2.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object2.getClipBeginMS()).andReturn(4922L).anyTimes();
    EasyMock.expect(object2.getClipEndMS()).andReturn(11284L).anyTimes();
    EasyMock.expect(object2.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object2);
    SmilMediaElement object3 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object3.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object3.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object3.getClipBeginMS()).andReturn(14721L).anyTimes();
    EasyMock.expect(object3.getClipEndMS()).andReturn(15963L).anyTimes();
    EasyMock.expect(object3.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object3);
    SmilMediaElement object4 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object4.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object4.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object4.getClipBeginMS()).andReturn(15963L).anyTimes();
    EasyMock.expect(object4.getClipEndMS()).andReturn(20132L).anyTimes();
    EasyMock.expect(object4.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object4);
    List<SmilMediaObject> objects1 = new ArrayList<>();
    objects1.add(object1);
    List<SmilMediaObject> objects2 = new ArrayList<>();
    objects2.add(object2);
    List<SmilMediaObject> objects3 = new ArrayList<>();
    objects3.add(object3);
    List<SmilMediaObject> objects4 = new ArrayList<>();
    objects4.add(object4);
    SmilMediaContainer objectContainer1 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer1.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer1.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer1.getElements()).andReturn(objects1).anyTimes();
    EasyMock.replay(objectContainer1);
    SmilMediaContainer objectContainer2 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer2.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer2.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer2.getElements()).andReturn(objects2).anyTimes();
    EasyMock.replay(objectContainer2);
    SmilMediaContainer objectContainer3 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer3.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer3.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer3.getElements()).andReturn(objects3).anyTimes();
    EasyMock.replay(objectContainer3);
    SmilMediaContainer objectContainer4 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer4.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer4.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer4.getElements()).andReturn(objects4).anyTimes();
    EasyMock.replay(objectContainer4);
    List<SmilMediaObject> containerObjects = new ArrayList<>();
    containerObjects.add(objectContainer1);
    containerObjects.add(objectContainer2);
    containerObjects.add(objectContainer3);
    containerObjects.add(objectContainer4);
    SmilBody body = EasyMock.createNiceMock(SmilBody.class);
    EasyMock.expect(body.getMediaElements()).andReturn(containerObjects).anyTimes();
    EasyMock.replay(body);
    smil = EasyMock.createNiceMock(Smil.class);
    EasyMock.expect(smil.get(trackParamGroupId)).andReturn(group1).anyTimes();
    EasyMock.expect(smil.getBody()).andReturn(body).anyTimes();
    EasyMock.expect(smil.getHead()).andReturn(head).anyTimes();
    EasyMock.expect(smil.toXML()).andReturn(smilString).anyTimes();
    EasyMock.expect(smil.getId()).andReturn("s-ec404c2a-5092-4cd4-8717-7b7bbc244656").anyTimes();
    EasyMock.replay(smil);
    SmilResponse response = EasyMock.createNiceMock(SmilResponse.class);
    EasyMock.expect(response.getSmil()).andReturn(smil).anyTimes();
    EasyMock.replay(response);
    SmilService smilService = EasyMock.createNiceMock(SmilService.class);
    EasyMock.expect(smilService.fromXml((String) EasyMock.anyObject())).andReturn(response).anyTimes();
    EasyMock.replay(smilService);
    /* End of Smil API mockups */
    endpoint = new ToolsEndpoint();
    endpoint.setSmilService(smilService);
    AdminUIConfiguration adminUIConfiguration = new AdminUIConfiguration();
    Hashtable<String, String> dictionary = new Hashtable<>();
    dictionary.put(AdminUIConfiguration.OPT_PREVIEW_SUBTYPE, "preview");
    dictionary.put(AdminUIConfiguration.OPT_WAVEFORM_SUBTYPE, "waveform");
    dictionary.put(AdminUIConfiguration.OPT_SMIL_CATALOG_FLAVOR, "smil/cutting");
    dictionary.put(AdminUIConfiguration.OPT_SMIL_SILENCE_FLAVOR, "*/silence");
    adminUIConfiguration.updated(dictionary);
    endpoint.setAdminUIConfiguration(adminUIConfiguration);
}
Also used : SmilMediaParam(org.opencastproject.smil.entity.media.param.api.SmilMediaParam) Hashtable(java.util.Hashtable) ArrayList(java.util.ArrayList) URI(java.net.URI) URL(java.net.URL) SmilService(org.opencastproject.smil.api.SmilService) SmilHead(org.opencastproject.smil.entity.api.SmilHead) AdminUIConfiguration(org.opencastproject.adminui.impl.AdminUIConfiguration) SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilBody(org.opencastproject.smil.entity.api.SmilBody) Smil(org.opencastproject.smil.entity.api.Smil) SmilMediaElement(org.opencastproject.smil.entity.media.element.api.SmilMediaElement) SmilMediaObject(org.opencastproject.smil.entity.media.api.SmilMediaObject) SmilMediaParamGroup(org.opencastproject.smil.entity.media.param.api.SmilMediaParamGroup) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer) BeforeClass(org.junit.BeforeClass)

Example 3 with SmilService

use of org.opencastproject.smil.api.SmilService in project opencast by opencast.

the class SmilServiceMock method createSmilServiceMock.

public static SmilService createSmilServiceMock(URI mpSmilURI) throws IOException, SmilException, URISyntaxException, JAXBException, SAXException {
    /* Start of Smil mockups */
    String smilString = IOUtils.toString(mpSmilURI);
    String trackSrc = "abc";
    String trackParamGroupId = "pg-a6d8e576-495f-44c7-8ed7-b5b47c807f0f";
    SmilMediaParam param1 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param1.getName()).andReturn("track-id").anyTimes();
    EasyMock.expect(param1.getValue()).andReturn("track-1").anyTimes();
    EasyMock.expect(param1.getId()).andReturn("param-e2f41e7d-caba-401b-a03a-e524296cb235").anyTimes();
    SmilMediaParam param2 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param2.getName()).andReturn("track-src").anyTimes();
    EasyMock.expect(param2.getValue()).andReturn(trackSrc).anyTimes();
    EasyMock.expect(param2.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    SmilMediaParam param3 = EasyMock.createNiceMock(SmilMediaParam.class);
    EasyMock.expect(param3.getName()).andReturn("track-flavor").anyTimes();
    EasyMock.expect(param3.getValue()).andReturn("presenter/work").anyTimes();
    EasyMock.expect(param3.getId()).andReturn("param-1bd5e839-0a74-4310-b1d2-daba07914f79").anyTimes();
    EasyMock.replay(param1, param2, param3);
    List<SmilMediaParam> params = new ArrayList<SmilMediaParam>();
    params.add(param1);
    params.add(param2);
    params.add(param3);
    SmilMediaParamGroup group1 = EasyMock.createNiceMock(SmilMediaParamGroup.class);
    EasyMock.expect(group1.getParams()).andReturn(params).anyTimes();
    EasyMock.expect(group1.getId()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.replay(group1);
    List<SmilMediaParamGroup> paramGroups = new ArrayList<SmilMediaParamGroup>();
    paramGroups.add(group1);
    SmilHead head = EasyMock.createNiceMock(SmilHead.class);
    EasyMock.expect(head.getParamGroups()).andReturn(paramGroups).anyTimes();
    EasyMock.replay(head);
    SmilMediaElement object1 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object1.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object1.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object1.getClipBeginMS()).andReturn(0L).anyTimes();
    EasyMock.expect(object1.getClipEndMS()).andReturn(2449L).anyTimes();
    EasyMock.expect(object1.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object1);
    SmilMediaElement object2 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object2.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object2.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object2.getClipBeginMS()).andReturn(4922L).anyTimes();
    EasyMock.expect(object2.getClipEndMS()).andReturn(11284L).anyTimes();
    EasyMock.expect(object2.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object2);
    SmilMediaElement object3 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object3.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object3.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object3.getClipBeginMS()).andReturn(14721L).anyTimes();
    EasyMock.expect(object3.getClipEndMS()).andReturn(15963L).anyTimes();
    EasyMock.expect(object3.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object3);
    SmilMediaElement object4 = EasyMock.createNiceMock(SmilMediaElement.class);
    EasyMock.expect(object4.isContainer()).andReturn(false).anyTimes();
    EasyMock.expect(object4.getParamGroup()).andReturn(trackParamGroupId).anyTimes();
    EasyMock.expect(object4.getClipBeginMS()).andReturn(15963L).anyTimes();
    EasyMock.expect(object4.getClipEndMS()).andReturn(20132L).anyTimes();
    EasyMock.expect(object4.getSrc()).andReturn(new URI(trackSrc)).anyTimes();
    EasyMock.replay(object4);
    List<SmilMediaObject> objects1 = new ArrayList<SmilMediaObject>();
    objects1.add(object1);
    List<SmilMediaObject> objects2 = new ArrayList<SmilMediaObject>();
    objects2.add(object2);
    List<SmilMediaObject> objects3 = new ArrayList<SmilMediaObject>();
    objects3.add(object3);
    List<SmilMediaObject> objects4 = new ArrayList<SmilMediaObject>();
    objects4.add(object4);
    SmilMediaContainer objectContainer1 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer1.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer1.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer1.getElements()).andReturn(objects1).anyTimes();
    EasyMock.expect(objectContainer1.getId()).andReturn("container1").anyTimes();
    EasyMock.replay(objectContainer1);
    SmilMediaContainer objectContainer2 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer2.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer2.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer2.getElements()).andReturn(objects2).anyTimes();
    EasyMock.expect(objectContainer2.getId()).andReturn("container2").anyTimes();
    EasyMock.replay(objectContainer2);
    SmilMediaContainer objectContainer3 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer3.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer3.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer3.getElements()).andReturn(objects3).anyTimes();
    EasyMock.expect(objectContainer3.getId()).andReturn("container3").anyTimes();
    EasyMock.replay(objectContainer3);
    SmilMediaContainer objectContainer4 = EasyMock.createNiceMock(SmilMediaContainer.class);
    EasyMock.expect(objectContainer4.isContainer()).andReturn(true).anyTimes();
    EasyMock.expect(objectContainer4.getContainerType()).andReturn(SmilMediaContainer.ContainerType.PAR).anyTimes();
    EasyMock.expect(objectContainer4.getElements()).andReturn(objects4).anyTimes();
    EasyMock.expect(objectContainer4.getId()).andReturn("container4").anyTimes();
    EasyMock.replay(objectContainer4);
    List<SmilMediaObject> containerObjects = new ArrayList<SmilMediaObject>();
    containerObjects.add(objectContainer1);
    containerObjects.add(objectContainer2);
    containerObjects.add(objectContainer3);
    containerObjects.add(objectContainer4);
    SmilBody body = EasyMock.createNiceMock(SmilBody.class);
    EasyMock.expect(body.getMediaElements()).andReturn(containerObjects).anyTimes();
    EasyMock.replay(body);
    Smil smil = EasyMock.createNiceMock(Smil.class);
    EasyMock.expect(smil.get(trackParamGroupId)).andReturn(group1).anyTimes();
    EasyMock.expect(smil.getBody()).andReturn(body).anyTimes();
    EasyMock.expect(smil.getHead()).andReturn(head).anyTimes();
    EasyMock.expect(smil.toXML()).andReturn(smilString).anyTimes();
    EasyMock.expect(smil.getId()).andReturn("s-ec404c2a-5092-4cd4-8717-7b7bbc244656").anyTimes();
    EasyMock.replay(smil);
    SmilResponse response = EasyMock.createNiceMock(SmilResponse.class);
    EasyMock.expect(response.getSmil()).andReturn(smil).anyTimes();
    EasyMock.expect(response.getEntity()).andReturn(object4).anyTimes();
    EasyMock.replay(response);
    SmilService smilService = EasyMock.createNiceMock(SmilService.class);
    EasyMock.expect(smilService.createNewSmil((MediaPackage) EasyMock.anyObject())).andReturn(response).anyTimes();
    EasyMock.expect(smilService.fromXml(EasyMock.anyString())).andReturn(response).anyTimes();
    EasyMock.expect(smilService.fromXml((File) EasyMock.anyObject())).andReturn(response).anyTimes();
    EasyMock.expect(smilService.removeSmilElement((Smil) EasyMock.anyObject(), EasyMock.anyString())).andReturn(response).anyTimes();
    EasyMock.expect(smilService.addParallel(smil)).andReturn(response).anyTimes();
    EasyMock.expect(smilService.addClips((Smil) EasyMock.anyObject(), (String) EasyMock.anyObject(), (Track[]) EasyMock.anyObject(), EasyMock.anyLong(), EasyMock.anyLong())).andReturn(response).anyTimes();
    EasyMock.replay(smilService);
    return smilService;
}
Also used : SmilMediaParam(org.opencastproject.smil.entity.media.param.api.SmilMediaParam) ArrayList(java.util.ArrayList) URI(java.net.URI) SmilService(org.opencastproject.smil.api.SmilService) SmilHead(org.opencastproject.smil.entity.api.SmilHead) SmilResponse(org.opencastproject.smil.api.SmilResponse) SmilBody(org.opencastproject.smil.entity.api.SmilBody) MediaPackage(org.opencastproject.mediapackage.MediaPackage) Smil(org.opencastproject.smil.entity.api.Smil) SmilMediaElement(org.opencastproject.smil.entity.media.element.api.SmilMediaElement) SmilMediaObject(org.opencastproject.smil.entity.media.api.SmilMediaObject) SmilMediaParamGroup(org.opencastproject.smil.entity.media.param.api.SmilMediaParamGroup) File(java.io.File) SmilMediaContainer(org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)

Aggregations

ArrayList (java.util.ArrayList)3 SmilResponse (org.opencastproject.smil.api.SmilResponse)3 SmilService (org.opencastproject.smil.api.SmilService)3 Smil (org.opencastproject.smil.entity.api.Smil)3 SmilBody (org.opencastproject.smil.entity.api.SmilBody)3 SmilHead (org.opencastproject.smil.entity.api.SmilHead)3 SmilMediaObject (org.opencastproject.smil.entity.media.api.SmilMediaObject)3 SmilMediaContainer (org.opencastproject.smil.entity.media.container.api.SmilMediaContainer)3 SmilMediaElement (org.opencastproject.smil.entity.media.element.api.SmilMediaElement)3 SmilMediaParam (org.opencastproject.smil.entity.media.param.api.SmilMediaParam)3 SmilMediaParamGroup (org.opencastproject.smil.entity.media.param.api.SmilMediaParamGroup)3 URI (java.net.URI)2 URL (java.net.URL)2 BeforeClass (org.junit.BeforeClass)2 File (java.io.File)1 Hashtable (java.util.Hashtable)1 AdminUIConfiguration (org.opencastproject.adminui.impl.AdminUIConfiguration)1 MediaPackage (org.opencastproject.mediapackage.MediaPackage)1 MediaPackageElementFlavor (org.opencastproject.mediapackage.MediaPackageElementFlavor)1 VideoStreamImpl (org.opencastproject.mediapackage.track.VideoStreamImpl)1