private List<OperationInfo> getSubPipeOperations(SubPipeType subPipe) { return subPipe.getExecOnce().stream() .map(execOnce -> new OperationInfo(execOnce.getValue(), execOnce.getName(), ContextInfo.EMPTY, skipOperationResolver .setContextInfo(ContextInfo.EMPTY) .isSkip(execOnce))) .collect(Collectors.toList()); }
private List<OperationInfo> getSubPipeOperations(SubPipeType subPipe) { List<OperationInfo> result = new ArrayList<>(); ContextInfo contextInfo = new ContextInfoBuilder() .setSequenceUuid(currentSeqUuid) .setSequenceType(seqType) .build(); result.addAll(subPipe.getExecOnce().stream() .map(execOnce -> new OperationInfo(execOnce.getValue(), execOnce.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execOnce, execEachSeq))) .collect(Collectors.toList())); return result; }
private List<OperationInfo> getSubPipeOperations(SubPipeType subPipe) { ContextInfo contextInfo = new ContextInfoBuilder() .setSegmentUuid(currentSegmentUuid) .build(); return subPipe.getExecOnce().stream() .map(execOnce -> new OperationInfo(execOnce.getValue(), execOnce.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execOnce, execEachSegm))) .collect(Collectors.toList()); }
private OperationInfo getExecOnceOperation(ExecOnceType execOnce) { return new OperationInfo(execOnce.getValue(), execOnce.getName(), ContextInfo.EMPTY, skipOperationResolver .setContextInfo(ContextInfo.EMPTY) .isSkip(execOnce)); }
@Override public void execute() throws IOException { OperationInfo operationInfo = new OperationInfo(operation.getValue(), operation.getName(), ContextInfo.EMPTY, skipOperationResolver .setContextInfo(ContextInfo.EMPTY) .isSkip(operation)); executeStrategyFactory.createExecuteOnceStrategy(contextProvider).execute(operationInfo); }
private void addDynamicParameter(DynamicParameterConcatType dynamicParam) { ContextInfo contextInfo = new ContextInfoBuilder() .setSegmentUuid(currentSegmentUuid) .build(); contextProvider.getDynamicContext().addParameter(dynamicParam, contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(dynamicParam, execEachSegm)); }
private void addDynamicParameter(DynamicParameterConcatType dynamicParam) { ContextInfo contextInfo = new ContextInfoBuilder() .setSequenceUuid(currentSeqUuid) .setSequenceType(seqType) .build(); contextProvider.getDynamicContext().addParameter(dynamicParam, contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(dynamicParam, execEachSeq)); }
private OperationInfo getExecOnceOperation(ExecOnceType execOnce) { ContextInfo contextInfo = new ContextInfoBuilder() .setSegmentUuid(currentSegmentUuid) .build(); return new OperationInfo(execOnce.getValue(), execOnce.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execOnce, execEachSegm)); }
private OperationInfo getExecOnceOperation(ExecOnceType execOnce) { ContextInfo contextInfo = new ContextInfoBuilder() .setSequenceUuid(currentSeqUuid) .setSequenceType(seqType) .build(); return new OperationInfo(execOnce.getValue(), execOnce.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execOnce, execEachSeq)); }
execSegment.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execSegment.getExecOnce(), execSegment, execEachSeq)); result.add(operationInfo); contextProvider.getDynamicContext().addParameter(dynamicParam, contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(dynamicParam, execSegment, execEachSeq));
execSequence.getName(), contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(execSequence.getExecOnce(), execSequence, execEachSegm)); result.add(operationInfo); contextProvider.getDynamicContext().addParameter(dynamicParam, contextInfo, skipOperationResolver .setContextInfo(contextInfo) .isSkip(dynamicParam, execSequence, execEachSegm));
@Test public void testOperationNotSkipped() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ConditionalSimpleType trueExec = new ExecOnceType(); trueExec.setUnless("false"); ConditionalSimpleType ifParamExec = new ExecOnceType(); ifParamExec.setIf("%{dynamic.trueParam}"); ConditionalComplexType unlessParamExec = new ExecEachSequenceType(); unlessParamExec.setUnless("%{dynamic.falseParam}"); ConditionalComplexType ifUnlessParamExec = new ExecEachSegmentSequenceType(); ifUnlessParamExec.setIf("%{dynamic.trueParam}"); ifUnlessParamExec.setUnless("%{dynamic.falseParam}"); assertFalse(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(trueExec)); assertFalse(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(ifParamExec)); assertFalse(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(unlessParamExec)); assertFalse(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(ifUnlessParamExec)); }
@Test public void testOperationSkipped() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ConditionalSimpleType falseExec = new ExecOnceType(); falseExec.setIf("false"); ConditionalSimpleType ifParamExec = new ExecOnceType(); ifParamExec.setIf("%{dynamic.falseParam}"); ConditionalComplexType unlessParamExec = new ExecEachSequenceType(); unlessParamExec.setUnless("%{dynamic.trueParam}"); ConditionalComplexType ifUnlessParamExec = new ExecEachSegmentSequenceType(); ifUnlessParamExec.setIf("%{dynamic.trueParam}"); // not skipped ifUnlessParamExec.setUnless("%{dynamic.trueParam}"); // skipped assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(falseExec)); assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(ifParamExec)); assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(unlessParamExec)); assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(ifUnlessParamExec)); }
@Test(expected = TemplateParameterNotFoundException.class) public void testInvalidContextParameter() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType exec = new ExecOnceType(); exec.setIf("%{dynamic.null}"); resolver.setContextInfo(ContextInfo.EMPTY).isSkip(exec); }
@Test(expected = UnknownTemplateParameterContextException.class) public void testInvalidContext() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType exec = new ExecOnceType(); exec.setIf("%{null.true}"); resolver.setContextInfo(ContextInfo.EMPTY).isSkip(exec); }
@Test public void testDamagedContextParameter() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType exec = new ExecOnceType(); exec.setIf("%{dynamic.damagedParam}"); // convert to false in result assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(exec)); }
@Test public void testEmptyParameter() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType exec = new ExecOnceType(); exec.setIf(""); // convert to false in result assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(exec)); }
@Test public void testInvalidBoolean() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType ifInvalidExec = new ExecOnceType(); ifInvalidExec.setIf("true"); ifInvalidExec.setUnless("123"); // convert to false in result assertFalse(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(ifInvalidExec)); }
@Test public void testFewOperationsSkipped() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ConditionalSimpleType trueExec1 = new ExecOnceType(); trueExec1.setUnless("false"); ConditionalComplexType trueExec2 = new ConditionalComplexType(); trueExec2.setIf("true"); ConditionalComplexType falseExec = new ConditionalComplexType(); falseExec.setIf("false"); assertTrue(resolver.setContextInfo(ContextInfo.EMPTY).isSkip(trueExec1, trueExec2, falseExec)); }
@Test public void testContextInfo() { SkipOperationResolver resolver = new SkipOperationResolver(new TemplateParameterResolver(contextProvider)); ExecOnceType exec = new ExecOnceType(); exec.setIf("true"); assertFalse(resolver .setContextInfo(new ContextInfoBuilder() .setSequenceUuid(SequenceUUID.create("seq:urn")) .setResourceUuid(ResourceUUID.create("res:urn", 0)) .build()) .isSkip(exec)); } }