}
}
out.print("Performing GetMap operation...");
GetMapRequest request = wms.createGetMapRequest();
request.addLayer(layer);
CRSEnvelope bbox = layer.getLatLonBoundingBox();
request.setBBox(bbox);
request.setFormat(format);
request.setSRS("EPSG:4326");
request.setDimensions("100","100");
try {
GetMapResponse response = wms.issueRequest(request);
out.println("received a response.");
out.print("Checking returned format...");
if (response.getContentType().indexOf(format) == -1) {
out.println("server returned bad format. Expected "+format+", got "+response.getContentType()+".");
passed = false;
} else {
out.println("passed.");
}
out.print("Checking dimensions...");
BufferedImage image = ImageIO.read(response.getInputStream());
if (image == null) {
out.println("returned a bad image. ContentType is "+response.getContentType());
passed = false;
} else if (image.getWidth() != 100 || image.getHeight() != 100) {
out.println("server returned bad dimensions. Expect 100, 100. Returned "+image.getWidth()+","+image.getHeight());
passed = false;
} else {
out.println("passed.");
}
} catch (ServiceException e) {
out.println("failed.");
passed = false;
while (e != null) {
if (e.getLocator() != null && e.getLocator().length() != 0) {
out.println("ServiceException at "+e.getLocator()+": "+e.getMessage()+"("+e.getCode()+")");
}
out.println("ServiceException: "+e.getMessage()+"("+e.getCode()+")");
e = e.getNext();
}
} catch (IOException e) {
out.println("failed.");
passed = false;
out.println("IOException: "+e.getMessage());
e.printStackTrace(out);
} catch (SAXException e) {
out.println("failed.");
passed = false;
out.println("SAXException: "+e.getMessage());
e.printStackTrace(out);
} finally {
out.println(request.getFinalURL());
}
// if (caps.getRequest().getGetFeatureInfo() != null) {
// out.println("");
// out.println("Server supports GetFeatureInfo requests. Beginning tests.");