@Test public void testCamelkIntegrationSecret() throws Exception { TestResourceManager manager = new TestResourceManager(); Integration integration = manager.newIntegration( new Step.Builder() .stepKind(StepKind.endpoint) .putConfiguredProperty("username", "admin") .action(HTTP_ACTION) .connection(HTTP_CONNECTION) .build() ); ProjectGenerator generator = new ProjectGenerator(new ProjectGeneratorConfiguration(), manager, new MavenProperties()); IntegrationDeployment deployment = new IntegrationDeployment.Builder().spec(integration).build(); CamelKPublishHandler handler = new CamelKPublishHandler( new OpenShiftServiceNoOp(), null, null, generator, null, manager, Collections.emptyList(), new ControllersConfigurationProperties(), new ExposureHelper(new OpenShiftConfigurationProperties())); Secret secret = handler.createIntegrationSecret(deployment); assertThat(secret.getMetadata()).hasFieldOrPropertyWithValue("name", "i-test-integration"); assertThat(secret.getStringData()).containsKeys("application.properties"); Properties actual = CamelKSupport.secretToProperties(secret); Properties expected = generator.generateApplicationProperties(integration); assertThat(actual).isEqualTo(expected); assertThat(actual).containsEntry("flow-0.http4-0.username", "admin"); }
protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); return new SecretBuilder() .withNewMetadata() .withName(CamelKSupport.integrationName(integration.getName())) .endMetadata() .addToStringData("application.properties", CamelKSupport.propsToString(applicationProperties)) .build(); }
CamelKPublishHandler extends BaseCamelKHandler implements StateChangeHandler { protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); return new SecretBuilder() .withNewMetadata() .withName(CamelKSupport.integrationName(integration.getName())) .endMetadata() .addToStringData("application.properties", CamelKSupport.propsToString(applicationProperties)) .build(); } }
CamelKPublishHandler extends BaseCamelKHandler implements StateChangeHandler { protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); return new SecretBuilder() .withNewMetadata() .withName(CamelKSupport.integrationName(integration.getName())) .endMetadata() .addToStringData("application.properties", CamelKSupport.propsToString(applicationProperties)) .build(); } CamelKPublishHandler(
        OpenShiftService openShiftService,
        IntegrationDao iDao,
        IntegrationDeploymentDao idDao,
        IntegrationProjectGenerator projectGenerator,
        IntegrationPublishValidator validator,
        IntegrationResourceManager resourceManager,
        List<CamelKIntegrationCustomizer> customizers,
        ControllersConfigurationProperties configuration,
        ExposureHelper exposureHelper); }
CamelKPublishHandler extends BaseCamelKHandler implements StateChangeHandler { protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); return new SecretBuilder() .withNewMetadata() .withName(CamelKSupport.integrationName(integration.getName())) .endMetadata() .addToStringData("application.properties", CamelKSupport.propsToString(applicationProperties)) .build(); } CamelKPublishHandler(
        OpenShiftService openShiftService,
        IntegrationDao iDao,
        IntegrationDeploymentDao idDao,
        IntegrationProjectGenerator projectGenerator,
        IntegrationPublishValidator validator,
        IntegrationResourceManager resourceManager,
        List<CamelKIntegrationCustomizer> customizers,
        ControllersConfigurationProperties configuration,
        ExposureHelper exposureHelper); @Override Set<IntegrationDeploymentState> getTriggerStates(); @Override @SuppressWarnings("PMD.NPathComplexity") StateUpdate execute(IntegrationDeployment integrationDeployment); }
CamelKPublishHandler extends BaseCamelKHandler implements StateChangeHandler { protected Secret createIntegrationSecret(IntegrationDeployment integrationDeployment) { final Integration integration = integrationDeployment.getSpec(); Properties applicationProperties = projectGenerator.generateApplicationProperties(integration); return new SecretBuilder() .withNewMetadata() .withName(CamelKSupport.integrationName(integration.getName())) .endMetadata() .addToStringData("application.properties", CamelKSupport.propsToString(applicationProperties)) .build(); } CamelKPublishHandler(
        OpenShiftService openShiftService,
        IntegrationDao iDao,
        IntegrationDeploymentDao idDao,
        IntegrationProjectGenerator projectGenerator,
        IntegrationPublishValidator validator,
        IntegrationResourceManager resourceManager,
        List<CamelKIntegrationCustomizer> customizers,
        ControllersConfigurationProperties configuration,
        ExposureHelper exposureHelper); @Override Set<IntegrationDeploymentState> getTriggerStates(); @Override @SuppressWarnings("PMD.NPathComplexity") StateUpdate execute(IntegrationDeployment integrationDeployment);  }