Search in sources :

Example 81 with Connection

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();
}
Also used : Connector(io.syndesis.common.model.connection.Connector) Connection(io.syndesis.common.model.connection.Connection) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) Step(io.syndesis.common.model.integration.Step)

Example 82 with Connection

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"));
}
Also used : ConfigurationProperty(io.syndesis.common.model.connection.ConfigurationProperty) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) Integration(io.syndesis.common.model.integration.Integration) Connection(io.syndesis.common.model.connection.Connection) Test(org.junit.Test)

Example 83 with Connection

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;
}
Also used : LeveledMessage(io.syndesis.common.model.bulletin.LeveledMessage) Arrays(java.util.Arrays) KeyGenerator(io.syndesis.common.util.KeyGenerator) Kind(io.syndesis.common.model.Kind) Validator(javax.validation.Validator) Connector(io.syndesis.common.model.connection.Connector) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Objects(java.util.Objects) List(java.util.List) EncryptionComponent(io.syndesis.server.dao.manager.EncryptionComponent) Connection(io.syndesis.common.model.connection.Connection) ConnectionBulletinBoard(io.syndesis.common.model.bulletin.ConnectionBulletinBoard) Map(java.util.Map) DataManager(io.syndesis.server.dao.manager.DataManager) ChangeEvent(io.syndesis.common.model.ChangeEvent) Connector(io.syndesis.common.model.connection.Connector) ArrayList(java.util.ArrayList) DataManager(io.syndesis.server.dao.manager.DataManager) ConnectionBulletinBoard(io.syndesis.common.model.bulletin.ConnectionBulletinBoard)

Example 84 with Connection

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();
}
Also used : ConfigurationProperty(io.syndesis.common.model.connection.ConfigurationProperty) Connector(io.syndesis.common.model.connection.Connector) Connection(io.syndesis.common.model.connection.Connection) ConnectionBulletinBoard(io.syndesis.common.model.bulletin.ConnectionBulletinBoard) Test(org.junit.Test)

Example 85 with Connection

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();
}
Also used : Connection(io.syndesis.common.model.connection.Connection) List(java.util.List) Test(org.junit.Test)

Aggregations

Connection (io.syndesis.common.model.connection.Connection)111 Connector (io.syndesis.common.model.connection.Connector)65 Test (org.junit.Test)48 Step (io.syndesis.common.model.integration.Step)40 Integration (io.syndesis.common.model.integration.Integration)38 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)26 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)26 List (java.util.List)24 HashMap (java.util.HashMap)21 Action (io.syndesis.common.model.action.Action)18 ConfigurationProperty (io.syndesis.common.model.connection.ConfigurationProperty)18 ArrayList (java.util.ArrayList)17 Map (java.util.Map)16 IOException (java.io.IOException)14 InputStream (java.io.InputStream)14 IntegrationDeployment (io.syndesis.common.model.integration.IntegrationDeployment)13 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)12 DataManager (io.syndesis.server.dao.manager.DataManager)11 Given (cucumber.api.java.en.Given)10 Flow (io.syndesis.common.model.integration.Flow)10