Search in sources :

Example 1 with JerseyServiceGenerator

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

the class JerseyServiceEteTest 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")));
    List<Path> files = new GenerationCoordinator(MoreExecutors.directExecutor(), ImmutableSet.of(new JerseyServiceGenerator(Options.builder().requireNotNullAuthAndBodyParams(true).build()))).emit(def, folder);
    validateGeneratorOutput(files, Paths.get("src/integrationInput/java/com/palantir/product"));
}
Also used : Path(java.nio.file.Path) JerseyServiceGenerator(com.palantir.conjure.java.services.JerseyServiceGenerator) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) File(java.io.File) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with JerseyServiceGenerator

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

the class JerseyServiceGeneratorTests method testServiceGeneration_exampleService_requireNotNullAuthHeadersAndRequestBodies.

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

Example 3 with JerseyServiceGenerator

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

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

Example 4 with JerseyServiceGenerator

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

the class JerseyServiceGeneratorTests 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 JerseyServiceGenerator(Options.empty()))).emit(conjure, src);
    // Generated files contain imports
    assertThat(compiledFileContent(src, "test/api/with/imports/ImportService.java")).contains("import com.palantir.product.StringExample;");
}
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 5 with JerseyServiceGenerator

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

Aggregations

JerseyServiceGenerator (com.palantir.conjure.java.services.JerseyServiceGenerator)9 ConjureDefinition (com.palantir.conjure.spec.ConjureDefinition)9 File (java.io.File)9 Path (java.nio.file.Path)7 Test (org.junit.jupiter.api.Test)6 BeforeAll (org.junit.jupiter.api.BeforeAll)2 UndertowServiceGenerator (com.palantir.conjure.java.services.UndertowServiceGenerator)1