Search in sources :

Example 1 with AutomatikoBuildConfig

use of io.automatiko.engine.api.config.AutomatikoBuildConfig in project automatiko-engine by automatiko-io.

the class ResourceGeneratorFactoryTest method testCreateQuarkus.

@Test
void testCreateQuarkus(@Mock GeneratorContext generatorContext) {
    when(generatorContext.getBuildContext()).thenReturn(new QuarkusApplicationBuildContext(new AutomatikoBuildConfig(), p -> true, c -> Collections.emptyList()));
    Optional<AbstractResourceGenerator> context = tested.create(generatorContext, process, MODEL_FQCN, PROCESS_FQCN, APP_CANONICAL_NAME);
    assertThat(context.isPresent()).isTrue();
    assertThat(context.get()).isExactlyInstanceOf(ResourceGenerator.class);
}
Also used : AutomatikoBuildConfig(io.automatiko.engine.api.config.AutomatikoBuildConfig) BeforeEach(org.junit.jupiter.api.BeforeEach) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) AutomatikoBuildConfig(io.automatiko.engine.api.config.AutomatikoBuildConfig) Mock(org.mockito.Mock) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) ResourceGenerator(io.automatiko.engine.codegen.process.ResourceGenerator) Mockito.when(org.mockito.Mockito.when) Mockito.lenient(org.mockito.Mockito.lenient) Test(org.junit.jupiter.api.Test) AbstractResourceGenerator(io.automatiko.engine.codegen.process.AbstractResourceGenerator) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Optional(java.util.Optional) ReactiveResourceGenerator(io.automatiko.engine.codegen.process.ReactiveResourceGenerator) QuarkusApplicationBuildContext(io.automatiko.engine.codegen.context.QuarkusApplicationBuildContext) Collections(java.util.Collections) AbstractResourceGenerator(io.automatiko.engine.codegen.process.AbstractResourceGenerator) QuarkusApplicationBuildContext(io.automatiko.engine.codegen.context.QuarkusApplicationBuildContext) Test(org.junit.jupiter.api.Test)

Example 2 with AutomatikoBuildConfig

use of io.automatiko.engine.api.config.AutomatikoBuildConfig in project automatiko-engine by automatiko-io.

the class ResourceGeneratorFactoryTest method testCreateQuarkusReactive.

@Test
void testCreateQuarkusReactive(@Mock GeneratorContext generatorContext) {
    when(generatorContext.getApplicationProperty(GeneratorConfig.REST_RESOURCE_TYPE_PROP)).thenReturn(Optional.of("reactive"));
    when(generatorContext.getBuildContext()).thenReturn(new QuarkusApplicationBuildContext(new AutomatikoBuildConfig(), p -> true, c -> Collections.emptyList()));
    Optional<AbstractResourceGenerator> context = tested.create(generatorContext, process, MODEL_FQCN, PROCESS_FQCN, APP_CANONICAL_NAME);
    assertThat(context.isPresent()).isTrue();
    assertThat(context.get()).isExactlyInstanceOf(ReactiveResourceGenerator.class);
}
Also used : AutomatikoBuildConfig(io.automatiko.engine.api.config.AutomatikoBuildConfig) BeforeEach(org.junit.jupiter.api.BeforeEach) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) AutomatikoBuildConfig(io.automatiko.engine.api.config.AutomatikoBuildConfig) Mock(org.mockito.Mock) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) WorkflowProcess(io.automatiko.engine.api.definition.process.WorkflowProcess) ResourceGenerator(io.automatiko.engine.codegen.process.ResourceGenerator) Mockito.when(org.mockito.Mockito.when) Mockito.lenient(org.mockito.Mockito.lenient) Test(org.junit.jupiter.api.Test) AbstractResourceGenerator(io.automatiko.engine.codegen.process.AbstractResourceGenerator) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) Optional(java.util.Optional) ReactiveResourceGenerator(io.automatiko.engine.codegen.process.ReactiveResourceGenerator) QuarkusApplicationBuildContext(io.automatiko.engine.codegen.context.QuarkusApplicationBuildContext) Collections(java.util.Collections) AbstractResourceGenerator(io.automatiko.engine.codegen.process.AbstractResourceGenerator) QuarkusApplicationBuildContext(io.automatiko.engine.codegen.context.QuarkusApplicationBuildContext) Test(org.junit.jupiter.api.Test)

Aggregations

AutomatikoBuildConfig (io.automatiko.engine.api.config.AutomatikoBuildConfig)2 WorkflowProcess (io.automatiko.engine.api.definition.process.WorkflowProcess)2 QuarkusApplicationBuildContext (io.automatiko.engine.codegen.context.QuarkusApplicationBuildContext)2 AbstractResourceGenerator (io.automatiko.engine.codegen.process.AbstractResourceGenerator)2 ReactiveResourceGenerator (io.automatiko.engine.codegen.process.ReactiveResourceGenerator)2 ResourceGenerator (io.automatiko.engine.codegen.process.ResourceGenerator)2 Collections (java.util.Collections)2 Optional (java.util.Optional)2 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 Test (org.junit.jupiter.api.Test)2 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)2 Mock (org.mockito.Mock)2 Mockito.lenient (org.mockito.Mockito.lenient)2 Mockito.when (org.mockito.Mockito.when)2 MockitoExtension (org.mockito.junit.jupiter.MockitoExtension)2