/** * Create an instance of {@link ExecEachSegmentSequenceType } * */ public ExecEachSegmentSequenceType createExecEachSegmentSequenceType() { return new ExecEachSegmentSequenceType(); }
@Override public void execute() throws IOException { for (SegmentUUID segmentUuid : contextProvider.getSegmentContext().getUuids()) { this.currentSegmentUuid = segmentUuid; for (Object operation : execEachSegm.getPipeOrExecOnceOrExecEachSequence()) { if (operation instanceof PipeSegmentType) { execPipe((PipeSegmentType) operation); } else if (operation instanceof ExecOnceType) { execOnce((ExecOnceType) operation); } else if (operation instanceof ExecEachSequenceType) { execSequence((ExecEachSequenceType) operation); } else if (operation instanceof DynamicParameterConcatType) { addDynamicParameter((DynamicParameterConcatType) operation); } else { throw new ConversionException(String.format("Unknown Conversion Operation type: %s", operation.toString())); } } } }
/** * Create an instance of {@link ExecEachSegmentSequenceType } * */ public ExecEachSegmentSequenceType createExecEachSegmentSequenceType() { return new ExecEachSegmentSequenceType(); }
@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 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)); }