Search in sources :

Example 6 with ConjureDefinition

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

the class Retrofit2ServiceEteTest method beforeAll.

@BeforeAll
public static void beforeAll() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/ete-service.yml"), new File("src/test/resources/ete-binary.yml")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new Retrofit2ServiceGenerator(Options.empty()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/integrationInput/java/com/palantir/product"));
}
Also used : Path(java.nio.file.Path) Retrofit2ServiceGenerator(com.palantir.conjure.java.services.Retrofit2ServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 7 with ConjureDefinition

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

the class Retrofit2ServiceGeneratorTests method testCompositionVanilla.

@Test
public void testCompositionVanilla() 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 Retrofit2ServiceGenerator(Options.empty()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".retrofit");
}
Also used : Path(java.nio.file.Path) Retrofit2ServiceGenerator(com.palantir.conjure.java.services.Retrofit2ServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 8 with ConjureDefinition

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

the class Retrofit2ServiceGeneratorTests 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 Retrofit2ServiceGenerator(Options.builder().packagePrefix("test.prefix").build()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".retrofit.prefix");
}
Also used : Path(java.nio.file.Path) Retrofit2ServiceGenerator(com.palantir.conjure.java.services.Retrofit2ServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 9 with ConjureDefinition

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

the class ServiceGeneratorTests method testConjureIncubatingJavadoc.

@Test
public void testConjureIncubatingJavadoc() throws IOException {
    ConjureDefinition conjure = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-conjure-incubating.yml")));
    File src = Files.createDirectory(folder.toPath().resolve("src")).toFile();
    new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new JerseyServiceGenerator(Options.empty()))).emit(conjure, src);
    // Generated files contain imports
    assertThat(compiledFileContent(src, "test/api/with/imports/IncubatingEndpoint.java")).contains("* @Incubating To be removed after 1.2.x.");
}
Also used : JerseyServiceGenerator(com.palantir.conjure.java.services.JerseyServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 10 with ConjureDefinition

use of com.palantir.conjure.spec.ConjureDefinition 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)

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