use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.
the class JerseyServiceGeneratorTests method testBinaryReturnInputStream.
@Test
public void testBinaryReturnInputStream() throws IOException {
ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-binary.yml")));
List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new JerseyServiceGenerator(Options.empty()))).emit(def, folder);
validateGeneratorOutput(files, Paths.get("src/test/resources/test/api"), ".jersey.binary");
}
use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.
the class ObjectGeneratorTests method testObjectGenerator_byteBufferCompatibility.
@Test
public void testObjectGenerator_byteBufferCompatibility() throws IOException {
ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-binary-types.yml")));
List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new ObjectGenerator(Options.builder().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 testEndpointWithNameCollisions.
@Test
public void testEndpointWithNameCollisions() throws IOException {
ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/dangerous-name-service.yml")));
File src = Files.createDirectory(tempDir.toPath().resolve("src")).toFile();
List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new UndertowServiceGenerator(Options.builder().undertowServicePrefix(true).build()))).emit(def, src);
validateGeneratorOutput(files, Paths.get("src/integrationInput/java/com/palantir/product"));
}
use of com.palantir.conjure.spec.ConjureDefinition in project conjure-java by palantir.
the class UndertowServiceGeneratorTests method testBinaryReturnInputStream.
@Test
public void testBinaryReturnInputStream() throws IOException {
ConjureDefinition def = Conjure.parse(ImmutableList.of(new File("src/test/resources/example-binary.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.binary");
}
use of com.palantir.conjure.spec.ConjureDefinition 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;");
}
Aggregations