WorkspaceResource extends TransactionalResource { @Timed @Path("manifest") @POST public String manifest(@Auth AuthorizedPrincipal principal, @Context HttpServletRequest request, InputStream requestBody, @Context DSLContext create) { return mutate(principal, model -> { Agency p = model.getCurrentPrincipal() .getPrincipal(); JsonImporter manifest; try { manifest = JsonImporter.manifest(requestBody, model); } catch (IOException e) { log.info(String.format("Failed deserializing workspace snapshot by: %s:%s", p.getName(), p.getId()), e); throw new WebApplicationException(String.format("Failed deserializing workspace: %s", e.getMessage()), Status.BAD_REQUEST); } Product definingProduct = manifest.getWorkspace() .getDefiningProduct(); Workspace workspace = model.wrap(Workspace.class, definingProduct); return workspace.get_Properties() .getIri(); }, create); } WorkspaceResource();  WorkspaceResource(URLClassLoader executionScope); @SuppressWarnings({ "unchecked", "rawtypes" }) static Map<String, Object> getVariables(Map request); @Timed @GET List<Map<String, Object>> getWorkspaces(@Auth AuthorizedPrincipal principal,
                                                   @Context DSLContext create); @Timed @Path("loadSnapshot") @POST void loadSnapshot(@Auth AuthorizedPrincipal principal,
                             @Context HttpServletRequest request,
                             InputStream requestBody,
                             @Context DSLContext create); @Timed @Path("loadWorkspace") @POST String loadWorkspace(@Auth AuthorizedPrincipal principal,
                                @Context HttpServletRequest request,
                                InputStream requestBody,
                                @Context DSLContext create); @Timed @Path("manifest") @POST String manifest(@Auth AuthorizedPrincipal principal,
                           @Context HttpServletRequest request,
                           InputStream requestBody,
                           @Context DSLContext create); @Path("{workspace}") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceGraphIql(@Auth AuthorizedPrincipal principal,
                                    @PathParam("workspace") String workspace); @Path("{workspace}/meta") @GET @Produces({ MediaType.TEXT_HTML }) String workspaceMetaGraphIql(@Auth AuthorizedPrincipal principal,
                                        @PathParam("workspace") String workspace); @Timed @Path("{workspace}") @POST ExecutionResult query(@Auth AuthorizedPrincipal principal,
                                 @PathParam("workspace") String workspace,
                                 @SuppressWarnings("rawtypes") Map request,
                                 @Context DSLContext create); @Timed @Path("{workspace}/meta") @POST ExecutionResult queryMeta(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @SuppressWarnings("rawtypes") Map request,
                                     @Context DSLContext create); @Timed @Path("{workspace}/serialize") @GET String serializeWorkspace(@Auth AuthorizedPrincipal principal,
                                     @PathParam("workspace") String workspace,
                                     @Context DSLContext create); @Timed @Path("snapshot") @GET String snapshot(@Auth AuthorizedPrincipal principal,
                           @Context DSLContext create);  }
@Test public void testManifest() throws Exception { WorkspaceResource resource = new WorkspaceResource(); String iri = resource.manifest(null, null, getClass().getResourceAsStream("/thing.json"), model.create()); assertEquals(THING_URI, iri); }