@Test public void testGenerateProjectErrorHandling() throws Exception { TestResourceManager resourceManager = new TestResourceManager(); Integration integration = resourceManager.newIntegration( new Step.Builder() .stepKind(StepKind.endpoint) .connection(new Connection.Builder() .id("timer-connection") .connector(TestConstants.TIMER_CONNECTOR) .build()) .putConfiguredProperty("period", "5000") .action(TestConstants.PERIODIC_TIMER_ACTION) .build(), new Step.Builder() .stepKind(StepKind.log) .build() ); ProjectGeneratorConfiguration configuration = new ProjectGeneratorConfiguration(); configuration.getTemplates().setOverridePath(this.basePath); configuration.getTemplates().getAdditionalResources().addAll(this.additionalResources); configuration.getTemplates().getAdditionalResources().add( new ProjectGeneratorConfiguration.Templates.Resource("file-that-does-not-exist.yml", "deployment.yml")); configuration.setSecretMaskingEnabled(true); generate(integration, configuration, resourceManager); await().atMost(Duration.ofSeconds(5)).until(() -> !errors.isEmpty()); assertThat(errors.get(0)).isExactlyInstanceOf(IllegalArgumentException.class); }
@Override @SuppressWarnings("resource") public InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler) throws IOException { final Integration integration = resourceManager.sanitize(integrationDefinition); final PipedInputStream is = new PipedInputStream(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final PipedOutputStream os = new PipedOutputStream(is); executor.execute(generateAddProjectTarEntries(integration, os, errorHandler)); return is; }
ProjectGenerator implements IntegrationProjectGenerator { @Override @SuppressWarnings("resource") public InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler) throws IOException { final Integration integration = resourceManager.sanitize(integrationDefinition); final PipedInputStream is = new PipedInputStream(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final PipedOutputStream os = new PipedOutputStream(is); executor.execute(generateAddProjectTarEntries(integration, os, errorHandler)); return is; } }
ProjectGenerator implements IntegrationProjectGenerator { @Override @SuppressWarnings("resource") public InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler) throws IOException { final Integration integration = resourceManager.sanitize(integrationDefinition); final PipedInputStream is = new PipedInputStream(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final PipedOutputStream os = new PipedOutputStream(is); executor.execute(generateAddProjectTarEntries(integration, os, errorHandler)); return is; } ProjectGenerator(ProjectGeneratorConfiguration configuration, IntegrationResourceManager resourceManager, MavenProperties mavenProperties); }
ProjectGenerator implements IntegrationProjectGenerator { @Override @SuppressWarnings("resource") public InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler) throws IOException { final Integration integration = resourceManager.sanitize(integrationDefinition); final PipedInputStream is = new PipedInputStream(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final PipedOutputStream os = new PipedOutputStream(is); executor.execute(generateAddProjectTarEntries(integration, os, errorHandler)); return is; } 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 @SuppressWarnings("resource") public InputStream generate(final Integration integrationDefinition, IntegrationErrorHandler errorHandler) throws IOException { final Integration integration = resourceManager.sanitize(integrationDefinition); final PipedInputStream is = new PipedInputStream(); final ExecutorService executor = Executors.newSingleThreadExecutor(); final PipedOutputStream os = new PipedOutputStream(is); executor.execute(generateAddProjectTarEntries(integration, os, errorHandler)); return is; } 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);  }