Search in sources :

Example 1 with TestResourceManager

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()));
}
Also used : Integration(io.syndesis.common.model.integration.Integration) VersionService(io.syndesis.server.endpoint.v1.VersionService) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) TestResourceManager(io.syndesis.server.controller.integration.camelk.TestResourceManager) Test(org.junit.Test)

Example 2 with TestResourceManager

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"));
}
Also used : Integration(io.syndesis.common.model.integration.Integration) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) TestResourceManager(io.syndesis.server.controller.integration.camelk.TestResourceManager) Test(org.junit.Test)

Example 3 with TestResourceManager

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));
}
Also used : Integration(io.syndesis.common.model.integration.Integration) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) TestResourceManager(io.syndesis.server.controller.integration.camelk.TestResourceManager) Test(org.junit.Test)

Example 4 with TestResourceManager

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");
}
Also used : Integration(io.syndesis.common.model.integration.Integration) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) TestResourceManager(io.syndesis.server.controller.integration.camelk.TestResourceManager) Test(org.junit.Test)

Example 5 with TestResourceManager

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"));
}
Also used : Integration(io.syndesis.common.model.integration.Integration) IntegrationDeployment(io.syndesis.common.model.integration.IntegrationDeployment) TestResourceManager(io.syndesis.server.controller.integration.camelk.TestResourceManager) Test(org.junit.Test)

Aggregations

Integration (io.syndesis.common.model.integration.Integration)15 IntegrationDeployment (io.syndesis.common.model.integration.IntegrationDeployment)15 TestResourceManager (io.syndesis.server.controller.integration.camelk.TestResourceManager)15 Test (org.junit.Test)15 Step (io.syndesis.common.model.integration.Step)5 Exposure (io.syndesis.server.openshift.Exposure)4 ConnectorAction (io.syndesis.common.model.action.ConnectorAction)3 Connection (io.syndesis.common.model.connection.Connection)3 Connector (io.syndesis.common.model.connection.Connector)3 StepKind (io.syndesis.common.model.integration.StepKind)3 JsonUtils (io.syndesis.common.util.json.JsonUtils)3 VersionService (io.syndesis.server.endpoint.v1.VersionService)3 InputStream (java.io.InputStream)3 EnumSet (java.util.EnumSet)3 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)3 IOException (java.io.IOException)2 Assertions.entry (org.assertj.core.api.Assertions.entry)2 ResourceIdentifier (io.syndesis.common.model.ResourceIdentifier)1 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)1 ControllersConfigurationProperties (io.syndesis.server.controller.ControllersConfigurationProperties)1