Search in sources :

Example 1 with ProjectGeneratorConfiguration

use of io.syndesis.integration.project.generator.ProjectGeneratorConfiguration in project syndesis by syndesisio.

the class Application method generate.

@SuppressWarnings("PMD.UseProperClassLoader")
private void generate(Integration integration, File targetDir) throws IOException {
    ProjectGeneratorConfiguration configuration = new ProjectGeneratorConfiguration();
    IntegrationProjectGenerator generator = new ProjectGenerator(configuration, new EmptyIntegrationResourceManager(), mavenProperties);
    Path dir = targetDir.toPath();
    Files.createDirectories(dir);
    Files.write(dir.resolve("pom.xml"), generator.generatePom(integration));
    dir = dir.resolve("src/main/java/io/syndesis/example");
    Files.createDirectories(dir);
    ClassPathResource resource = new ClassPathResource("io/syndesis/integration/project/generator/templates/Application.java.mustache");
    try (InputStream is = resource.getInputStream()) {
        Files.write(dir.resolve("Application.java"), IOUtils.toByteArray(is));
    }
}
Also used : Path(java.nio.file.Path) IntegrationProjectGenerator(io.syndesis.integration.api.IntegrationProjectGenerator) ProjectGeneratorConfiguration(io.syndesis.integration.project.generator.ProjectGeneratorConfiguration) InputStream(java.io.InputStream) IntegrationProjectGenerator(io.syndesis.integration.api.IntegrationProjectGenerator) ProjectGenerator(io.syndesis.integration.project.generator.ProjectGenerator) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 2 with ProjectGeneratorConfiguration

use of io.syndesis.integration.project.generator.ProjectGeneratorConfiguration in project syndesis by syndesisio.

the class ConnectorTestSupport method useOverridePropertiesWithPropertiesComponent.

@Override
protected Properties useOverridePropertiesWithPropertiesComponent() {
    try {
        ProjectGeneratorConfiguration configuration = new ProjectGeneratorConfiguration();
        ProjectGenerator projectGenerator = new ProjectGenerator(configuration, new ResourceManager(), new MavenProperties());
        return projectGenerator.generateApplicationProperties(newIntegration());
    } catch (IOException e) {
        Assertions.fail("Unable to generate integration properties", e);
    }
    return null;
}
Also used : ProjectGeneratorConfiguration(io.syndesis.integration.project.generator.ProjectGeneratorConfiguration) MavenProperties(io.syndesis.common.util.MavenProperties) ProjectGenerator(io.syndesis.integration.project.generator.ProjectGenerator) IntegrationResourceManager(io.syndesis.integration.api.IntegrationResourceManager) IOException(java.io.IOException)

Aggregations

ProjectGenerator (io.syndesis.integration.project.generator.ProjectGenerator)2 ProjectGeneratorConfiguration (io.syndesis.integration.project.generator.ProjectGeneratorConfiguration)2 MavenProperties (io.syndesis.common.util.MavenProperties)1 IntegrationProjectGenerator (io.syndesis.integration.api.IntegrationProjectGenerator)1 IntegrationResourceManager (io.syndesis.integration.api.IntegrationResourceManager)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Path (java.nio.file.Path)1 ClassPathResource (org.springframework.core.io.ClassPathResource)1