Search in sources :

Example 16 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.

the class UndertowServiceGeneratorTests method testPrefixedServices.

@Test
void testPrefixedServices() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-service.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.builder().packagePrefix("test.prefix").build()))).emit(def, tempDir);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".undertow.prefix");
}
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 17 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.

the class ObjectGeneratorTests method testObjectGenerator_allExamples.

@Test
public void testObjectGenerator_allExamples() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-types.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new ObjectGenerator(Options.builder().useImmutableBytes(true).strictObjects(true).nonNullCollections(true).excludeEmptyOptionals(true).unionsWithUnknownValues(true).build()))).emit(def, tempDir);
    assertThatFilesAreTheSame(files, REFERENCE_FILES_FOLDER);
}
Also used : Path(java.nio.file.Path) GenerationCoordinator(com.palantir.conjure.java.GenerationCoordinator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 18 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.

the class ObjectGeneratorTests method testObjectGenerator_allExamples_with_prefix.

@Test
public void testObjectGenerator_allExamples_with_prefix() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-types.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new ObjectGenerator(Options.builder().packagePrefix("test.prefix").excludeEmptyOptionals(true).build()))).emit(def, tempDir);
    assertThatFilesAreTheSame(files, REFERENCE_FILES_FOLDER);
}
Also used : Path(java.nio.file.Path) GenerationCoordinator(com.palantir.conjure.java.GenerationCoordinator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 19 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.

the class DialogueServiceGeneratorTests method testPrefixedServices.

@Test
void testPrefixedServices() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-service.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new DialogueServiceGenerator(Options.builder().packagePrefix("test.prefix").build()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".dialogue.prefix");
}
Also used : Path(java.nio.file.Path) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) DialogueServiceGenerator(com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator) Test(org.junit.jupiter.api.Test)

Example 20 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.

the class DialogueServiceGeneratorTests 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 DialogueServiceGenerator(Options.empty()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".dialogue");
}
Also used : Path(java.nio.file.Path) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) DialogueServiceGenerator(com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator)

Aggregations

ConjureDefinition (com.palantir.conjure.spec.ConjureDefinition)65 Test (org.junit.jupiter.api.Test)49 File (java.io.File)40 Path (java.nio.file.Path)30 ConjureIllegalStateException (com.palantir.conjure.exceptions.ConjureIllegalStateException)13 JerseyServiceGenerator (com.palantir.conjure.java.services.JerseyServiceGenerator)9 UndertowServiceGenerator (com.palantir.conjure.java.services.UndertowServiceGenerator)9 GenerationCoordinator (com.palantir.conjure.java.GenerationCoordinator)8 Retrofit2ServiceGenerator (com.palantir.conjure.java.services.Retrofit2ServiceGenerator)4 DialogueServiceGenerator (com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator)4 AnnotatedConjureSourceFile (com.palantir.conjure.parser.AnnotatedConjureSourceFile)4 TypeDefinition (com.palantir.conjure.spec.TypeDefinition)4 BeforeAll (org.junit.jupiter.api.BeforeAll)4 TypeName (com.palantir.conjure.spec.TypeName)3 ImmutableList (com.google.common.collect.ImmutableList)2 ReferenceTypeResolver (com.palantir.conjure.defs.ConjureTypeParserVisitor.ReferenceTypeResolver)2 ConjureRuntimeException (com.palantir.conjure.exceptions.ConjureRuntimeException)2 ConjureSourceFile (com.palantir.conjure.parser.ConjureSourceFile)2 DefaultPostmanCollectionFileWriter (com.palantir.conjure.postman.writer.DefaultPostmanCollectionFileWriter)2 PostmanCollectionFileWriter (com.palantir.conjure.postman.writer.PostmanCollectionFileWriter)2