@Test public void shouldOrderActionsBasedOnTags() { final ConnectorAction a = new ConnectorAction.Builder().addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().addTag("c").build(); final ConnectorAction noTags = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTags, a, b)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTags); }
@Test public void shouldOrderActionsBasedOnTags() { final ConnectorAction a = new ConnectorAction.Builder().addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().addTag("c").build(); final ConnectorAction noTags = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTags, a, b)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTags); }
@Test public void shouldOrderActionsBasedOnTagsAndName() { final ConnectorAction a = new ConnectorAction.Builder().name("a").addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().name("b").addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().name("c").addTag("b").build(); final ConnectorAction noTagsA = new ConnectorAction.Builder().name("a").build(); final ConnectorAction noTagsB = new ConnectorAction.Builder().name("b").build(); final ConnectorAction noTagsNoName = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTagsA, a, noTagsB, b, noTagsNoName)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTagsA, noTagsB, noTagsNoName); } }
.split(new Split.Builder().build()) .build()) .build()) .build(), new Step.Builder() .putConfiguredProperty("beanName", "io.syndesis.integration.runtime.IntegrationRouteTest.TestConfiguration") .build()) .build()) .build(), new Step.Builder() .putConfiguredProperty("name", "result") .build()) .build()) .build());
protected Step newSqlEndpointStep(String actionId, Consumer<Step.Builder> stepConsumer, Consumer<ConnectorDescriptor.Builder> descriptorConsumer) { final Connector connector = getResourceManager().mandatoryLoadConnector("sql"); final ConnectorAction action = getResourceManager().mandatoryLookupAction(connector, actionId); final ConnectorDescriptor.Builder descriptorBuilder = new ConnectorDescriptor.Builder().createFrom(action.getDescriptor()); descriptorConsumer.accept(descriptorBuilder); final Step.Builder builder = new Step.Builder() .stepKind(StepKind.endpoint) .action(new ConnectorAction.Builder().createFrom(action).descriptor(descriptorBuilder.build()).build()) .connection(new io.syndesis.common.model.connection.Connection.Builder() .connector(connector) .putConfiguredProperty("user", db.properties.getProperty("sql-connector.user")) .putConfiguredProperty("password", db.properties.getProperty("sql-connector.password")) .putConfiguredProperty("url", db.properties.getProperty("sql-connector.url")) .build()); stepConsumer.accept(builder); return builder.build(); } }
private Connector newSqlConnector() { ConnectorAction action1 = new ConnectorAction.Builder() .id(SQL_CONNECTOR_ACTION_ID) .actionType("connector") .description("Invoke SQL to obtain ...") .name("Invoke SQL") .addTag("dynamic") .pattern(Pattern.To) .build(); return new Connector.Builder() .id(CONNECTOR_ID) .name(SQL_CONNECTOR_NAME) .addAction(action1) .build(); }
@Test public void shouldNotExposeWebHooksVia3scaleWhen3scaleIsEnabled() { final ControllersConfigurationProperties properties = new ControllersConfigurationProperties(); properties.setExposeVia3scale(true); final ExposureDeploymentDataCustomizer customizer = new ExposureDeploymentDataCustomizer(properties); final IntegrationDeployment webHookIntegration = new IntegrationDeployment.Builder() .spec(new Integration.Builder() .addFlow(new Flow.Builder().addStep(new Step.Builder().action(new ConnectorAction.Builder() .descriptor(new ConnectorDescriptor.Builder().connectorId("webhook").build()).addTag("expose") .build()).build()).build()) .build()) .build(); assertThat(customizer.determineExposure(webHookIntegration)).containsOnly(Exposure.SERVICE, Exposure.ROUTE); } }
private Step newSqlStep(Connection connection) { ConnectorAction action = new ConnectorAction.Builder() .actionType("connector") .id(SQL_CONNECTOR_ACTION_ID) .name("Invoke SQL") .pattern(Pattern.To) .addTag("dynamic") .build(); return new Step.Builder() .connection(connection) .id("SomeLongId") .action(action) .build(); }
@Test public void shouldOrderActionsBasedOnTagsAndName() { final ConnectorAction a = new ConnectorAction.Builder().name("a").addTag("a").build(); final ConnectorAction b = new ConnectorAction.Builder().name("b").addTag("b").build(); final ConnectorAction c = new ConnectorAction.Builder().name("c").addTag("b").build(); final ConnectorAction noTagsA = new ConnectorAction.Builder().name("a").build(); final ConnectorAction noTagsB = new ConnectorAction.Builder().name("b").build(); final ConnectorAction noTagsNoName = new ConnectorAction.Builder().build(); final List<ConnectorAction> actions = new ArrayList<>(Arrays.asList(c, noTagsA, a, noTagsB, b, noTagsNoName)); Collections.shuffle(actions); actions.sort(ActionComparator.INSTANCE); assertThat(actions).containsExactly(a, b, c, noTagsA, noTagsB, noTagsNoName); } }
/** * Creates an immutable copy of a {@link ConnectorAction} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable ConnectorAction instance */ public static ConnectorAction copyOf(ConnectorAction instance) { if (instance instanceof ImmutableConnectorAction) { return (ImmutableConnectorAction) instance; } return new ConnectorAction.Builder() .createFrom(instance) .build(); }
private static Connection dummyConnection() { Connector connector = new Connector.Builder() .addAction( new ConnectorAction.Builder().id("fromAction") .descriptor(new ConnectorDescriptor.Builder().build()) .build()) .addAction( new ConnectorAction.Builder().id("toAction") .descriptor(new ConnectorDescriptor.Builder().build()) .build()) .build(); return new Connection.Builder().connector(connector).build(); } }
protected final Step newSimpleEndpointStep(String scheme, Consumer<ConnectorDescriptor.Builder> consumer) { ConnectorDescriptor.Builder builder = new ConnectorDescriptor.Builder().componentScheme(scheme); consumer.accept(builder); return new Step.Builder() .stepKind(StepKind.endpoint) .action(new ConnectorAction.Builder() .descriptor(builder.build()) .build()) .build(); }
@Override default ConnectorAction withId(String id) { return new Builder().createFrom(this).id(id).build(); }
private static ConnectorAction newActionBy(final Connector connector) { return new ConnectorAction.Builder()// .descriptor(// new ConnectorDescriptor.Builder()// .connectorId(connector.getId().get())// .build())// .build(); }