Search in sources :

Example 11 with ConnectorDescriptor

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

the class ConnectionActionHandlerTest method shouldSetInoutOutputShapesToAnyIfMetadataCallFails.

@Test
public void shouldSetInoutOutputShapesToAnyIfMetadataCallFails() {
    @SuppressWarnings({ "unchecked", "rawtypes" }) final Class<Entity<Map<String, Object>>> entityType = (Class) Entity.class;
    ArgumentCaptor.forClass(entityType);
    // simulates fallback return
    final DynamicActionMetadata fallback = new DynamicActionMetadata.Builder().build();
    when(metadataCommand.execute()).thenReturn(fallback);
    when(((HystrixInvokableInfo<?>) metadataCommand).isSuccessfulExecution()).thenReturn(false);
    final Response response = handler.enrichWithMetadata(SALESFORCE_CREATE_OR_UPDATE, Collections.emptyMap());
    @SuppressWarnings("unchecked") final Meta<ConnectorDescriptor> meta = (Meta<ConnectorDescriptor>) response.getEntity();
    final ConnectorDescriptor descriptor = meta.getValue();
    assertThat(descriptor.getInputDataShape()).contains(ConnectionActionHandler.ANY_SHAPE);
    assertThat(descriptor.getOutputDataShape()).contains(salesforceOutputShape);
}
Also used : Entity(javax.ws.rs.client.Entity) Meta(io.syndesis.server.endpoint.v1.dto.Meta) DynamicActionMetadata(io.syndesis.common.model.connection.DynamicActionMetadata) Response(javax.ws.rs.core.Response) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) HystrixInvokableInfo(com.netflix.hystrix.HystrixInvokableInfo) Test(org.junit.Test)

Example 12 with ConnectorDescriptor

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

the class DbSteps method createFinishDbInvokeSqlStep.

@Then("^create finish DB invoke sql action step with query \"([^\"]*)\"")
public void createFinishDbInvokeSqlStep(String sqlQuery) {
    final Connection dbConnection = connectionsEndpoint.get(getDbConnectionId());
    final Connector dbConnector = connectorsEndpoint.get("sql");
    final Action dbAction = TestUtils.findConnectorAction(dbConnector, "sql-connector");
    final Map<String, String> properties = TestUtils.map("query", sqlQuery);
    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 13 with ConnectorDescriptor

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

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

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

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