use of io.syndesis.server.controller.integration.camelk.TestResourceManager in project syndesis by syndesisio.
the class CamelVersionCustomizerTest method testCamelVersionCustomizer.
@Test
public void testCamelVersionCustomizer() {
VersionService versionService = new VersionService();
TestResourceManager manager = new TestResourceManager();
Integration integration = manager.newIntegration();
IntegrationDeployment deployment = new IntegrationDeployment.Builder().userId("user").id("idId").spec(integration).build();
CamelKIntegrationCustomizer customizer = new CamelVersionCustomizer(versionService);
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("camel");
assertThat(i.getSpec().getTraits().get("camel").getConfiguration()).containsOnly(entry("version", versionService.getCamelVersion()), entry("runtime-version", versionService.getCamelkRuntimeVersion()));
}
use of io.syndesis.server.controller.integration.camelk.TestResourceManager in project syndesis by syndesisio.
the class ExposureCustomizerTest method testExposureCustomizerWithRouteExposure.
@Test
public void testExposureCustomizerWithRouteExposure() {
TestResourceManager manager = new TestResourceManager();
Integration integration = manager.newIntegration();
IntegrationDeployment deployment = new IntegrationDeployment.Builder().userId("user").id("idId").spec(integration).build();
CamelKIntegrationCustomizer customizer = new ExposureCustomizer();
io.syndesis.server.controller.integration.camelk.crd.Integration i = customizer.customize(deployment, new io.syndesis.server.controller.integration.camelk.crd.Integration(), EnumSet.of(Exposure.ROUTE));
assertThat(i.getMetadata().getLabels()).isNullOrEmpty();
assertThat(i.getMetadata().getAnnotations()).isNullOrEmpty();
assertThat(i.getSpec().getTraits()).doesNotContainKey("service");
assertThat(i.getSpec().getTraits()).containsKey("route");
assertThat(i.getSpec().getTraits().get("route").getConfiguration()).containsOnly(entry("enabled", "true"), entry("tls-termination", "edge"));
}
use of io.syndesis.server.controller.integration.camelk.TestResourceManager in project syndesis by syndesisio.
the class ExposureCustomizerTest method testExposureCustomizerWithServiceExposure.
@Test
public void testExposureCustomizerWithServiceExposure() {
TestResourceManager manager = new TestResourceManager();
Integration integration = manager.newIntegration();
IntegrationDeployment deployment = new IntegrationDeployment.Builder().userId("user").id("idId").spec(integration).build();
CamelKIntegrationCustomizer customizer = new ExposureCustomizer();
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.getMetadata().getLabels()).isNullOrEmpty();
assertThat(i.getMetadata().getAnnotations()).isNullOrEmpty();
assertThat(i.getSpec().getTraits()).doesNotContainKey("route");
assertThat(i.getSpec().getTraits()).containsKey("service");
assertThat(i.getSpec().getTraits().get("service").getConfiguration()).containsOnly(entry("enabled", "true"), entry("auto", "false"), entry("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)));
assertThat(i.getSpec().getConfiguration()).hasSize(7);
assertThat(i.getSpec().getConfiguration()).filteredOn("type", "property").anyMatch(c -> Objects.equals(c.getValue(), "customizer.health.enabled=true"));
assertThat(i.getSpec().getConfiguration()).filteredOn("type", "property").anyMatch(c -> Objects.equals(c.getValue(), "customizer.health.path=/actuator/health"));
assertThat(i.getSpec().getConfiguration()).filteredOn("type", "property").anyMatch(c -> Objects.equals(c.getValue(), "customizer.platform-http.enabled=true"));
assertThat(i.getSpec().getConfiguration()).filteredOn("type", "property").anyMatch(c -> Objects.equals(c.getValue(), "customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT));
}
use of io.syndesis.server.controller.integration.camelk.TestResourceManager in project syndesis by syndesisio.
the class ExposureCustomizerTest method testExposureCustomizerWith3ScaleExposure.
@Test
public void testExposureCustomizerWith3ScaleExposure() {
TestResourceManager manager = new TestResourceManager();
Integration integration = manager.newIntegration();
IntegrationDeployment deployment = new IntegrationDeployment.Builder().userId("user").id("idId").spec(integration).build();
CamelKIntegrationCustomizer customizer = new ExposureCustomizer();
io.syndesis.server.controller.integration.camelk.crd.Integration i = customizer.customize(deployment, new io.syndesis.server.controller.integration.camelk.crd.Integration(), EnumSet.of(Exposure._3SCALE));
assertThat(i.getMetadata().getLabels()).containsOnly(entry("discovery.3scale.net", "true"));
assertThat(i.getMetadata().getAnnotations()).containsOnly(entry("discovery.3scale.net/scheme", "http"), entry("discovery.3scale.net/port", "8080"), entry("discovery.3scale.net/description-path", "/openapi.json"));
assertThat(i.getSpec().getTraits()).doesNotContainKey("service");
assertThat(i.getSpec().getTraits()).doesNotContainKey("route");
}
use of io.syndesis.server.controller.integration.camelk.TestResourceManager in project syndesis by syndesisio.
the class TemplatingCustomizerTest method testTemplatingCustomizer.
@Test
public void testTemplatingCustomizer() {
TestResourceManager manager = new TestResourceManager();
Integration integration = manager.newIntegration(new Step.Builder().stepKind(StepKind.template).putConfiguredProperty("language", "MUSTACHE").build(), new Step.Builder().stepKind(StepKind.template).putConfiguredProperty("language", "VELOCITY").build());
IntegrationDeployment deployment = new IntegrationDeployment.Builder().userId("user").id("idId").spec(integration).build();
CamelKIntegrationCustomizer customizer = new TemplatingCustomizer();
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().getDependencies()).anyMatch(s -> s.startsWith("mvn:org.apache.camel:camel-mustache"));
assertThat(i.getSpec().getDependencies()).anyMatch(s -> s.startsWith("mvn:org.apache.camel:camel-velocity"));
}
Aggregations