@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"); }
@Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(integration.getSpec()); } if (exposure.contains(Exposure.SERVICE)) { spec.putTraits( "service", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("auto", "false") .putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)) .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.path=/actuator/health") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT) .build() ); spec.addConfiguration(PROPERTY, "camel.rest.contextPath=/"); spec.addConfiguration(PROPERTY, "camel.rest.component=servlet"); spec.addConfiguration(PROPERTY, "camel.rest.endpointProperty.headerFilterStrategy=syndesisHeaderStrategy"); } if (exposure.contains(Exposure.ROUTE)) { spec.putTraits( "route", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("tls-termination", "edge") .build() ); } if (exposure.contains(Exposure._3SCALE)) { if (integration.getMetadata().getLabels() == null) { integration.getMetadata().setLabels(new HashMap<>()); } if (integration.getMetadata().getAnnotations() == null) { integration.getMetadata().setAnnotations(new HashMap<>()); } integration.getMetadata().getLabels().put("discovery.3scale.net", "true"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/scheme", "http"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/port", "8080"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/description-path", "/openapi.json"); } integration.setSpec(spec.build()); return integration; }
ExposureCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(integration.getSpec()); } if (exposure.contains(Exposure.SERVICE)) { spec.putTraits( "service", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("auto", "false") .putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)) .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.path=/actuator/health") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT) .build() ); spec.addConfiguration(PROPERTY, "camel.rest.contextPath=/"); spec.addConfiguration(PROPERTY, "camel.rest.component=servlet"); spec.addConfiguration(PROPERTY, "camel.rest.endpointProperty.headerFilterStrategy=syndesisHeaderStrategy"); } if (exposure.contains(Exposure.ROUTE)) { spec.putTraits( "route", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("tls-termination", "edge") .build() ); } if (exposure.contains(Exposure._3SCALE)) { if (integration.getMetadata().getLabels() == null) { integration.getMetadata().setLabels(new HashMap<>()); } if (integration.getMetadata().getAnnotations() == null) { integration.getMetadata().setAnnotations(new HashMap<>()); } integration.getMetadata().getLabels().put("discovery.3scale.net", "true"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/scheme", "http"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/port", "8080"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/description-path", "/openapi.json"); } integration.setSpec(spec.build()); return integration; } }
ExposureCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(integration.getSpec()); } if (exposure.contains(Exposure.SERVICE)) { spec.putTraits( "service", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("auto", "false") .putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)) .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.path=/actuator/health") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT) .build() ); spec.addConfiguration(PROPERTY, "camel.rest.contextPath=/"); spec.addConfiguration(PROPERTY, "camel.rest.component=servlet"); spec.addConfiguration(PROPERTY, "camel.rest.endpointProperty.headerFilterStrategy=syndesisHeaderStrategy"); } if (exposure.contains(Exposure.ROUTE)) { spec.putTraits( "route", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("tls-termination", "edge") .build() ); } if (exposure.contains(Exposure._3SCALE)) { if (integration.getMetadata().getLabels() == null) { integration.getMetadata().setLabels(new HashMap<>()); } if (integration.getMetadata().getAnnotations() == null) { integration.getMetadata().setAnnotations(new HashMap<>()); } integration.getMetadata().getLabels().put("discovery.3scale.net", "true"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/scheme", "http"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/port", "8080"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/description-path", "/openapi.json"); } integration.setSpec(spec.build()); return integration; }  }
ExposureCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(integration.getSpec()); } if (exposure.contains(Exposure.SERVICE)) { spec.putTraits( "service", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("auto", "false") .putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)) .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.path=/actuator/health") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT) .build() ); spec.addConfiguration(PROPERTY, "camel.rest.contextPath=/"); spec.addConfiguration(PROPERTY, "camel.rest.component=servlet"); spec.addConfiguration(PROPERTY, "camel.rest.endpointProperty.headerFilterStrategy=syndesisHeaderStrategy"); } if (exposure.contains(Exposure.ROUTE)) { spec.putTraits( "route", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("tls-termination", "edge") .build() ); } if (exposure.contains(Exposure._3SCALE)) { if (integration.getMetadata().getLabels() == null) { integration.getMetadata().setLabels(new HashMap<>()); } if (integration.getMetadata().getAnnotations() == null) { integration.getMetadata().setAnnotations(new HashMap<>()); } integration.getMetadata().getLabels().put("discovery.3scale.net", "true"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/scheme", "http"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/port", "8080"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/description-path", "/openapi.json"); } integration.setSpec(spec.build()); return integration; }  @Override Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure); }
ExposureCustomizer implements CamelKIntegrationCustomizer { @Override public Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure) { IntegrationSpec.Builder spec = new IntegrationSpec.Builder(); if (integration.getSpec() != null) { spec = spec.from(integration.getSpec()); } if (exposure.contains(Exposure.SERVICE)) { spec.putTraits( "service", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("auto", "false") .putConfiguration("port", Integer.toString(OpenShiftService.INTEGRATION_SERVICE_PORT)) .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.health.path=/actuator/health") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.enabled=true") .build() ); spec.addConfiguration( new ConfigurationSpec.Builder() .type(PROPERTY) .value("customizer.platform-http.bind-port=" + OpenShiftService.INTEGRATION_SERVICE_PORT) .build() ); spec.addConfiguration(PROPERTY, "camel.rest.contextPath=/"); spec.addConfiguration(PROPERTY, "camel.rest.component=servlet"); spec.addConfiguration(PROPERTY, "camel.rest.endpointProperty.headerFilterStrategy=syndesisHeaderStrategy"); } if (exposure.contains(Exposure.ROUTE)) { spec.putTraits( "route", new TraitSpec.Builder() .putConfiguration("enabled", "true") .putConfiguration("tls-termination", "edge") .build() ); } if (exposure.contains(Exposure._3SCALE)) { if (integration.getMetadata().getLabels() == null) { integration.getMetadata().setLabels(new HashMap<>()); } if (integration.getMetadata().getAnnotations() == null) { integration.getMetadata().setAnnotations(new HashMap<>()); } integration.getMetadata().getLabels().put("discovery.3scale.net", "true"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/scheme", "http"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/port", "8080"); integration.getMetadata().getAnnotations().put("discovery.3scale.net/description-path", "/openapi.json"); } integration.setSpec(spec.build()); return integration; }  @Override Integration customize(IntegrationDeployment deployment, Integration integration, EnumSet<Exposure> exposure); static final String PROPERTY; }