@Test @Category(UnitTest.class) public void testGetMetadata() throws Exception { Mockito.when(service.getMetadata(Mockito.anyString())).thenReturn(getMetaData()); String response = target("metadata/all-ones") .request().get(String.class); ObjectMapper mapper = new ObjectMapper(); MrsPyramidMetadata md = mapper.readValue(response, MrsPyramidMetadata.class); Assert.assertEquals(1, md.getBands()); Assert.assertEquals(10, md.getMaxZoomLevel()); Bounds bounds = md.getBounds(); Assert.assertEquals("Bad bounds - min x", 141.7066, bounds.w, 0.0001); Assert.assertEquals("Bad bounds - min y", -18.3733, bounds.s, 0.0001); Assert.assertEquals("Bad bounds - max x", 142.56, bounds.e, 0.0001); Assert.assertEquals("Bad bounds - max y", -17.52, bounds.n, 0.0001); Assert.assertEquals(MrGeoConstants.MRGEO_MRS_TILESIZE_DEFAULT_INT, md.getTilesize()); Assert.assertEquals(DataBuffer.TYPE_FLOAT, md.getTileType()); LongRectangle tb = md.getTileBounds(10); Assert.assertEquals("Bad tile bounds - min x", 915, tb.getMinX()); Assert.assertEquals("Bad tile bounds - min y", 203, tb.getMinY()); Assert.assertEquals("Bad tile bounds - max x", 917, tb.getMaxX()); Assert.assertEquals("Bad tile bounds - max y", 206, tb.getMaxY()); }
@SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") public Response getMetadata(@PathParam("output") String imgName) { try { getService(); return Response.status(Status.OK).entity(service.getMetadata(imgName)).build(); } catch (NotFoundException e) { log.error("Exception thrown", e); String error = e.getMessage() != null ? e.getMessage() : ""; return Response.status(Status.NOT_FOUND).entity(error).build(); } catch (Exception e1) { log.error("Exception thrown", e1); String error = e1.getMessage() != null ? e1.getMessage() : ""; return Response.serverError().entity(error).build(); } }
MetadataResource { @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") public Response getMetadata(@PathParam("output") String imgName) { try { getService(); return Response.status(Status.OK).entity(service.getMetadata(imgName)).build(); } catch (NotFoundException e) { log.error("Exception thrown", e); String error = e.getMessage() != null ? e.getMessage() : ""; return Response.status(Status.NOT_FOUND).entity(error).build(); } catch (Exception e1) { log.error("Exception thrown", e1); String error = e1.getMessage() != null ? e1.getMessage() : ""; return Response.serverError().entity(error).build(); } } }
MetadataResource { @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") public Response getMetadata(@PathParam("output") String imgName) { try { getService(); return Response.status(Status.OK).entity(service.getMetadata(imgName)).build(); } catch (NotFoundException e) { log.error("Exception thrown", e); String error = e.getMessage() != null ? e.getMessage() : ""; return Response.status(Status.NOT_FOUND).entity(error).build(); } catch (Exception e1) { log.error("Exception thrown", e1); String error = e1.getMessage() != null ? e1.getMessage() : ""; return Response.serverError().entity(error).build(); } }  }
MetadataResource { @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") public Response getMetadata(@PathParam("output") String imgName) { try { getService(); return Response.status(Status.OK).entity(service.getMetadata(imgName)).build(); } catch (NotFoundException e) { log.error("Exception thrown", e); String error = e.getMessage() != null ? e.getMessage() : ""; return Response.status(Status.NOT_FOUND).entity(error).build(); } catch (Exception e1) { log.error("Exception thrown", e1); String error = e1.getMessage() != null ? e1.getMessage() : ""; return Response.serverError().entity(error).build(); } }  @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") Response getMetadata(@PathParam("output") String imgName); }
MetadataResource { @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") public Response getMetadata(@PathParam("output") String imgName) { try { getService(); return Response.status(Status.OK).entity(service.getMetadata(imgName)).build(); } catch (NotFoundException e) { log.error("Exception thrown", e); String error = e.getMessage() != null ? e.getMessage() : ""; return Response.status(Status.NOT_FOUND).entity(error).build(); } catch (Exception e1) { log.error("Exception thrown", e1); String error = e1.getMessage() != null ? e1.getMessage() : ""; return Response.serverError().entity(error).build(); } }  @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{output: .*+}") Response getMetadata(@PathParam("output") String imgName);  }