MetadataResource { @POST @Produces(MediaType.APPLICATION_JSON) @ConfiguredRolesAllowed(ConfiguredRolesAllowedDynamicFeature.CCH_ADMIN_USER_PROP) public Response getMetadata(@Context HttpServletRequest req, @FormDataParam("file") String postBody) { ParsedMetadata result = MetadataUtil.parseMetadataXmlFile(postBody); if(result != null) { return Response.ok(GsonUtil.getDefault().toJson(result)).build(); } return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR).build(); }  @POST @Produces(MediaType.APPLICATION_JSON) @ConfiguredRolesAllowed(ConfiguredRolesAllowedDynamicFeature.CCH_ADMIN_USER_PROP) Response getMetadata(@Context HttpServletRequest req, @FormDataParam("file") String postBody);  }
@Test public void testGetMetadataWithoutCswBTXml() throws IOException { System.out.println("testGetMetadataWithoutCswBTXml"); String packageName = this.getClass().getCanonicalName(); System.out.println("PackageName: " + packageName); String replaced = packageName.replaceAll("[.]", "/"); String[] names = replaced.split("/MetadataResourceTest"); String packageNameShort = names[0]; String testFileFullName = packageNameShort + "/" + BTxml; String metadataXml = loadResourceAsString(testFileFullName); MetadataResource mr = new MetadataResource(); Response resp = mr.getMetadata(null, metadataXml); System.out.println("Response: " + resp.getEntity()); Map<String,Object> gsonResp = GsonUtil.getDefault().fromJson((String) resp.getEntity(), Map.class); assertEquals(7,gsonResp.size()); }