@Test @Category(UnitTest.class) public void testGetColorScaleLegendVertical() throws Exception { Mockito.when(service.getColorScaleFromName(Mockito.anyString())).thenReturn(createRainbowColorScale()); Response response = target( "colorscales/legend/mrgeo/test-files/output/org.mrgeo.resources.raster.mrspyramid/ColorScaleResourceTest/rainbow.xml") .queryParam("max", "1000") .request().get(); Assert.assertEquals("text/html", response.getHeaderString("Content-Type")); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new ByteArrayInputStream(response.readEntity(String.class).getBytes())); Assert.assertEquals(1, doc.getElementsByTagName("img").getLength()); Assert.assertTrue(doc.getElementsByTagName("div").getLength() > 1); Assert.assertEquals( "mrgeo/test-files/output/org.mrgeo.resources.raster.mrspyramid/ColorScaleResourceTest/rainbow.xml?width=20&height=200", doc.getElementsByTagName("img").item(0).getAttributes().getNamedItem("src").getTextContent()); }
@GET @Produces(MediaType.APPLICATION_JSON) public ColorScaleList get() throws MrsPyramidServiceException { log.info("Retrieving color scales file list..."); getService(); List<String> files = service.getColorScales(); log.info("Color scales file list retrieved."); return new ColorScaleList(files); }
ColorScaleResource { @GET @Produces(MediaType.APPLICATION_JSON) public ColorScaleList get() throws MrsPyramidServiceException { log.info("Retrieving color scales file list..."); getService(); List<String> files = service.getColorScales(); log.info("Color scales file list retrieved."); return new ColorScaleList(files); } }
ColorScaleResource { @GET @Produces(MediaType.APPLICATION_JSON) public ColorScaleList get() throws MrsPyramidServiceException { log.info("Retrieving color scales file list..."); getService(); List<String> files = service.getColorScales(); log.info("Color scales file list retrieved."); return new ColorScaleList(files); }  }
ColorScaleResource { @GET @Produces(MediaType.APPLICATION_JSON) public ColorScaleList get() throws MrsPyramidServiceException { log.info("Retrieving color scales file list..."); getService(); List<String> files = service.getColorScales(); log.info("Color scales file list retrieved."); return new ColorScaleList(files); }  @GET @Produces(MediaType.APPLICATION_JSON) ColorScaleList get(); @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces("image/png") @Path("/{path: .*+}") Response getColorScaleSwatch(@PathParam("path") String colorScalePath,
    @DefaultValue("200") @QueryParam("width") int width,
    @DefaultValue("20") @QueryParam("height") int height
); @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces("text/html") @Path("/legend/{name: .*+}") Response getColorScaleLegend(@PathParam("name") String name,
    @DefaultValue("20") @QueryParam("width") int width,
    @DefaultValue("200") @QueryParam("height") int height,
    @DefaultValue("0") @QueryParam("min") Double min,
    @QueryParam("max") Double max,
    @DefaultValue("") @QueryParam("units") String units
); }
ColorScaleResource { @GET @Produces(MediaType.APPLICATION_JSON) public ColorScaleList get() throws MrsPyramidServiceException { log.info("Retrieving color scales file list..."); getService(); List<String> files = service.getColorScales(); log.info("Color scales file list retrieved."); return new ColorScaleList(files); }  @GET @Produces(MediaType.APPLICATION_JSON) ColorScaleList get(); @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces("image/png") @Path("/{path: .*+}") Response getColorScaleSwatch(@PathParam("path") String colorScalePath,
    @DefaultValue("200") @QueryParam("width") int width,
    @DefaultValue("20") @QueryParam("height") int height
); @SuppressFBWarnings(value = "JAXRS_ENDPOINT", justification = "verified") @GET @Produces("text/html") @Path("/legend/{name: .*+}") Response getColorScaleLegend(@PathParam("name") String name,
    @DefaultValue("20") @QueryParam("width") int width,
    @DefaultValue("200") @QueryParam("height") int height,
    @DefaultValue("0") @QueryParam("min") Double min,
    @QueryParam("max") Double max,
    @DefaultValue("") @QueryParam("units") String units
);  }