use of io.syndesis.common.model.integration.Integration in project syndesis-qe by syndesisio.
the class IntegrationHandler method processMapperSteps.
/**
* This should be updated for more than two steps, when it will work correctly in near future.
*/
private void processMapperSteps() {
List<StepDefinition> mappers = steps.getStepDefinitions().stream().filter(s -> s.getStep().getStepKind().equals(StepKind.mapper)).collect(Collectors.toList());
if (mappers.isEmpty()) {
log.debug("There are no mappers in this integration, proceeding...");
} else {
// mapping can be done on steps that preceed mapper step and the single step, which follows the mapper step.
log.info("Found mapper step, creating new atlas mapping.");
for (int i = 0; i < mappers.size(); i++) {
List<StepDefinition> precedingSteps = steps.getStepDefinitions().subList(0, steps.getStepDefinitions().indexOf(mappers.get(i))).stream().filter(s -> s.getConnectorDescriptor().isPresent()).collect(Collectors.toList());
StepDefinition followingStep = steps.getStepDefinitions().get(steps.getStepDefinitions().indexOf(mappers.get(i)) + 1);
if (mappers.get(i).getStep().getConfiguredProperties().containsKey("atlasmapping")) {
// TODO(tplevko): think of some way to substitute placeholders for the step ID's
reflectStepIdsInAtlasMapping(mappers.get(i), precedingSteps, followingStep);
} else {
// TODO(tplevko): fix for more than one preceding step.
mappers.get(i).setStep(atlasGenerator.getAtlasMappingStep(mappers.get(i), precedingSteps, followingStep));
}
}
}
}
use of io.syndesis.common.model.integration.Integration in project syndesis-qe by syndesisio.
the class IntegrationHandler method sameNameIntegrationValidation.
@Then("^try to create new integration with the same name: \"([^\"]*)\" and state: \"([^\"]*)\"$")
public void sameNameIntegrationValidation(String integrationName, String desiredState) {
final Integration integration = new Integration.Builder().steps(steps.getSteps()).name(integrationName).description("Awkward integration.").build();
log.info("Creating integration {}", integration.getName());
Assertions.assertThatExceptionOfType(BadRequestException.class).isThrownBy(() -> {
integrationsEndpoint.create(integration);
}).withMessageContaining("HTTP 400 Bad Request").withNoCause();
log.debug("Flushing used steps");
steps.flushStepDefinitions();
}
use of io.syndesis.common.model.integration.Integration in project syndesis-qe by syndesisio.
the class IntegrationActivityListComponent method getIdByIntegrationName.
private String getIdByIntegrationName(String integrationName) {
List<Integration> integrations = integrationsEndpoint.list();
Integration integr = integrations.stream().filter(integration -> integrationName.equals(integration.getName())).findAny().orElse(null);
return integr.getId().get();
}
use of io.syndesis.common.model.integration.Integration in project syndesis-qe by syndesisio.
the class UiComplexSteps method processMapperSteps.
private void processMapperSteps() {
List<StepDefinition> mappers = steps.getStepDefinitions().stream().filter(s -> s.getStep().getStepKind().equals(StepKind.mapper)).collect(Collectors.toList());
if (mappers.isEmpty()) {
log.debug("There are no mappers in this integration, proceeding...");
} else {
// mapping can be done on steps that preceed mapper step and the single step, which follows the mapper step.
log.info("Found mapper step, creating new atlas mapping.");
for (int i = 0; i < mappers.size(); i++) {
List<StepDefinition> precedingSteps = steps.getStepDefinitions().subList(0, steps.getStepDefinitions().indexOf(mappers.get(i))).stream().filter(s -> s.getConnectorDescriptor().isPresent()).collect(Collectors.toList());
StepDefinition followingStep = steps.getStepDefinitions().get(steps.getStepDefinitions().indexOf(mappers.get(i)) + 1);
if (mappers.get(i).getStep().getConfiguredProperties().containsKey("atlasmapping")) {
// TODO(tplevko): think of some way to substitute placeholders for the step ID's
reflectStepIdsInAtlasMapping(mappers.get(i), precedingSteps, followingStep);
} else {
// TODO(tplevko): fix for more than one preceding step.
mappers.get(i).setStep(atlasGenerator.getAtlasMappingStep(mappers.get(i), precedingSteps, followingStep));
}
}
}
}
use of io.syndesis.common.model.integration.Integration in project syndesis-qe by syndesisio.
the class CommonValidationSteps method waitForIntegrationToBeActive.
@Then("^wait for integration with name: \"([^\"]*)\" to become active")
public void waitForIntegrationToBeActive(String integrationName) {
final List<Integration> integrations = integrationsEndpoint.list().stream().filter(item -> item.getName().equals(integrationName)).collect(Collectors.toList());
final long start = System.currentTimeMillis();
// wait for activation
log.info("Waiting until integration \"{}\" becomes active. This may take a while...", integrationName);
String integrationId = integrationsEndpoint.getIntegrationId(integrationName).get();
integrationOverviewEndpoint = new IntegrationOverviewEndpoint(integrationId);
final IntegrationOverview integrationOverview = integrationOverviewEndpoint.getOverview();
final boolean activated = TestUtils.waitForPublishing(integrationOverviewEndpoint, integrationOverview, TimeUnit.MINUTES, 10);
Assertions.assertThat(activated).isEqualTo(true);
log.info("Integration pod has been started. It took {}s to build the integration.", TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - start));
}
Aggregations