Search in sources :

Example 1 with Connection

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

the class ConnectionsGeneralSteps method createTwitterConnection.

@Given("^create the TW connection using \"([^\"]*)\" template")
public void createTwitterConnection(String twitterTemplate) {
    final Connector twitterConnector = connectorsEndpoint.get("twitter");
    final Account twitterAccount = accountsDirectory.getAccount(twitterTemplate).get();
    log.info("Template name:  {}", twitterTemplate);
    final Connection twitterConnection = new Connection.Builder().connector(twitterConnector).connectorId(getConnectorId(twitterConnector)).id(RestConstants.getInstance().getTWITTER_CONNECTION_ID()).name("New Fuse QE twitter listen").configuredProperties(TestUtils.map("accessToken", twitterAccount.getProperty("accessToken"), "accessTokenSecret", twitterAccount.getProperty("accessTokenSecret"), "consumerKey", twitterAccount.getProperty("consumerKey"), "consumerSecret", twitterAccount.getProperty("consumerSecret"))).icon("fa-twitter").tags(Arrays.asList("twitter")).build();
    log.info("Creating twitter connection {}", twitterConnection.getName());
    connectionsEndpoint.create(twitterConnection);
}
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)

Example 2 with Connection

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

the class ConnectionsGeneralSteps method createFtpConnection.

@Given("^create the FTP connection using \"([^\"]*)\" template")
public void createFtpConnection(String ftpTemplate) {
    connectionsEndpoint.list().forEach(c -> log.info(c.getName()));
    final Connector ftpConnector = connectorsEndpoint.get("ftp");
    final Account ftpAccount = accountsDirectory.getAccount(ftpTemplate).get();
    log.info("Template name:  {}", ftpTemplate);
    final Connection ftpConnection = new Connection.Builder().connector(ftpConnector).connectorId(getConnectorId(ftpConnector)).id(RestConstants.getInstance().getFTP_CONNECTION_ID()).name("New Fuse QE FTP").configuredProperties(TestUtils.map(// "disconnect", ftpAccount.getProperty("disconnect"),
    "host", ftpAccount.getProperty("host"), // "password", ftpAccount.getProperty("password"),
    "port", ftpAccount.getProperty("port"))).icon("fa-ftp").tags(Arrays.asList("ftp")).build();
    log.info("Creating ftp connection {}", ftpConnection.getName());
    connectionsEndpoint.create(ftpConnection);
}
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)

Example 3 with Connection

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

the class ConnectionsGeneralSteps method createSalesforceConnection.

@Given("^create SF connection")
public void createSalesforceConnection() {
    final Account salesforceAccount = accountsDirectory.getAccount("salesforce").get();
    final Connector salesforceConnector = connectorsEndpoint.get("salesforce");
    final Connection salesforceConnection = new Connection.Builder().connector(salesforceConnector).connectorId(getConnectorId(salesforceConnector)).id(RestConstants.getInstance().getSALESFORCE_CONNECTION_ID()).icon("fa-puzzle-piece").name("New Fuse QE salesforce").configuredProperties(TestUtils.map("clientId", salesforceAccount.getProperty("clientId"), "clientSecret", salesforceAccount.getProperty("clientSecret"), "loginUrl", salesforceAccount.getProperty("loginUrl"), "userName", salesforceAccount.getProperty("userName"), "password", salesforceAccount.getProperty("password"))).tags(Arrays.asList("salesforce")).build();
    log.info("Creating salesforce connection {}", salesforceConnection.getName());
    connectionsEndpoint.create(salesforceConnection);
}
Also used : Account(io.syndesis.qe.accounts.Account) Connector(io.syndesis.common.model.connection.Connector) S3BucketNameBuilder(io.syndesis.qe.utils.S3BucketNameBuilder) Connection(io.syndesis.common.model.connection.Connection) Given(cucumber.api.java.en.Given)

Example 4 with Connection

use of io.syndesis.common.model.connection.Connection 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 5 with Connection

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

Aggregations

Connection (io.syndesis.common.model.connection.Connection)58 Connector (io.syndesis.common.model.connection.Connector)30 Step (io.syndesis.common.model.integration.Step)22 Test (org.junit.Test)21 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)14 Action (io.syndesis.common.model.action.Action)12 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)12 Integration (io.syndesis.common.model.integration.Integration)11 Given (cucumber.api.java.en.Given)10 List (java.util.List)10 AbstractStep (io.syndesis.qe.bdd.AbstractStep)9 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)7 ArrayList (java.util.ArrayList)7 ConfigurationProperty (io.syndesis.common.model.connection.ConfigurationProperty)5 S3BucketNameBuilder (io.syndesis.qe.utils.S3BucketNameBuilder)5 DataManager (io.syndesis.server.dao.manager.DataManager)5 Violation (io.syndesis.common.model.Violation)4 Extension (io.syndesis.common.model.extension.Extension)4 Account (io.syndesis.qe.accounts.Account)4 InputStream (java.io.InputStream)4