@Test public void shouldCreateMetaDataFromAnyShapes() { Step previousStep = new Step.Builder() .stepKind(StepKind.endpoint) .action(new ConnectorAction.Builder() .descriptor(new ConnectorDescriptor.Builder() .inputDataShape(StepMetadataHelper.NO_SHAPE) .outputDataShape(StepMetadataHelper.ANY_SHAPE) .build()) .build()) .build(); Step subsequentStep = new Step.Builder() .stepKind(StepKind.endpoint) .action(new ConnectorAction.Builder() .descriptor(new ConnectorDescriptor.Builder() .inputDataShape(StepMetadataHelper.ANY_SHAPE) .outputDataShape(StepMetadataHelper.NO_SHAPE) .build()) .build()) .build(); DynamicActionMetadata metadata = metadataHandler.createMetadata(choiceStep, Collections.singletonList(previousStep), Collections.singletonList(subsequentStep)); Assert.assertEquals(StepMetadataHelper.ANY_SHAPE, metadata.inputShape()); Assert.assertEquals(StepMetadataHelper.ANY_SHAPE, metadata.outputShape()); }
@Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetadataHelper.NO_SHAPE); return new DynamicActionMetadata.Builder() .inputShape(outputShape) .outputShape(step.outputDataShape() .orElse(StepMetadataHelper.ANY_SHAPE)) .build(); }
ChoiceMetadataHandler implements StepMetadataHandler { @Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetadataHelper.NO_SHAPE); return new DynamicActionMetadata.Builder() .inputShape(outputShape) .outputShape(step.outputDataShape() .orElse(StepMetadataHelper.ANY_SHAPE)) .build(); } }
ChoiceMetadataHandler implements StepMetadataHandler { @Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetadataHelper.NO_SHAPE); return new DynamicActionMetadata.Builder() .inputShape(outputShape) .outputShape(step.outputDataShape() .orElse(StepMetadataHelper.ANY_SHAPE)) .build(); }  }
ChoiceMetadataHandler implements StepMetadataHandler { @Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetadataHelper.NO_SHAPE); return new DynamicActionMetadata.Builder() .inputShape(outputShape) .outputShape(step.outputDataShape() .orElse(StepMetadataHelper.ANY_SHAPE)) .build(); }  @Override boolean canHandle(StepKind kind); @Override DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps); }
ChoiceMetadataHandler implements StepMetadataHandler { @Override public DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps) { DataShape outputShape = StepMetadataHelper.getLastWithOutputShape(previousSteps) .flatMap(Step::outputDataShape) .orElse(StepMetadataHelper.NO_SHAPE); return new DynamicActionMetadata.Builder() .inputShape(outputShape) .outputShape(step.outputDataShape() .orElse(StepMetadataHelper.ANY_SHAPE)) .build(); }  @Override boolean canHandle(StepKind kind); @Override DynamicActionMetadata createMetadata(Step step, List<Step> previousSteps, List<Step> subsequentSteps);  }