Search in sources :

Example 11 with DefaultTestRockerModelProvider

use of io.micronaut.starter.options.DefaultTestRockerModelProvider in project micronaut-starter by micronaut-projects.

the class AwsLambda method addBookControllerTest.

private void addBookControllerTest(GeneratorContext generatorContext, Project project) {
    String testSource = generatorContext.getTestSourcePath("/{packagePath}/BookController");
    TestRockerModelProvider provider = new DefaultTestRockerModelProvider(bookControllerSpock.template(project), bookControllerJavaJunit.template(project), bookControllerGroovyJunit.template(project), bookControllerKotlinJunit.template(project), bookControllerKoTest.template(project));
    generatorContext.addTemplate("testBookController", testSource, provider);
}
Also used : TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Example 12 with DefaultTestRockerModelProvider

use of io.micronaut.starter.options.DefaultTestRockerModelProvider in project micronaut-starter by micronaut-projects.

the class AwsLambda method addTest.

private void addTest(GeneratorContext generatorContext, Project project) {
    String testSource = generatorContext.getTestSourcePath("/{packagePath}/BookRequestHandler");
    TestRockerModelProvider provider = new DefaultTestRockerModelProvider(awsLambdaBookRequestHandlerSpock.template(project), awsLambdaBookRequestHandlerJavaJunit.template(project), awsLambdaBookRequestHandlerGroovyJunit.template(project), awsLambdaBookRequestHandlerKotlinJunit.template(project), awsLambdaBookRequestHandlerKoTest.template(project));
    generatorContext.addTemplate("testBookRequestHandler", testSource, provider);
}
Also used : TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Example 13 with DefaultTestRockerModelProvider

use of io.micronaut.starter.options.DefaultTestRockerModelProvider in project micronaut-starter by micronaut-projects.

the class AzureRawFunction method applyFunction.

@Override
protected void applyFunction(GeneratorContext generatorContext, ApplicationType type) {
    super.applyFunction(generatorContext, type);
    if (type == ApplicationType.FUNCTION) {
        Project project = generatorContext.getProject();
        String testSource = generatorContext.getTestSourcePath("/{packagePath}/Function");
        TestRockerModelProvider provider = new DefaultTestRockerModelProvider(spockTemplate(project), javaJUnitTemplate(project), groovyJUnitTemplate(project), kotlinJUnitTemplate(project), koTestTemplate(project));
        generatorContext.addTemplate("testFunction", testSource, provider);
    }
}
Also used : Project(io.micronaut.starter.application.Project) TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Example 14 with DefaultTestRockerModelProvider

use of io.micronaut.starter.options.DefaultTestRockerModelProvider in project micronaut-starter by micronaut-projects.

the class KotlinApplication method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    KotlinApplicationFeature.super.apply(generatorContext);
    if (shouldGenerateApplicationFile(generatorContext)) {
        generatorContext.addTemplate("application", new RockerTemplate(getPath(), application.template(generatorContext.getProject(), generatorContext.getFeatures())));
        TestFramework testFramework = generatorContext.getTestFramework();
        String testSourcePath = generatorContext.getTestSourcePath("/{packagePath}/{className}");
        Project project = generatorContext.getProject();
        TestRockerModelProvider provider = new DefaultTestRockerModelProvider(spock.template(project), kotlinJunit.template(project), kotlinJunit.template(project), kotlinJunit.template(project), koTest.template(project));
        generatorContext.addTemplate("applicationTest", new RockerTemplate(testSourcePath, provider.findModel(generatorContext.getLanguage(), testFramework)));
    }
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) Project(io.micronaut.starter.application.Project) TestFramework(io.micronaut.starter.options.TestFramework) TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Example 15 with DefaultTestRockerModelProvider

use of io.micronaut.starter.options.DefaultTestRockerModelProvider in project micronaut-starter by micronaut-projects.

the class JavaApplication method apply.

@Override
public void apply(GeneratorContext generatorContext) {
    JavaApplicationFeature.super.apply(generatorContext);
    if (shouldGenerateApplicationFile(generatorContext)) {
        generatorContext.addTemplate("application", new RockerTemplate(getPath(), application.template(generatorContext.getProject(), generatorContext.getFeatures())));
        TestFramework testFramework = generatorContext.getTestFramework();
        String testSourcePath = generatorContext.getTestSourcePath("/{packagePath}/{className}");
        Project project = generatorContext.getProject();
        TestRockerModelProvider provider = new DefaultTestRockerModelProvider(spock.template(project), javaJunit.template(project), javaJunit.template(project), javaJunit.template(project), koTest.template(project));
        generatorContext.addTemplate("applicationTest", new RockerTemplate(testSourcePath, provider.findModel(generatorContext.getLanguage(), testFramework)));
    }
}
Also used : RockerTemplate(io.micronaut.starter.template.RockerTemplate) Project(io.micronaut.starter.application.Project) TestFramework(io.micronaut.starter.options.TestFramework) TestRockerModelProvider(io.micronaut.starter.options.TestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider) DefaultTestRockerModelProvider(io.micronaut.starter.options.DefaultTestRockerModelProvider)

Aggregations

DefaultTestRockerModelProvider (io.micronaut.starter.options.DefaultTestRockerModelProvider)15 TestRockerModelProvider (io.micronaut.starter.options.TestRockerModelProvider)15 Project (io.micronaut.starter.application.Project)6 RockerTemplate (io.micronaut.starter.template.RockerTemplate)5 TestFramework (io.micronaut.starter.options.TestFramework)3 RockerModel (com.fizzed.rocker.RockerModel)2 RenderResult (io.micronaut.starter.template.RenderResult)2 TemplateRenderer (io.micronaut.starter.template.TemplateRenderer)2