@Test public void testCmdLineCplReplacesDefault() throws Exception { String[] args = new String[]{ "--cpl", ImpUtils.getCorrectCpl().getName(), "--imp", ImpUtils.getImpFolder().getAbsolutePath() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); inputParameters.setDefaultCpl("defaultCpl"); assertEquals(ImpUtils.getCorrectCpl(), inputParameters.getCplFile()); }
@Test public void testParseCorrectConfigWithoutErrors() throws Exception { createCplContextBuilder(ImpUtils.getCorrectCpl()).build(); }
@Test public void testValidateInputParamsCorrectAbsoluteCpl() throws Exception { String[] args = new String[]{ "--imp", ImpUtils.getImpFolder().getAbsolutePath(), "--cpl", ImpUtils.getCorrectCpl().getAbsolutePath(), "-w", TemplateParameterContextCreator.getWorkingDir().getAbsolutePath() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); ImfUtilityInputParametersValidator.validateInputParameters(inputParameters); }
@Test public void testValidateInputParamsCorrectRelativeCpl() throws Exception { String[] args = new String[]{ "--imp", ImpUtils.getImpFolder().getAbsolutePath(), "--cpl", ImpUtils.getCorrectCpl().getName(), "-w", TemplateParameterContextCreator.getWorkingDir().getAbsolutePath() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); ImfUtilityInputParametersValidator.validateInputParameters(inputParameters); }
@Test(expected = ArgumentValidationException.class) public void testValidateImpNotSpecified() throws Exception { String[] args = new String[]{ "--cpl", ImpUtils.getCorrectCpl().getName(), "-w", TemplateParameterContextCreator.getWorkingDir().getAbsolutePath() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); ImfUtilityInputParametersValidator.validateInputParameters(inputParameters); }
@Test(expected = ArgumentValidationException.class) public void testValidateImpNotExistentFolder() throws Exception { String[] args = new String[]{ "--imp", "someFolder", "--cpl", ImpUtils.getCorrectCpl().getName(), "-w", TemplateParameterContextCreator.getWorkingDir().getAbsolutePath() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); ImfUtilityInputParametersValidator.validateInputParameters(inputParameters); }
@Test(expected = ArgumentValidationException.class) public void testValidateWorkingDirNotSpecified() throws Exception { String[] args = new String[]{ "--imp", ImpUtils.getImpFolder().getAbsolutePath(), "--cpl", ImpUtils.getCorrectCpl().getName() }; ImfUtilityInputParameters inputParameters = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, args), new FakeDefaultTools()); ImfUtilityInputParametersValidator.validateInputParameters(inputParameters); }
@Test public void testCpl() throws Exception { String[] argsCplImp = new String[]{ "--cpl", ImpUtils.getCorrectCpl().getName(), "--imp", ImpUtils.getImpFolder().getAbsolutePath() }; String[] argsCplNoImp = new String[]{ "--cpl", ImpUtils.getCorrectCpl().getName() }; String[] argsNoCplNoImp = new String[]{ }; ImfUtilityInputParameters inputParametersCplImp = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, argsCplImp), new FakeDefaultTools()); ImfUtilityInputParameters inputParametersCplNoImp = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, argsCplNoImp), new FakeDefaultTools()); ImfUtilityInputParameters inputParametersNoCplNoImp = new FakeInputParameters( CliFactory.parseArguments(ImfUtilityCmdLineArgs.class, argsNoCplNoImp), new FakeDefaultTools()); assertEquals(ImpUtils.getCorrectCpl(), inputParametersCplImp.getCplFile()); assertEquals(new File(ImpUtils.getCorrectCpl().getName()), inputParametersCplNoImp.getCplFile()); assertNull(inputParametersNoCplNoImp.getCplFile()); }
public static void setUpAll() throws Exception { TemplateParameterContextProvider contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()).build(); sequenceContext = contextProvider.getSequenceContext(); } }
@BeforeClass public static void setUpAll() throws Exception { contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()).build(); }
@BeforeClass public static void setUpAll() throws Exception { TemplateParameterContextProvider contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()).build(); resourceContext = contextProvider.getResourceContext(); }
@Test public void testStartTimeFromCplZeroStart() throws Exception { TemplateParameterContextProvider contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); CplContextBuilder cplContextBuilder = new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()); cplContextBuilder.build(); cplContextBuilder.buildPostDestContext(); doTestOffset(contextProvider, 0); }
@Test public void testSegmentContextCreatedCorrectly() throws Exception { TemplateParameterContextProvider contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()).build(); SegmentTemplateParameterContext segmentContext = contextProvider.getSegmentContext(); assertEquals(2, segmentContext.getSegmentsNum()); // UUIDs as defined in CPL.xml assertArrayEquals( new SegmentUUID[]{ SegmentUUID.create("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad16"), SegmentUUID.create("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad17") }, segmentContext.getUuids().toArray(new SegmentUUID[]{})); ContextInfo contextInfo = new ContextInfoBuilder() .setSegmentUuid(SegmentUUID.create("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad16")) .build(); assertEquals("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad16", segmentContext.getParameterValue(SegmentContextParameters.UUID, contextInfo)); assertEquals("0", segmentContext.getParameterValue(SegmentContextParameters.NUM, contextInfo)); contextInfo = new ContextInfoBuilder() .setSegmentUuid(SegmentUUID.create("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad17")) .build(); assertEquals("urn:uuid:20544b5c-be3c-4274-8633-249ee8a5ad17", segmentContext.getParameterValue(SegmentContextParameters.UUID, contextInfo)); assertEquals("1", segmentContext.getParameterValue(SegmentContextParameters.NUM, contextInfo)); }
@Test public void testStartTimeFromDestContext() throws Exception { TemplateParameterContextProvider contextProvider = TemplateParameterContextCreator.createDefaultContextProvider(); DestContextTypeMap map = new DestContextTypeMap(); map.setName("test"); putDestContextValue(DestContextParameters.FRAME_RATE.getName(), "25 1", map); putDestContextValue(DestContextParameters.START_TIME.getName(), "09:50:30:05", map); DestTemplateParameterContext dest = contextProvider.getDestContext(); dest.setDestContextMap(map); AssetMap assetMap = new AssetMapParser().parse(ImpUtils.getImpFolder(), ImpUtils.getCorrectAssetmap()); CplContextBuilder cplContextBuilder = new CplContextBuilder(contextProvider, assetMap, ImpUtils.getCorrectCpl()); cplContextBuilder.build(); cplContextBuilder.buildPostDestContext(); doTestOffset(contextProvider, 35430200); }