@Test public void testKnativeCustomizerChannels() throws IOException { Connector connector; ConnectorAction sinkAction; ConnectorAction sourceAction; try (InputStream is = KnativeCustomizerTest.class.getResourceAsStream("/META-INF/syndesis/connector/knative.json")) { connector = JsonUtils.readFromStream(is, Connector.class); sinkAction = connector.getActions(ConnectorAction.class).stream() .filter(a -> a.getId().get().equals("io.syndesis:knative-channel-send-connector")) .findFirst() .orElseThrow(() -> new IllegalArgumentException()); sourceAction = connector.getActions(ConnectorAction.class).stream() .filter(a -> a.getId().get().equals("io.syndesis:knative-channel-receive-connector")) .findFirst() .orElseThrow(() -> new IllegalArgumentException()); } TestResourceManager manager = new TestResourceManager(); Integration integration = manager.newIntegration( new Step.Builder() .stepKind(StepKind.endpoint) .putConfiguredProperty("name", "my-channel-sink") .action(sinkAction) .connection(new Connection.Builder() .connector(connector) .build()) .build(), new Step.Builder() .stepKind(StepKind.endpoint) .putConfiguredProperty("name", "my-channel-source") .action(sourceAction) .connection(new Connection.Builder() .connector(connector) .build()) .build() ); IntegrationDeployment deployment = new IntegrationDeployment.Builder() .userId("user") .id("idId") .spec(integration) .build(); CamelKIntegrationCustomizer customizer = new KnativeCustomizer(); io.syndesis.server.controller.integration.camelk.crd.Integration i = customizer.customize( deployment, new io.syndesis.server.controller.integration.camelk.crd.Integration(), EnumSet.of(Exposure.SERVICE) ); assertThat(i.getSpec().getTraits()).containsKey("knative"); assertThat(i.getSpec().getTraits().get("knative").getConfiguration()).containsOnly( entry("enabled", "true"), entry("channel-sources", "my-channel-source"), entry("channel-sinks", "my-channel-sink"), entry("endpoint-sources", "default"), entry("endpoint-sinks", "") ); }
@Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures) { customizeSourceSink(deployment, integration); customizeService(deployment, integration); return integration; }
KnativeCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures) { customizeSourceSink(deployment, integration); customizeService(deployment, integration); return integration; } }
KnativeCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures) { customizeSourceSink(deployment, integration); customizeService(deployment, integration); return integration; }  }
KnativeCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures) { customizeSourceSink(deployment, integration); customizeService(deployment, integration); return integration; }  @Override Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures); }
KnativeCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures) { customizeSourceSink(deployment, integration); customizeService(deployment, integration); return integration; }  @Override Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposures);  }