@Test void wadlFacetGradle(final WebTarget target) throws IOException { final ProjectModel projectModel = new ProjectModel(); projectModel.setBuildType("Gradle"); projectModel.setPackageBase("com.foo"); projectModel.setFacets(singletonList("WADL Client Generation")); final Map<String, String> files = createZip(projectModel, target); assertWadl(files); assertEquals("apply plugin: 'nebula.provided-base'\n" + "apply plugin: 'org.talend.sdk.component'\n" + "apply plugin: 'java'\napply plugin: 'maven-publish'\n" + "\n" + "tasks.withType(JavaCompile) {\n" + " sourceCompatibility = 1.8\n" + " targetCompatibility = 1.8\n" + " options.compilerArgs << '-parameters'\n" + " options.fork = true\n" + "}\n" + "\n" + "import org.apache.cxf.tools.common.ToolContext\n" + "import org.apache.cxf.tools.wadlto.WADLToJava\n" + "\n" + "buildscript {\n" + " repositories {\n" + " mavenLocal()\n" + " mavenCentral()\n" + " maven {\n" + " url \"https: + " dependencies {\n" + " classpath \"com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3\"\n" + " classpath \"org.talend.sdk.component:gradle-talend-component:" + versions.getSnapshot().getKit() + "\"\n" + " classpath \"org.apache.cxf:cxf-tools-wadlto-jaxrs:" + versions.getSnapshot().getCxf() + "\"\n" + " }\n" + "}\n" + "\n" + "repositories {\n" + " mavenLocal()\n" + " mavenCentral()\n" + "}\n" + "\n" + "group = 'com.component'\n" + "description = 'An application generated by the Talend Component Kit Starter'\n" + "version = '0.0.1-SNAPSHOT'\n\n\n" + "jar {\n" + " baseName = 'application'\n" + " version = '0.0.1-SNAPSHOT'\n" + "}\n" + "\n" + "test {\n" + " testLogging.showStandardStreams = true\n" + "}\n" + "def wadlGeneratedFolder = \"$buildDir/generated-sources/cxf\"\n" + "task generateWadlClient {\n" + " def wadl = \"$projectDir/src/main/resources/wadl/client.xml\"\n" + "\n" + " inputs.file(wadl)\n" + " outputs.dir(wadlGeneratedFolder)\n" + "\n" + " doLast {\n" + " new File(wadlGeneratedFolder).mkdirs()\n" + "\n" + " new WADLToJava([\n" + " \"-d\", wadlGeneratedFolder,\n" + " \"-p\", \"com.application.client.wadl\",\n" + " wadl\n" + " ] as String[]).run(new ToolContext())\n" + " }\n" + "}\n" + "\n" + "sourceSets {\n" + " main {\n" + " java {\n" + " project.tasks.compileJava.dependsOn project.tasks.generateWadlClient\n" + " srcDir wadlGeneratedFolder\n" + " }\n" + " }\n" + "}\n" + "\n" + "repositories {\n" + " mavenCentral()\n" + "}\n" + "\n" + "dependencies {\n" + " provided group: 'org.talend.sdk.component', name: 'component-api', version: '" + versions.getSnapshot().getApiKit() + "'\n" + " compile group: 'org.apache.cxf', name: 'cxf-rt-rs-client', version: '" + versions.getSnapshot().getCxf() + "'\n" + "}\n" + "\n" + "publishing {\n" + " publications {\n" + " mavenJava(MavenPublication) {\n" + " from components.java\n" + " }\n" + " }\n" + " repositories {\n" + " mavenLocal()\n" + " }\n" + "}\n", files.get("application/build.gradle")); }
@POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"; return Response.ok().entity((StreamingOutput) out -> { generator.generate(toRequest(model), out); out.flush(); }).header("Content-Disposition", "inline; filename=" + filename).build(); }
ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"; return Response.ok().entity((StreamingOutput) out -> { generator.generate(toRequest(model), out); out.flush(); }).header("Content-Disposition", "inline; filename=" + filename).build(); } }
ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"; return Response.ok().entity((StreamingOutput) out -> { generator.generate(toRequest(model), out); out.flush(); }).header("Content-Disposition", "inline; filename=" + filename).build(); }  }
ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"; return Response.ok().entity((StreamingOutput) out -> { generator.generate(toRequest(model), out); out.flush(); }).header("Content-Disposition", "inline; filename=" + filename).build(); }  @GET @Path("configuration") @Produces(MediaType.APPLICATION_JSON) FactoryConfiguration getConfiguration(); @POST @Path("github") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Result createOnGithub(final GithubProject project); @POST @Path("openapi/github") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Result createOpenAPIOnGithub(final GithubProject project); @POST @Path("zip/form") @Produces("application/zip") Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers); @POST @Path("openapi/zip/form") @Produces("application/zip") Response createOpenAPIZip(@FormParam("project") final String compressedModel,
            @Context final Providers providers); @POST @Path("zip") @Produces("application/zip") @Consumes(MediaType.APPLICATION_JSON) StreamingOutput createZip(final ProjectModel model); @POST @Path("openapi/zip") @Produces("application/zip") @Consumes(MediaType.APPLICATION_JSON) StreamingOutput createOpenAPIZip(final ProjectModel model); }
ProjectResource { @POST @Path("zip/form") @Produces("application/zip") public Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers) { final ProjectModel model = readProjectModel(compressedModel, providers); final String filename = ofNullable(model.getArtifact()).orElse("zip") + ".zip"; return Response.ok().entity((StreamingOutput) out -> { generator.generate(toRequest(model), out); out.flush(); }).header("Content-Disposition", "inline; filename=" + filename).build(); }  @GET @Path("configuration") @Produces(MediaType.APPLICATION_JSON) FactoryConfiguration getConfiguration(); @POST @Path("github") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Result createOnGithub(final GithubProject project); @POST @Path("openapi/github") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Result createOpenAPIOnGithub(final GithubProject project); @POST @Path("zip/form") @Produces("application/zip") Response createZip(@FormParam("project") final String compressedModel, @Context final Providers providers); @POST @Path("openapi/zip/form") @Produces("application/zip") Response createOpenAPIZip(@FormParam("project") final String compressedModel,
            @Context final Providers providers); @POST @Path("zip") @Produces("application/zip") @Consumes(MediaType.APPLICATION_JSON) StreamingOutput createZip(final ProjectModel model); @POST @Path("openapi/zip") @Produces("application/zip") @Consumes(MediaType.APPLICATION_JSON) StreamingOutput createOpenAPIZip(final ProjectModel model);  }