@Test public void testGenerateApplicationPropertiesOldStyle() throws IOException { final ConnectorAction oldAction = new ConnectorAction.Builder() .id(KeyGenerator.createKey()) .descriptor(new ConnectorDescriptor.Builder() .connectorId("old") .build()) .build(); final Connector oldConnector = new Connector.Builder() .id("old") .addAction(oldAction) .putProperty("username", new ConfigurationProperty.Builder() .componentProperty(false) .secret(true) .build()) .putProperty("password", new ConfigurationProperty.Builder() .componentProperty(false) .secret(true) .build()) .putProperty("token", new ConfigurationProperty.Builder() .componentProperty(true) .secret(true) .build()) .build(); Step s1 = new Step.Builder() .stepKind(StepKind.endpoint) .connection(new Connection.Builder() .id(KeyGenerator.createKey()) .connector(oldConnector) .build()) .putConfiguredProperty("username", "my-username-1") .putConfiguredProperty("password", "my-password-1") .putConfiguredProperty("token", "my-token-1") .action(oldAction) .build(); TestResourceManager resourceManager = new TestResourceManager(); ProjectGeneratorConfiguration configuration = new ProjectGeneratorConfiguration(); ProjectGenerator generator = new ProjectGenerator(configuration, resourceManager, TestConstants.MAVEN_PROPERTIES); Integration integration = new Integration.Builder() .createFrom(resourceManager.newIntegration(s1)) .putConfiguredProperty("integration", "property") .build(); assertThatExceptionOfType(UnsupportedOperationException.class).isThrownBy(() -> generator.generateApplicationProperties(integration)) .withMessage("Old style of connectors from camel-connector are not supported anymore, please be sure that integration json satisfy connector.getComponentScheme().isPresent() || descriptor.getComponentScheme().isPresent()"); }
@Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(integration.getConfiguredProperties()); addPropertiesFrom(properties, integration, resourceManager); return properties; }
ProjectGenerator implements IntegrationProjectGenerator { @Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(integration.getConfiguredProperties()); addPropertiesFrom(properties, integration, resourceManager); return properties; } }
ProjectGenerator implements IntegrationProjectGenerator { @Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(integration.getConfiguredProperties()); addPropertiesFrom(properties, integration, resourceManager); return properties; } ProjectGenerator(ProjectGeneratorConfiguration configuration, IntegrationResourceManager resourceManager, MavenProperties mavenProperties); }
ProjectGenerator implements IntegrationProjectGenerator { @Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(integration.getConfiguredProperties()); addPropertiesFrom(properties, integration, resourceManager); return properties; } ProjectGenerator(ProjectGeneratorConfiguration configuration, IntegrationResourceManager resourceManager, MavenProperties mavenProperties); @Override @SuppressWarnings("resource") InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler); @Override Properties generateApplicationProperties(final Integration integrationDefinition); @Override byte[] generatePom(final Integration integration); }
ProjectGenerator implements IntegrationProjectGenerator { @Override public Properties generateApplicationProperties(final Integration integrationDefinition) { final Integration integration = resourceManager.sanitize(integrationDefinition); final Properties properties = new Properties(); properties.putAll(integration.getConfiguredProperties()); addPropertiesFrom(properties, integration, resourceManager); return properties; } ProjectGenerator(ProjectGeneratorConfiguration configuration, IntegrationResourceManager resourceManager, MavenProperties mavenProperties); @Override @SuppressWarnings("resource") InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler); @Override Properties generateApplicationProperties(final Integration integrationDefinition); @Override byte[] generatePom(final Integration integration);  }