Search in sources :

Example 11 with Connection

use of io.syndesis.common.model.connection.Connection in project syndesis-qe by syndesisio.

the class DbSteps method createFinishDbInvokeProcedureStep.

@And("^create finish DB invoke stored procedure \"([^\"]*)\" action step")
public void createFinishDbInvokeProcedureStep(String procedureName) {
    final Connection dbConnection = connectionsEndpoint.get(getDbConnectionId());
    final Connector dbConnector = connectorsEndpoint.get("sql");
    final Action dbAction = TestUtils.findConnectorAction(dbConnector, "sql-stored-connector");
    final Map<String, String> properties = TestUtils.map("procedureName", procedureName);
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(dbAction, properties, dbConnection.getId().get());
    properties.put("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 Step dbStep = new Step.Builder().stepKind(StepKind.endpoint).id(UUID.randomUUID().toString()).connection(dbConnection).action(generateStepAction(TestUtils.findConnectorAction(dbConnector, "sql-stored-connector"), 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) And(cucumber.api.java.en.And)

Example 12 with Connection

use of io.syndesis.common.model.connection.Connection in project syndesis-qe by syndesisio.

the class DbSteps method createDbStepWithInterval.

@Given("^create DB step with query: \"([^\"]*)\" and interval: (\\d+) miliseconds")
public void createDbStepWithInterval(String query, int interval) {
    final Connection dbConnection = connectionsEndpoint.get(getDbConnectionId());
    final Connector dbConnector = connectorsEndpoint.get("sql");
    final Map<String, String> properties = TestUtils.map("query", query, "schedulerExpression", interval);
    final Action dbAction = TestUtils.findConnectorAction(dbConnector, "sql-connector");
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(dbAction, properties, dbConnection.getId().get());
    final Step dbStep = new Step.Builder().stepKind(StepKind.endpoint).connection(dbConnection).id(UUID.randomUUID().toString()).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) Given(cucumber.api.java.en.Given)

Example 13 with Connection

use of io.syndesis.common.model.connection.Connection in project syndesis-qe by syndesisio.

the class S3Steps method createS3PollingStep.

@Given("^create S3 polling step with bucket: \"([^\"]*)\"")
public void createS3PollingStep(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-polling-bucket-connector");
    final Map<String, String> properties = TestUtils.map(TestUtils.map("deleteAfterRead", "false", "maxMessagesPerPoll", "10", "delay", "1000"));
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(s3PollingAction, properties, S3BucketNameBuilder.getBucketName(bucketName));
    final Step s3Step = new Step.Builder().stepKind(StepKind.endpoint).connection(s3Connection).id(UUID.randomUUID().toString()).action(generateStepAction(s3PollingAction, connectorDescriptor)).configuredProperties(properties).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) S3BucketNameBuilder(io.syndesis.qe.utils.S3BucketNameBuilder) 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 14 with Connection

use of io.syndesis.common.model.connection.Connection in project syndesis-qe by syndesisio.

the class TwSteps method createTwitterStep.

@Given("^create TW mention step with \"([^\"]*)\" action")
public void createTwitterStep(String twitterAction) {
    final Connector twitterConnector = connectorsEndpoint.get("twitter");
    final Connection twitterConnection = connectionsEndpoint.get(RestConstants.getInstance().getTWITTER_CONNECTION_ID());
    final Action twAction = TestUtils.findConnectorAction(twitterConnector, twitterAction);
    final ConnectorDescriptor connectorDescriptor = getConnectorDescriptor(twAction, new HashMap<>(), RestConstants.getInstance().getTWITTER_CONNECTION_ID());
    final Step twitterStep = new Step.Builder().stepKind(StepKind.endpoint).connection(twitterConnection).id(UUID.randomUUID().toString()).action(generateStepAction(twAction, connectorDescriptor)).build();
    steps.getStepDefinitions().add(new StepDefinition(twitterStep, 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 15 with Connection

use of io.syndesis.common.model.connection.Connection in project syndesis-qe by syndesisio.

the class ConnectionsGeneralSteps method createS3Connection.

@Given("^create S3 connection using \"([^\"]*)\" bucket")
public void createS3Connection(String s3Bucket) {
    final Connector s3Connector = connectorsEndpoint.get("aws-s3");
    final Account s3Account = accountsDirectory.getAccount("s3").get();
    log.info("Bucket name:  {}", S3BucketNameBuilder.getBucketName(s3Bucket));
    final Connection s3Connection = new Connection.Builder().connector(s3Connector).connectorId(getConnectorId(s3Connector)).id(S3BucketNameBuilder.getBucketName(s3Bucket)).name("New Fuse QE s3 " + S3BucketNameBuilder.getBucketName(s3Bucket)).icon("fa-puzzle-piece").configuredProperties(TestUtils.map("accessKey", s3Account.getProperty("accessKey"), "bucketNameOrArn", S3BucketNameBuilder.getBucketName(s3Bucket), "region", s3Account.getProperty("region"), "secretKey", s3Account.getProperty("secretKey"))).tags(Arrays.asList("aws-s3")).build();
    log.info("Creating s3 connection {}", s3Connection.getName());
    connectionsEndpoint.create(s3Connection);
}
Also used : Connector(io.syndesis.common.model.connection.Connector) Account(io.syndesis.qe.accounts.Account) S3BucketNameBuilder(io.syndesis.qe.utils.S3BucketNameBuilder) Connection(io.syndesis.common.model.connection.Connection) Given(cucumber.api.java.en.Given)

Aggregations

Connection (io.syndesis.common.model.connection.Connection)16 Connector (io.syndesis.common.model.connection.Connector)16 Step (io.syndesis.common.model.integration.Step)12 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)12 Given (cucumber.api.java.en.Given)10 Action (io.syndesis.common.model.action.Action)10 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)10 AbstractStep (io.syndesis.qe.bdd.AbstractStep)9 S3BucketNameBuilder (io.syndesis.qe.utils.S3BucketNameBuilder)5 Account (io.syndesis.qe.accounts.Account)4 And (cucumber.api.java.en.And)3 Then (cucumber.api.java.en.Then)3 MappingType (io.atlasmap.v2.MappingType)1 Integration (io.syndesis.common.model.integration.Integration)1 StepKind (io.syndesis.common.model.integration.StepKind)1 AtlasMapperGenerator (io.syndesis.qe.bdd.datamapper.AtlasMapperGenerator)1 DataMapperDefinition (io.syndesis.qe.bdd.entities.DataMapperDefinition)1 DataMapperStepDefinition (io.syndesis.qe.bdd.entities.DataMapperStepDefinition)1 StepsStorage (io.syndesis.qe.bdd.storage.StepsStorage)1 ConnectionsEndpoint (io.syndesis.qe.endpoints.ConnectionsEndpoint)1