Search in sources :

Example 1 with ConnectorDescriptor

use of io.syndesis.common.model.action.ConnectorDescriptor in project syndesis-qe by syndesisio.

the class DbSteps method createStartDbPeriodicProcedureStep.

@Then("^create start DB periodic stored procedure invocation action step named \"([^\"]*)\" and period \"([^\"]*)\" ms")
public void createStartDbPeriodicProcedureStep(String procedureName, Integer ms) {
    final Connection dbConnection = connectionsEndpoint.get(getDbConnectionId());
    final Connector dbConnector = connectorsEndpoint.get("sql");
    final Action dbAction = TestUtils.findConnectorAction(dbConnector, "sql-stored-start-connector");
    final Map<String, String> properties = TestUtils.map("procedureName", procedureName, "schedulerExpression", ms, "template", "add_lead(VARCHAR ${body[first_and_last_name]}, VARCHAR ${body[company]}, VARCHAR ${body[phone]}, VARCHAR ${body[email]}, " + "VARCHAR ${body[lead_source]}, VARCHAR ${body[lead_status]}, VARCHAR ${body[rating]})");
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(dbAction, properties, dbConnection.getId().get());
    final Step dbStep = new Step.Builder().stepKind(StepKind.endpoint).id(UUID.randomUUID().toString()).connection(dbConnection).action(generateStepAction(dbAction, connectorDescriptor)).configuredProperties(properties).build();
    steps.getStepDefinitions().add(new StepDefinition(dbStep, 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) Then(cucumber.api.java.en.Then)

Example 2 with ConnectorDescriptor

use of io.syndesis.common.model.action.ConnectorDescriptor in project syndesis-qe by syndesisio.

the class DbSteps method createStartDbPeriodicSqlStep.

@Then("^create start DB periodic sql invocation action step with query \"([^\"]*)\" and period \"([^\"]*)\" ms")
public void createStartDbPeriodicSqlStep(String sqlQuery, Integer ms) {
    final Connection dbConnection = connectionsEndpoint.get(getDbConnectionId());
    final Connector dbConnector = connectorsEndpoint.get("sql");
    final Action dbAction = TestUtils.findConnectorAction(dbConnector, "sql-start-connector");
    final Map<String, String> properties = TestUtils.map("query", sqlQuery, "schedulerExpression", ms);
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(dbAction, properties, dbConnection.getId().get());
    // to be reported: period is not part of .json step (when checked via browser).
    final Step dbStep = new Step.Builder().stepKind(StepKind.endpoint).id(UUID.randomUUID().toString()).connection(dbConnection).action(generateStepAction(dbAction, connectorDescriptor)).configuredProperties(properties).build();
    steps.getStepDefinitions().add(new StepDefinition(dbStep, 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) Then(cucumber.api.java.en.Then)

Example 3 with ConnectorDescriptor

use of io.syndesis.common.model.action.ConnectorDescriptor 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 4 with ConnectorDescriptor

use of io.syndesis.common.model.action.ConnectorDescriptor 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)

Example 5 with ConnectorDescriptor

use of io.syndesis.common.model.action.ConnectorDescriptor in project syndesis by syndesisio.

the class BaseSwaggerConnectorGenerator method configureConnector.

protected final Connector configureConnector(final ConnectorTemplate connectorTemplate, final Connector connector, final ConnectorSettings connectorSettings) {
    final Connector.Builder builder = new Connector.Builder().createFrom(connector);
    final SwaggerModelInfo info = parseSpecification(connectorSettings, false);
    final Swagger swagger = info.getModel();
    addGlobalParameters(builder, swagger);
    final Map<String, Path> paths = swagger.getPaths();
    final String connectorId = connector.getId().get();
    final String connectorGav = connectorTemplate.getCamelConnectorGAV();
    final String connectorScheme = connectorTemplate.getCamelConnectorPrefix();
    final List<ConnectorAction> actions = new ArrayList<>();
    int idx = 0;
    for (final Entry<String, Path> pathEntry : paths.entrySet()) {
        final Path path = pathEntry.getValue();
        final Map<HttpMethod, Operation> operationMap = path.getOperationMap();
        for (final Entry<HttpMethod, Operation> entry : operationMap.entrySet()) {
            final Operation operation = entry.getValue();
            if (operation.getOperationId() == null) {
                operation.operationId("operation-" + idx++);
            }
            final ConnectorDescriptor descriptor = // 
            createDescriptor(info.getResolvedSpecification(), swagger, operation).camelConnectorGAV(// 
            connectorGav).camelConnectorPrefix(// 
            connectorScheme).connectorId(// 
            connectorId).build();
            final OperationDescription description = SwaggerHelper.operationDescriptionOf(swagger, operation);
            final ConnectorAction action = // 
            new ConnectorAction.Builder().id(// 
            createActionId(connectorId, connectorGav, operation)).name(// 
            description.name).description(// 
            description.description).pattern(// 
            Action.Pattern.To).descriptor(descriptor).tags(// 
            ofNullable(operation.getTags()).orElse(Collections.emptyList())).build();
            actions.add(action);
        }
    }
    actions.sort(ActionComparator.INSTANCE);
    builder.addAllActions(actions);
    builder.putConfiguredProperty("specification", SwaggerHelper.serialize(swagger));
    return builder.build();
}
Also used : Path(io.swagger.models.Path) Connector(io.syndesis.common.model.connection.Connector) ArrayList(java.util.ArrayList) Operation(io.swagger.models.Operation) OperationDescription(io.syndesis.server.connector.generator.swagger.util.OperationDescription) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) Swagger(io.swagger.models.Swagger) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) HttpMethod(io.swagger.models.HttpMethod)

Aggregations

ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)27 Connector (io.syndesis.common.model.connection.Connector)18 Connection (io.syndesis.common.model.connection.Connection)15 Step (io.syndesis.common.model.integration.Step)12 Action (io.syndesis.common.model.action.Action)11 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)11 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)10 AbstractStep (io.syndesis.qe.bdd.AbstractStep)9 Map (java.util.Map)8 ConfigurationProperty (io.syndesis.common.model.connection.ConfigurationProperty)7 Test (org.junit.Test)7 HystrixInvokableInfo (com.netflix.hystrix.HystrixInvokableInfo)6 Given (cucumber.api.java.en.Given)6 DataShape (io.syndesis.common.model.DataShape)6 Meta (io.syndesis.server.endpoint.v1.dto.Meta)6 HashMap (java.util.HashMap)6 Response (javax.ws.rs.core.Response)6 DynamicActionMetadata (io.syndesis.common.model.connection.DynamicActionMetadata)5 DataShapeKinds (io.syndesis.common.model.DataShapeKinds)4 IOException (java.io.IOException)4