Search in sources :

Example 6 with StepDefinition

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

the class IntegrationHandler method processMapperSteps.

/**
 * This should be updated for more than two steps, when it will work correctly in near future.
 */
private void processMapperSteps() {
    List<StepDefinition> mappers = steps.getStepDefinitions().stream().filter(s -> s.getStep().getStepKind().equals(StepKind.mapper)).collect(Collectors.toList());
    if (mappers.isEmpty()) {
        log.debug("There are no mappers in this integration, proceeding...");
    } else {
        // mapping can be done on steps that preceed mapper step and the single step, which follows the mapper step.
        log.info("Found mapper step, creating new atlas mapping.");
        for (int i = 0; i < mappers.size(); i++) {
            List<StepDefinition> precedingSteps = steps.getStepDefinitions().subList(0, steps.getStepDefinitions().indexOf(mappers.get(i))).stream().filter(s -> s.getConnectorDescriptor().isPresent()).collect(Collectors.toList());
            StepDefinition followingStep = steps.getStepDefinitions().get(steps.getStepDefinitions().indexOf(mappers.get(i)) + 1);
            if (mappers.get(i).getStep().getConfiguredProperties().containsKey("atlasmapping")) {
                // TODO(tplevko): think of some way to substitute placeholders for the step ID's
                reflectStepIdsInAtlasMapping(mappers.get(i), precedingSteps, followingStep);
            } else {
                // TODO(tplevko): fix for more than one preceding step.
                mappers.get(i).setStep(atlasGenerator.getAtlasMappingStep(mappers.get(i), precedingSteps, followingStep));
            }
        }
    }
}
Also used : Autowired(org.springframework.beans.factory.annotation.Autowired) AtlasMapperGenerator(io.syndesis.qe.bdd.datamapper.AtlasMapperGenerator) Collectors(java.util.stream.Collectors) IntegrationsDeploymentEndpoint(io.syndesis.qe.endpoints.IntegrationsDeploymentEndpoint) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) IntegrationsEndpoint(io.syndesis.qe.endpoints.IntegrationsEndpoint) StepsStorage(io.syndesis.qe.bdd.storage.StepsStorage) Assertions(org.assertj.core.api.Assertions) BadRequestException(javax.ws.rs.BadRequestException) StepKind(io.syndesis.common.model.integration.StepKind) Integration(io.syndesis.common.model.integration.Integration) Then(cucumber.api.java.en.Then) When(cucumber.api.java.en.When) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) IntegrationsDeploymentEndpoint(io.syndesis.qe.endpoints.IntegrationsDeploymentEndpoint) IntegrationsEndpoint(io.syndesis.qe.endpoints.IntegrationsEndpoint)

Example 7 with StepDefinition

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

the class IntermediateSteps method createBasicFilterStep.

@Given("^create basic TW to SF filter step")
public void createBasicFilterStep() {
    final Step basicFilter = new Step.Builder().stepKind(StepKind.ruleFilter).configuredProperties(TestUtils.map("type", "rule", "predicate", FilterPredicate.AND.toString(), "rules", new FilterRulesBuilder().addPath("text").addValue("#backendTest").addOps("contains").build())).id(UUID.randomUUID().toString()).build();
    steps.getStepDefinitions().add(new StepDefinition(basicFilter));
}
Also used : FilterRulesBuilder(io.syndesis.qe.utils.FilterRulesBuilder) FilterRulesBuilder(io.syndesis.qe.utils.FilterRulesBuilder) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) Given(cucumber.api.java.en.Given)

Example 8 with StepDefinition

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

the class IntermediateSteps method addLogStep.

@Given("add log step")
public void addLogStep() {
    final Step basicFilter = new Step.Builder().stepKind(StepKind.log).configuredProperties(TestUtils.map("contextLoggingEnabled", "true", "bodyLoggingEnabled", "true")).id(UUID.randomUUID().toString()).build();
    steps.getStepDefinitions().add(new StepDefinition(basicFilter));
}
Also used : FilterRulesBuilder(io.syndesis.qe.utils.FilterRulesBuilder) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) Given(cucumber.api.java.en.Given)

Example 9 with StepDefinition

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

the class S3Steps method createS3CopyStep.

@Given("^create S3 copy step with bucket: \"([^\"]*)\"")
public void createS3CopyStep(String bucketName) {
    final Connector s3Connector = connectorsEndpoint.get("aws-s3");
    final Connection s3Connection = connectionsEndpoint.get(S3BucketNameBuilder.getBucketName(bucketName));
    final Action s3PollingAction = TestUtils.findConnectorAction(s3Connector, "aws-s3-copy-object-connector");
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(s3PollingAction, new HashMap(), S3BucketNameBuilder.getBucketName(bucketName));
    final Step s3Step = new Step.Builder().stepKind(StepKind.endpoint).connection(s3Connection).id(UUID.randomUUID().toString()).action(generateStepAction(s3PollingAction, connectorDescriptor)).build();
    steps.getStepDefinitions().add(new StepDefinition(s3Step));
}
Also used : Connector(io.syndesis.common.model.connection.Connector) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) Action(io.syndesis.common.model.action.Action) HashMap(java.util.HashMap) Connection(io.syndesis.common.model.connection.Connection) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) AbstractStep(io.syndesis.qe.bdd.AbstractStep) Given(cucumber.api.java.en.Given)

Example 10 with StepDefinition

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

the class SalesforceSteps method createSfStepWithAction.

@Given("^create SF \"([^\"]*)\" action step on field: \"([^\"]*)\"$")
public void createSfStepWithAction(String action, String field) {
    final Connector salesforceConnector = connectorsEndpoint.get("salesforce");
    final Connection salesforceConnection = connectionsEndpoint.get(RestConstants.getInstance().getSALESFORCE_CONNECTION_ID());
    final Action sfAction = TestUtils.findConnectorAction(salesforceConnector, action);
    final Map<String, String> properties = TestUtils.map("sObjectName", field);
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(sfAction, properties, RestConstants.getInstance().getSALESFORCE_CONNECTION_ID());
    final Step salesforceStep = new Step.Builder().stepKind(StepKind.endpoint).id(UUID.randomUUID().toString()).connection(salesforceConnection).action(generateStepAction(sfAction, connectorDescriptor)).configuredProperties(properties).build();
    steps.getStepDefinitions().add(new StepDefinition(salesforceStep, connectorDescriptor));
}
Also used : Connector(io.syndesis.common.model.connection.Connector) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) Action(io.syndesis.common.model.action.Action) Connection(io.syndesis.common.model.connection.Connection) StepDefinition(io.syndesis.qe.bdd.entities.StepDefinition) Step(io.syndesis.common.model.integration.Step) AbstractStep(io.syndesis.qe.bdd.AbstractStep) Given(cucumber.api.java.en.Given)

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