TimelinePreviewsServiceImpl extends AbstractJobProducer implements
TimelinePreviewsService, ManagedService { @Override public Job createTimelinePreviewImages(Track track, int imageCount) throws TimelinePreviewsException, MediaPackageException { try { List<String> parameters = Arrays.asList(MediaPackageElementParser.getAsXml(track), Integer.toString(imageCount)); return serviceRegistry.createJob(JOB_TYPE, Operation.TimelinePreview.toString(), parameters, timelinepreviewsJobLoad); } catch (ServiceRegistryException e) { throw new TimelinePreviewsException("Unable to create timelinepreviews job", e); } } TimelinePreviewsServiceImpl(); @Override void activate(ComponentContext cc); @Override void updated(Dictionary<String, ?> properties); @Override Job createTimelinePreviewImages(Track track, int imageCount); void setSecurityService(SecurityService securityService); void setUserDirectoryService(
      UserDirectoryService userDirectoryService); void setOrganizationDirectoryService(
      OrganizationDirectoryService organizationDirectory); static final String COLLECTION_ID; static final String FFMPEG_BINARY_CONFIG; static final String FFMPEG_BINARY_DEFAULT; static final String OPT_RESOLUTION_X; static final int DEFAULT_RESOLUTION_X; static final String OPT_RESOLUTION_Y; static final int DEFAULT_RESOLUTION_Y; static final String OPT_OUTPUT_FORMAT; static final String DEFAULT_OUTPUT_FORMAT; static final String OPT_MIMETYPE; static final String DEFAULT_MIMETYPE; static final float DEFAULT_TIMELINEPREVIEWS_JOB_LOAD; static final String TIMELINEPREVIEWS_JOB_LOAD_KEY; }
@Test public void testCreateTimelinePreviewImages() throws Exception { Job expectedJob = new JobImpl(1); ServiceRegistry serviceRegistry = EasyMock.createNiceMock(ServiceRegistry.class); EasyMock.expect(serviceRegistry.createJob( EasyMock.eq(TimelinePreviewsServiceImpl.JOB_TYPE), EasyMock.eq(TimelinePreviewsServiceImpl.Operation.TimelinePreview.toString()), (List<String>) EasyMock.anyObject(), EasyMock.anyFloat())) .andReturn(expectedJob); EasyMock.replay(serviceRegistry); TimelinePreviewsServiceImpl instance = new TimelinePreviewsServiceImpl(); instance.setServiceRegistry(serviceRegistry); Job job = instance.createTimelinePreviewImages(track, 10); assertEquals(expectedJob, job); }