use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.
the class ObjectGeneratorTests method testConjureErrors.
@Test
public void testConjureErrors() throws IOException {
ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-errors.yml"), new File("src/test/resources/example-errors-other.yml")));
List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new ErrorGenerator(Options.builder().useImmutableBytes(true).excludeEmptyOptionals(true).build()))).emit(def, tempDir);
assertThatFilesAreTheSame(files, REFERENCE_FILES_FOLDER);
}
use of com.palantir.conjure.spec.ConjureDefinition 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");
}
use of com.palantir.conjure.spec.ConjureDefinition 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;");
}
use of com.palantir.conjure.spec.ConjureDefinition 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");
}
use of com.palantir.conjure.spec.ConjureDefinition 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");
}
Aggregations