Search in sources :

Example 26 with ConnectorDescriptor

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

the class ConnectionActionHandlerTest method shouldNotContactVerifierForNonDynamicActions.

@Test
public void shouldNotContactVerifierForNonDynamicActions() {
    final ConnectorDescriptor defaultDefinition = new ConnectorDescriptor.Builder().build();
    final Response response = handler.enrichWithMetadata(SALESFORCE_LIMITS, null);
    assertThat(response.getStatus()).isEqualTo(Status.OK.getStatusCode());
    @SuppressWarnings("unchecked") final Meta<ConnectorDescriptor> returnValue = (Meta<ConnectorDescriptor>) response.getEntity();
    assertThat(returnValue.getValue()).isEqualTo(defaultDefinition);
}
Also used : Response(javax.ws.rs.core.Response) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) Meta(io.syndesis.server.endpoint.v1.dto.Meta) Test(org.junit.Test)

Example 27 with ConnectorDescriptor

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

the class GenerateMetadataMojo method generateAtlasMapInspections.

// ****************************************
// Inspections
// ****************************************
/**
 * Generate atlasmap inspections, no matter if they come from annotations or they are written directly into source json
 */
private void generateAtlasMapInspections() throws MojoExecutionException {
    try {
        Map<String, Action> processedActions = new TreeMap<>();
        for (Map.Entry<String, Action> actionEntry : actions.entrySet()) {
            Optional<DataShape> input = generateInspections(actionEntry.getKey(), actionEntry.getValue().getInputDataShape());
            Optional<DataShape> output = generateInspections(actionEntry.getKey(), actionEntry.getValue().getOutputDataShape());
            Action newAction;
            if (Action.TYPE_CONNECTOR.equals(actionEntry.getValue().getActionType())) {
                newAction = new ConnectorAction.Builder().createFrom((ConnectorAction) actionEntry.getValue()).descriptor(new ConnectorDescriptor.Builder().createFrom((ConnectorDescriptor) actionEntry.getValue().getDescriptor()).inputDataShape(input).outputDataShape(output).build()).build();
            } else if (Action.TYPE_STEP.equals(actionEntry.getValue().getActionType())) {
                newAction = new StepAction.Builder().createFrom((StepAction) actionEntry.getValue()).descriptor(new StepDescriptor.Builder().createFrom((StepDescriptor) actionEntry.getValue().getDescriptor()).inputDataShape(input).outputDataShape(output).build()).build();
            } else {
                throw new IllegalArgumentException("Unsupported action type: " + actionEntry.getValue().getActionType());
            }
            processedActions.put(actionEntry.getKey(), newAction);
        }
        this.actions = processedActions;
    } catch (@SuppressWarnings("PMD.AvoidCatchingGenericException") Exception ex) {
        throw new MojoExecutionException("Error processing atlasmap inspections", ex);
    }
}
Also used : StepAction(io.syndesis.common.model.action.StepAction) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) Action(io.syndesis.common.model.action.Action) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) TreeMap(java.util.TreeMap) DataShape(io.syndesis.common.model.DataShape) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException) ConnectorDescriptor(io.syndesis.common.model.action.ConnectorDescriptor) StepAction(io.syndesis.common.model.action.StepAction) StepDescriptor(io.syndesis.common.model.action.StepDescriptor) ConnectorAction(io.syndesis.common.model.action.ConnectorAction) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

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