Search in sources :

Example 1 with Retrofit2ServiceGenerator

use of com.palantir.conjure.java.services.Retrofit2ServiceGenerator 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 2 with Retrofit2ServiceGenerator

use of com.palantir.conjure.java.services.Retrofit2ServiceGenerator 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 3 with Retrofit2ServiceGenerator

use of com.palantir.conjure.java.services.Retrofit2ServiceGenerator 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 4 with Retrofit2ServiceGenerator

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

the class Retrofit2ServiceGeneratorTests 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(folder.toPath().resolve("src")).toFile();
    new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new Retrofit2ServiceGenerator(Options.empty()))).emit(conjure, src);
    // Generated files contain imports
    assertThat(compiledFileContent(src, "test/api/with/imports/ImportServiceRetrofit.java")).contains("import com.palantir.product.StringExample;");
}
Also used : Retrofit2ServiceGenerator(com.palantir.conjure.java.services.Retrofit2ServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

Retrofit2ServiceGenerator (com.palantir.conjure.java.services.Retrofit2ServiceGenerator)4 ConjureDefinition (com.palantir.conjure.spec.ConjureDefinition)4 File (java.io.File)4 Path (java.nio.file.Path)3 Test (org.junit.jupiter.api.Test)3 BeforeAll (org.junit.jupiter.api.BeforeAll)1