PartialImportWorkflowOperationHandler extends AbstractWorkflowOperationHandler { protected static boolean trackNeedsTobeEncodedToStandard(Track track, List<String> requiredExtensions) { String extension = FilenameUtils.getExtension(track.getURI().toString()); for (String requiredExtension : requiredExtensions) { if (requiredExtension.equalsIgnoreCase(extension)) { return false; } } return true; }  void setComposerService(ComposerService composerService); void setWorkspace(Workspace workspace); @Override WorkflowOperationResult start(final WorkflowInstance workflowInstance, JobContext context);  }
@Test public void trackNeedsTobeEncodedToStandardInputMp4ReturnsFalse() throws URISyntaxException { Track track = EasyMock.createMock(Track.class); EasyMock.expect(track.getURI()) .andReturn( new URI( "http: .anyTimes(); EasyMock.replay(track); boolean result = PartialImportWorkflowOperationHandler.trackNeedsTobeEncodedToStandard(track, defaultExtensions); assertFalse(result); }
@Test public void trackNeedsTobeEncodedToStandardInputNoExtensionReturnsTrue() throws URISyntaxException { Track track = EasyMock.createMock(Track.class); EasyMock.expect(track.getURI()) .andReturn( new URI( "http: .anyTimes(); EasyMock.replay(track); boolean result = PartialImportWorkflowOperationHandler.trackNeedsTobeEncodedToStandard(track, defaultExtensions); assertTrue(result); }
@Test public void trackNeedsTobeEncodedToStandardInputOnlyPeriodExtensionReturnsTrue() throws URISyntaxException { Track track = EasyMock.createMock(Track.class); EasyMock.expect(track.getURI()) .andReturn( new URI( "http: .anyTimes(); EasyMock.replay(track); boolean result = PartialImportWorkflowOperationHandler.trackNeedsTobeEncodedToStandard(track, defaultExtensions); assertTrue(result); }
@Test public void trackNeedsTobeEncodedToStandardInputMovExtensionOnlyMp4AllowedReturnsTrue() throws URISyntaxException { Track track = EasyMock.createMock(Track.class); EasyMock.expect(track.getURI()) .andReturn( new URI( "http: .anyTimes(); EasyMock.replay(track); boolean result = PartialImportWorkflowOperationHandler.trackNeedsTobeEncodedToStandard(track, defaultExtensions); assertTrue(result); }
@Test public void trackNeedsTobeEncodedToStandardInputMovMp4AndMovAllowedReturnsFalse() throws URISyntaxException { Track track = EasyMock.createMock(Track.class); EasyMock.expect(track.getURI()) .andReturn( new URI( "http: .anyTimes(); EasyMock.replay(track); boolean result = PartialImportWorkflowOperationHandler.trackNeedsTobeEncodedToStandard(track, moreExtensions); assertFalse(result); }