Search in sources :

Example 21 with StepDefinition

use of io.syndesis.qe.bdd.entities.StepDefinition in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method processPrecedingSteps.

/**
 * Using output datashape, generates jsonInspectionResponse for steps preceding atlasMapping we want to generate. In
 * case, the specification is of JavaClass-type, is only transforms this scpecification into required Field listing.
 * The jsonInspectionResponse is stored in StepDefinition.
 *
 * @param precedingSteps
 */
private void processPrecedingSteps(List<StepDefinition> precedingSteps) {
    for (StepDefinition s : precedingSteps) {
        String stepSpecification = s.getConnectorDescriptor().get().getOutputDataShape().get().getSpecification();
        DataShapeKinds dsKind = s.getConnectorDescriptor().get().getOutputDataShape().get().getKind();
        s.setInspectionResponseFields(Optional.ofNullable(processDataShapeIntoFields(stepSpecification, dsKind)));
    }
}
Also used : DataShapeKinds(io.syndesis.common.model.DataShapeKinds) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition)

Example 22 with StepDefinition

use of io.syndesis.qe.bdd.entities.StepDefinition in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method processSources.

/**
 * Gets list of output data shapes for preceding steps.
 *
 * @param precedingSteps
 * @return
 */
private List<DataSource> processSources(List<StepDefinition> precedingSteps) {
    List<DataSource> sources = new ArrayList<>();
    for (StepDefinition s : precedingSteps) {
        DataShape outDataShape = s.getConnectorDescriptor().get().getOutputDataShape().get();
        sources.add(createDataSource(outDataShape, s, DataSourceType.SOURCE));
    }
    return sources;
}
Also used : ArrayList(java.util.ArrayList) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) DataShape(io.syndesis.common.model.DataShape) DataSource(io.atlasmap.v2.DataSource) JsonDataSource(io.atlasmap.json.v2.JsonDataSource) XmlDataSource(io.atlasmap.xml.v2.XmlDataSource)

Example 23 with StepDefinition

use of io.syndesis.qe.bdd.entities.StepDefinition in project syndesis-qe by syndesisio.

the class AtlasMapperGenerator method generateCombineMapping.

private Mapping generateCombineMapping(DataMapperStepDefinition mappingDef, List<StepDefinition> precedingSteps, StepDefinition followingStep) {
    StepDefinition fromStep = precedingSteps.get(mappingDef.getFromStep() - 1);
    Mapping generatedMapping = new Mapping();
    generatedMapping.setId(UUID.randomUUID().toString());
    generatedMapping.setMappingType(MappingType.COMBINE);
    generatedMapping.setDelimiter(mappingDef.getStrategy().name());
    List<Field> in = new ArrayList<>();
    for (int i = 0; i < mappingDef.getInputFields().size(); i++) {
        String def = mappingDef.getInputFields().get(i);
        Field inField = fromStep.getInspectionResponseFields().get().stream().filter(f -> f.getPath().matches(def)).findFirst().get();
        inField.setIndex(i);
        in.add(inField);
    }
    Field out = followingStep.getInspectionResponseFields().get().stream().filter(f -> f.getPath().matches(mappingDef.getOutputFields().get(0))).findFirst().get();
    in.forEach(f -> f.setDocId(fromStep.getStep().getId().get()));
    out.setDocId(followingStep.getStep().getId().get());
    generatedMapping.getInputField().addAll(in);
    generatedMapping.getOutputField().add(out);
    return generatedMapping;
}
Also used : Field(io.atlasmap.v2.Field) JavaField(io.atlasmap.java.v2.JavaField) ArrayList(java.util.ArrayList) DataMapperStepDefinition(io.syndesis.qe.bdd.entities.DataMapperStepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) BaseMapping(io.atlasmap.v2.BaseMapping) Mapping(io.atlasmap.v2.Mapping) AtlasMapping(io.atlasmap.v2.AtlasMapping) AtlasmapEndpoint(io.syndesis.qe.endpoints.AtlasmapEndpoint)

Aggregations

StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)23 Step (io.syndesis.common.model.integration.Step)17 Connection (io.syndesis.common.model.connection.Connection)13 Connector (io.syndesis.common.model.connection.Connector)13 Action (io.syndesis.common.model.action.Action)11 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)11 Given (cucumber.api.java.en.Given)10 AbstractStep (io.syndesis.qe.bdd.AbstractStep)9 DataMapperStepDefinition (io.syndesis.qe.bdd.entities.DataMapperStepDefinition)9 And (cucumber.api.java.en.And)4 Then (cucumber.api.java.en.Then)4 JavaField (io.atlasmap.java.v2.JavaField)3 AtlasMapping (io.atlasmap.v2.AtlasMapping)3 BaseMapping (io.atlasmap.v2.BaseMapping)3 Field (io.atlasmap.v2.Field)3 Mapping (io.atlasmap.v2.Mapping)3 Integration (io.syndesis.common.model.integration.Integration)3 StepKind (io.syndesis.common.model.integration.StepKind)3 AtlasMapperGenerator (io.syndesis.qe.bdd.datamapper.AtlasMapperGenerator)3 DataMapperDefinition (io.syndesis.qe.bdd.entities.DataMapperDefinition)3