use of io.syndesis.common.model.integration.Step in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method getAtlasMappingStep.
public Step getAtlasMappingStep(StepDefinition mapping, List<StepDefinition> precedingSteps, StepDefinition followingStep) {
processPrecedingSteps(precedingSteps);
processFolowingStep(followingStep);
List<DataMapperStepDefinition> mappings = mapping.getDataMapperDefinition().get().getDataMapperStepDefinition();
AtlasMapping atlasMapping = new AtlasMapping();
atlasMapping.setMappings(new Mappings());
for (DataSource s : processSources(precedingSteps)) {
atlasMapping.getDataSource().add(s);
}
atlasMapping.setName("REST." + UUID.randomUUID().toString());
atlasMapping.setLookupTables(new LookupTables());
atlasMapping.setProperties(new Properties());
atlasMapping.getDataSource().add(processTarget(followingStep));
atlasMapping.getMappings().getMapping().addAll(generateBaseMappings(mappings, precedingSteps, followingStep));
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
String mapperString = null;
try {
mapperString = mapper.writeValueAsString(atlasMapping);
log.debug(mapperString);
} catch (JsonProcessingException e) {
log.error("error: {}" + e);
}
final Step mapperStep = new Step.Builder().stepKind(StepKind.mapper).configuredProperties(TestUtils.map("atlasmapping", mapperString)).action(getMapperStepAction(followingStep.getConnectorDescriptor().get())).id(UUID.randomUUID().toString()).build();
return mapperStep;
}
use of io.syndesis.common.model.integration.Step in project syndesis-qe by syndesisio.
the class DataMapperStep method createMapperStep.
/**
* Step used for import of mapping json files. The step definition must contain a json file name, located in folder:
* "resources/mappings"
*
* @param templateName
* @throws IOException
*/
@Given("^create mapper step using template: \"([^\"]*)\"")
public void createMapperStep(String templateName) throws IOException {
final String mapping = new String(Files.readAllBytes(Paths.get("./target/test-classes/mappings/" + templateName + ".json")));
final Step mapperStep = new Step.Builder().stepKind(StepKind.mapper).configuredProperties(TestUtils.map("atlasmapping", mapping)).build();
steps.getStepDefinitions().add(new StepDefinition(mapperStep));
}
use of io.syndesis.common.model.integration.Step 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));
}
use of io.syndesis.common.model.integration.Step 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));
}
use of io.syndesis.common.model.integration.Step 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));
}
Aggregations