@Test void beamFacet(final WebTarget target) throws IOException { final ProjectModel projectModel = new ProjectModel(); projectModel.setPackageBase("com.foo"); projectModel.setFacets(singletonList("Apache Beam")); { final ProjectModel.Source source = new ProjectModel.Source(); source.setName("tIn"); source.setGenericOutput(true); projectModel.setSources(singletonList(source)); } { final ProjectModel.Processor proc = new ProjectModel.Processor(); proc.setName("tIn"); { final ProjectModel.NamedModel in = new ProjectModel.NamedModel(); in.setName("__default__"); in.setGeneric(true); proc.setInputStructures(singletonList(in)); } proc.setOutputStructures(emptyList()); projectModel.setProcessors(singletonList(proc)); } final Map<String, String> files = createZip(projectModel, target); assertTrue(files.get("application/README.adoc").contains("=== Apache Beam"), files.toString()); assertEquals(resourceFileToString("generated/ProjectResourceTest/beamFacet/TInMapperBeamTest.java"), files.get("application/src/test/java/com/foo/source/TInMapperBeamTest.java")); assertEquals(resourceFileToString("generated/ProjectResourceTest/beamFacet/TInOutputBeamTest.java"), files.get("application/src/test/java/com/foo/output/TInOutputBeamTest.java")); }
@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);  }