Search in sources :

Example 1 with UndertowServiceGenerator

use of com.palantir.conjure.java.services.UndertowServiceGenerator in project conjure-java by palantir.

the class UndertowServiceEteTest method beforeClass.

@BeforeAll
public static void beforeClass() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/ete-service.yml"), new File("src/test/resources/ete-binary.yml"), new File("src/test/resources/alias-test-service.yml")));
    Options options = Options.builder().undertowServicePrefix(true).nonNullCollections(true).excludeEmptyOptionals(true).build();
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(options), new ObjectGenerator(options))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/integrationInput/java/com/palantir/product"));
}
Also used : Path(java.nio.file.Path) UndertowOptions(io.undertow.UndertowOptions) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) UndertowServiceGenerator(com.palantir.conjure.java.services.UndertowServiceGenerator) ObjectGenerator(com.palantir.conjure.java.types.ObjectGenerator) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with UndertowServiceGenerator

use of com.palantir.conjure.java.services.UndertowServiceGenerator in project conjure-java by palantir.

the class UndertowServiceGeneratorTests method testServiceGeneration.

private void testServiceGeneration(String conjureFile) throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/" + conjureFile + ".yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.empty()))).emit(def, tempDir);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".undertow");
}
Also used : Path(java.nio.file.Path) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) UndertowServiceGenerator(com.palantir.conjure.java.services.UndertowServiceGenerator)

Example 3 with UndertowServiceGenerator

use of com.palantir.conjure.java.services.UndertowServiceGenerator in project conjure-java by palantir.

the class UndertowServiceGeneratorTests method testConjureImports.

@Test
public void testConjureImports() throws IOException {
    ConjureDefinition conjure = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-conjure-imports.yml"), new File("src/test/resources/example-types.yml"), new File("src/test/resources/example-service.yml")));
    File src = Files.createDirectory(tempDir.toPath().resolve("src")).toFile();
    new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.empty()))).emit(conjure, src);
    // Generated files contain imports
    assertThat(compiledFileContent(src, "test/api/with/imports/ImportService.java")).contains("import com.palantir.product.StringExample;");
}
Also used : ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) UndertowServiceGenerator(com.palantir.conjure.java.services.UndertowServiceGenerator) Test(org.junit.jupiter.api.Test)

Example 4 with UndertowServiceGenerator

use of com.palantir.conjure.java.services.UndertowServiceGenerator in project conjure-java by palantir.

the class UndertowServiceGeneratorTests method testIndividualMethodAsync.

@Test
public void testIndividualMethodAsync() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/undertow-async-endpoint.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.builder().experimentalUndertowAsyncMarkers(true).build()))).emit(def, tempDir);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".undertow.async");
}
Also used : Path(java.nio.file.Path) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) UndertowServiceGenerator(com.palantir.conjure.java.services.UndertowServiceGenerator) Test(org.junit.jupiter.api.Test)

Example 5 with UndertowServiceGenerator

use of com.palantir.conjure.java.services.UndertowServiceGenerator in project conjure-java by palantir.

the class UndertowServiceGeneratorTests method testIndividualMethodAsyncWithoutFlag.

@Test
public void testIndividualMethodAsyncWithoutFlag() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/undertow-async-endpoint.yml")));
    // Without FeatureFlags.ExperimentalUndertowAsyncMarkers this should generate blocking methods
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.empty()))).emit(def, tempDir);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".undertow");
}
Also used : Path(java.nio.file.Path) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) UndertowServiceGenerator(com.palantir.conjure.java.services.UndertowServiceGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

UndertowServiceGenerator (com.palantir.conjure.java.services.UndertowServiceGenerator)9 ConjureDefinition (com.palantir.conjure.spec.ConjureDefinition)9 File (java.io.File)9 Path (java.nio.file.Path)8 Test (org.junit.jupiter.api.Test)6 BeforeAll (org.junit.jupiter.api.BeforeAll)2 JerseyServiceGenerator (com.palantir.conjure.java.services.JerseyServiceGenerator)1 ObjectGenerator (com.palantir.conjure.java.types.ObjectGenerator)1 UndertowOptions (io.undertow.UndertowOptions)1