use of io.syndesis.common.model.connection.Connection in project syndesis by syndesisio.
the class ConnectorTestSupport method newEndpointStep.
protected final Step newEndpointStep(String connectorId, String actionId, Consumer<Connection.Builder> connectionConsumer, Consumer<Step.Builder> stepConsumer) {
Connector connector = resourceManager.mandatoryLoadConnector(connectorId);
ConnectorAction action = resourceManager.mandatoryLookupAction(connector, actionId);
Connection.Builder connectionBuilder = new Connection.Builder().connector(connector);
connectionConsumer.accept(connectionBuilder);
Step.Builder stepBuilder = new Step.Builder().stepKind(StepKind.endpoint).action(action).connection(connectionBuilder.build());
stepConsumer.accept(stepBuilder);
return stepBuilder.build();
}
use of io.syndesis.common.model.connection.Connection in project syndesis by syndesisio.
the class JsonPathIntegrationCustomizerTest method shouldCustomizeProperties.
@Test
public void shouldCustomizeProperties() {
Integration toCustomize = new Integration.Builder().name("test").addConnection(new Connection.Builder().id(UUID.randomUUID().toString()).name("test-connection").putConfiguredProperty("connection-property", "initial").build()).addFlow(new Flow.Builder().steps(Arrays.asList(new Step.Builder().stepKind(StepKind.endpoint).connection(new Connection.Builder().id("timer-connection").connector(new Connector.Builder().id("timer").putProperty("period", new ConfigurationProperty.Builder().kind("property").secret(false).componentProperty(false).build()).build()).build()).putConfiguredProperty("period", "1000").action(new ConnectorAction.Builder().id("periodic-timer-action").descriptor(new ConnectorDescriptor.Builder().connectorId("timer").componentScheme("timer").putConfiguredProperty("timer-name", "syndesis-timer").build()).build()).build(), new Step.Builder().stepKind(StepKind.log).putConfiguredProperty("bodyLoggingEnabled", "false").putConfiguredProperty("contextLoggingEnabled", "false").putConfiguredProperty("customText", "Hello Syndesis!").build())).build()).build();
Assert.assertEquals(toCustomize, new JsonPathIntegrationCustomizer(null, null, null).apply(toCustomize));
Assert.assertEquals("customized", new JsonPathIntegrationCustomizer("$..connection-property", "customized").apply(toCustomize).getConnections().get(0).getConfiguredProperties().get("connection-property"));
Assert.assertEquals("customized", new JsonPathIntegrationCustomizer("$..customText", "customized").apply(toCustomize).getFlows().get(0).getSteps().get(1).getConfiguredProperties().get("customText"));
Assert.assertEquals("foo", new JsonPathIntegrationCustomizer("$..configuredProperties", "new_key", "foo").apply(toCustomize).getFlows().get(0).getSteps().get(1).getConfiguredProperties().get("new_key"));
}
use of io.syndesis.common.model.connection.Connection in project syndesis by syndesisio.
the class ConnectionUpdateHandler method compute.
@Override
protected List<ConnectionBulletinBoard> compute(ChangeEvent event) {
final List<ConnectionBulletinBoard> boards = new ArrayList<>();
final DataManager dataManager = getDataManager();
final List<Connector> connectors = dataManager.fetchAll(Connector.class).getItems();
for (int i = 0; i < connectors.size(); i++) {
final Connector connector = connectors.get(i);
final String id = connector.getId().get();
dataManager.fetchAllByPropertyValue(Connection.class, "connectorId", id).filter(connection -> connection.getConnector().isPresent()).map(connection -> computeBoard(connection, connection.getConnector().get(), connector)).filter(Objects::nonNull).forEach(boards::add);
}
return boards;
}
use of io.syndesis.common.model.connection.Connection in project syndesis by syndesisio.
the class ConnectionUpdateHandlerTest method shouldNotComputeConnectorConfiguredPropertiesAsMissing.
@Test
public void shouldNotComputeConnectorConfiguredPropertiesAsMissing() {
final ConnectionUpdateHandler updateHandler = new ConnectionUpdateHandler(dataManager, null, validator);
final Connection connection = //
new Connection.Builder().id(//
"connection").putConfiguredProperty("req2", //
"value2").build();
final ConfigurationProperty required = new ConfigurationProperty.Builder().required(true).build();
final Connector sameConnector = //
new Connector.Builder().id(//
"new-connector").putProperty("req1", //
required).putProperty("req2", //
required).putConfiguredProperty("req1", //
"value1").build();
when(dataManager.fetchByPropertyValue(ConnectionBulletinBoard.class, "targetResourceId", "connection")).thenReturn(Optional.empty());
final ConnectionBulletinBoard board = updateHandler.computeBoard(connection, sameConnector, sameConnector);
assertThat(board.getMessages()).isEmpty();
}
use of io.syndesis.common.model.connection.Connection in project syndesis by syndesisio.
the class ConnectionsITCase method shouldDetermineValidityForValidConnections.
@Test
public void shouldDetermineValidityForValidConnections() {
final Connection connection = new Connection.Builder().name("Test connection").build();
final ResponseEntity<List<Violation>> got = post("/api/v1/connections/validation", connection, RESPONSE_TYPE, tokenRule.validToken(), HttpStatus.NO_CONTENT);
assertThat(got.getBody()).isNull();
}
Aggregations