@Test void simpleInput(final WebTarget target) throws IOException { final ProjectModel.Entry datastoreConfig = new ProjectModel.Entry(); datastoreConfig.setName("testDso"); datastoreConfig.setType("string"); final ProjectModel.ReusableStructure datastore = new ProjectModel.ReusableStructure(); datastore.setId("24c20f6e-003b-9eb6-eb3b-4adf81adcc0a"); datastore.setName("DataStore1"); datastore.setStructure(new ProjectModel.Model()); datastore.getStructure().setEntries(singletonList(datastoreConfig)); final ProjectModel.Entry datasetDataStore = new ProjectModel.Entry(); datasetDataStore.setName("testDsoRef"); datasetDataStore.setType("datastore"); datasetDataStore.setReference(datastore.getId()); final ProjectModel.Entry datasetConfig = new ProjectModel.Entry(); datasetConfig.setName("testDst"); datasetConfig.setType("string"); final ProjectModel.ReusableStructure dataset = new ProjectModel.ReusableStructure(); dataset.setId("e35f8a48-0888-e6ff-9639-cd60a7b3ab6a"); dataset.setName("DataSet1"); dataset.setStructure(new ProjectModel.Model()); dataset.getStructure().setEntries(asList(datasetDataStore, datasetConfig)); final ProjectModel.Entry sourceDataSet = new ProjectModel.Entry(); sourceDataSet.setName("testDstRef"); sourceDataSet.setType("dataset"); sourceDataSet.setReference(dataset.getId()); final ProjectModel.Entry sourceAnything = new ProjectModel.Entry(); sourceAnything.setName("anything"); sourceAnything.setType("int"); final ProjectModel.Model sourceConfig = new ProjectModel.Model(); sourceConfig.setEntries(asList(sourceDataSet, sourceAnything)); final ProjectModel.Source source = new ProjectModel.Source(); source.setName("tIn"); source.setConfigurationStructure(sourceConfig); source.setGenericOutput(true); final ProjectModel projectModel = new ProjectModel(); projectModel.setFamily("theFamily"); projectModel.setSources(singletonList(source)); projectModel.setDatastores(singletonList(datastore)); projectModel.setDatasets(singletonList(dataset)); final Map<String, String> files = createZip(projectModel, target); final String datasetSrc = files.get("application/src/main/java/com/application/dataset/DataSet1.java"); assertTrue(datasetSrc.contains("import com.application.datastore.DataStore1;"), datasetSrc); assertTrue(datasetSrc.contains("private DataStore1 testDsoRef;"), datasetSrc); final String datastoreSrc = files.get("application/src/main/java/com/application/datastore/DataStore1.java"); assertTrue(datastoreSrc.contains("@DataStore(\"DataStore1\")"), datastoreSrc); assertTrue(datastoreSrc.contains("private String testDso;"), datastoreSrc); final String componentConfig = files.get("application/src/main/java/com/application/source/TInMapperConfiguration.java"); assertTrue(componentConfig.contains("DataSet1 testDstRef;"), componentConfig); final String i18n = files.get("application/src/main/resources/com/application/Messages.properties"); assertTrue(i18n .contains("theFamily.dataset.DataSet1._displayName=DataSet1\n" + "theFamily.datastore.DataStore1._displayName=DataStore1"), i18n); final String datasetI18n = files.get("application/src/main/resources/com/application/dataset/Messages.properties"); assertTrue( datasetI18n .contains("DataSet1.testDsoRef._displayName=testDsoRef\nDataSet1.testDst._displayName=testDst"), datasetI18n); final String datastoreI18n = files.get("application/src/main/resources/com/application/datastore/Messages.properties"); assertTrue(datastoreI18n.contains("DataStore1.testDso._displayName=testDso"), datastoreI18n); }
@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);  }