Search in sources :

Example 1 with DialogueServiceGenerator

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

use of com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator 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)

Example 3 with DialogueServiceGenerator

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

the class DialogueServiceGeneratorTests method generateEteServices.

@Test
public void generateEteServices() throws IOException {
    ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/cookie-service.yml"), 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 DialogueServiceGenerator(Options.builder().apiVersion("1.2.3").build()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/integrationInput/java/com/palantir/product"));
}
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 4 with DialogueServiceGenerator

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

the class DialogueServiceGeneratorTests 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 DialogueServiceGenerator(Options.empty()))).emit(conjure, src);
    // Generated files contain imports
    assertThat(compiledFileContent(src, "test/api/with/imports/ImportServiceBlocking.java")).contains("import com.palantir.product.StringExample;");
}
Also used : ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) DialogueServiceGenerator(com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator) Test(org.junit.jupiter.api.Test)

Aggregations

DialogueServiceGenerator (com.palantir.conjure.java.services.dialogue.DialogueServiceGenerator)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