public GetCapabilitiesScaleHintTest() {

    Map<String, String> namespaces = new HashMap<String, String>();
    namespaces.put("xlink", "http://www.w3.org/1999/xlink");
    XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces));
    xpath = XMLUnit.newXpathEngine();
  }
Exemplo n.º 2
0
  /**
   * Verify that NetworkLink's generated by the reflector do not include a BBOX parameter, since
   * that would override the BBOX provided by Google Earth.
   *
   * @see <a href="https://osgeo-org.atlassian.net/browse/GEOS-2185">GEOS-2185</a>
   */
  @Test
  public void testNoBBOXInHREF() throws Exception {
    final String layerName = MockData.BASIC_POLYGONS.getLocalPart();
    final XpathEngine xpath = XMLUnit.newXpathEngine();
    String requestURL = "wms/kml?mode=refresh&layers=" + layerName;
    Document dom = getAsDOM(requestURL);
    print(dom);
    assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document)", dom);
    assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document/kml:NetworkLink)", dom);
    assertXpathEvaluatesTo("1", "count(kml:kml/kml:Document/kml:LookAt)", dom);

    assertXpathEvaluatesTo(layerName, "kml:kml/kml:Document/kml:NetworkLink[1]/kml:name", dom);
    assertXpathEvaluatesTo("1", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:open", dom);
    assertXpathEvaluatesTo("1", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:visibility", dom);

    assertXpathEvaluatesTo(
        "onStop", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewRefreshMode", dom);
    assertXpathEvaluatesTo(
        "1.0", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewRefreshTime", dom);
    assertXpathEvaluatesTo(
        "1.0", "kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:viewBoundScale", dom);
    Map<String, Object> expectedKVP =
        KvpUtils.parseQueryString(
            "http://localhost:80/geoserver/wms?format_options=MODE%3Arefresh%3Bautofit%3Atrue%3BKMPLACEMARK%3Afalse%3BKMATTR%3Atrue%3BKMSCORE%3A40%3BSUPEROVERLAY%3Afalse&service=wms&srs=EPSG%3A4326&width=2048&styles=BasicPolygons&height=2048&transparent=false&request=GetMap&layers=cite%3ABasicPolygons&format=application%2Fvnd.google-earth.kml+xml&version=1.1.1");
    Map<String, Object> resultedKVP =
        KvpUtils.parseQueryString(
            xpath.evaluate("kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom));

    assertMapsEqual(expectedKVP, resultedKVP);

    String href = xpath.evaluate("kml:kml/kml:Document/kml:NetworkLink/kml:Link/kml:href", dom);
    Pattern badPattern = Pattern.compile("&bbox=", Pattern.CASE_INSENSITIVE);
    assertFalse(badPattern.matcher(href).matches());
  }
Exemplo n.º 3
0
  @Test
  public void testLegend() throws Exception {
    String layerId = getLayerId(MockData.BASIC_POLYGONS);
    final String requestUrl =
        "wms/kml?layers="
            + layerId
            + "&styles=polygon&mode=download&format_options=legend:true" //
            + "&legend_options=fontStyle:bold;fontColor:ff0000;fontSize:18";
    Document doc = getAsDOM(requestUrl);
    // print(doc);

    assertEquals("kml", doc.getDocumentElement().getNodeName());

    // the icon itself
    XpathEngine xpath = XMLUnit.newXpathEngine();
    String href = xpath.evaluate("//kml:ScreenOverlay/kml:Icon/kml:href", doc);
    assertTrue(href.contains("request=GetLegendGraphic"));
    assertTrue(href.contains("layer=cite%3ABasicPolygons"));
    assertTrue(href.contains("style=polygon"));
    assertTrue(
        href.contains("LEGEND_OPTIONS=fontStyle%3Abold%3BfontColor%3Aff0000%3BfontSize%3A18"));

    // overlay location
    XMLAssert.assertXpathEvaluatesTo("0.0", "//kml:ScreenOverlay/kml:overlayXY/@x", doc);
    XMLAssert.assertXpathEvaluatesTo("0.0", "//kml:ScreenOverlay/kml:overlayXY/@y", doc);
    XMLAssert.assertXpathEvaluatesTo("pixels", "//kml:ScreenOverlay/kml:overlayXY/@xunits", doc);
    XMLAssert.assertXpathEvaluatesTo("pixels", "//kml:ScreenOverlay/kml:overlayXY/@yunits", doc);
    XMLAssert.assertXpathEvaluatesTo("10.0", "//kml:ScreenOverlay/kml:screenXY/@x", doc);
    XMLAssert.assertXpathEvaluatesTo("20.0", "//kml:ScreenOverlay/kml:screenXY/@y", doc);
    XMLAssert.assertXpathEvaluatesTo("pixels", "//kml:ScreenOverlay/kml:screenXY/@xunits", doc);
    XMLAssert.assertXpathEvaluatesTo("pixels", "//kml:ScreenOverlay/kml:screenXY/@yunits", doc);
  }
  @Override
  @Test
  public void testDeployment() throws Exception {
    HTTPMixIn httpMixIn = new HTTPMixIn();
    httpMixIn.initialize();
    try {
      String response =
          httpMixIn.postString(
              "http://localhost:" + getSoapClientPort() + "/SayHelloService/SayHelloService",
              SOAP_REQUEST);

      org.w3c.dom.Document d = XMLUnit.buildControlDocument(response);
      java.util.HashMap<String, String> m = new java.util.HashMap<String, String>();
      m.put("tns", "http://www.jboss.org/bpel/examples");
      NamespaceContext ctx = new SimpleNamespaceContext(m);
      XpathEngine engine = XMLUnit.newXpathEngine();
      engine.setNamespaceContext(ctx);

      NodeList l = engine.getMatchingNodes("//tns:result", d);
      assertEquals(1, l.getLength());
      assertEquals(org.w3c.dom.Node.ELEMENT_NODE, l.item(0).getNodeType());

      if (!l.item(0).getTextContent().equals("Hello Fred")) {
        fail("Expecting 'Hello Fred'");
      }
    } finally {
      httpMixIn.uninitialize();
    }
  }
Exemplo n.º 5
0
  @Test
  public void testLoanRequestUnableToHandle() throws Exception {
    HTTPMixIn httpMixIn = new HTTPMixIn();
    httpMixIn.initialize();
    try {
      String response =
          httpMixIn.postString("http://localhost:8080/loanService/loanService", SOAP_REQUEST_2);
      System.out.println(response);

      org.w3c.dom.Document d = XMLUnit.buildControlDocument(response);
      java.util.HashMap<String, String> m = new java.util.HashMap<String, String>();
      // m.put("tns", "http://example.com/loan-approval/loanService/");
      NamespaceContext ctx = new SimpleNamespaceContext(m);
      XpathEngine engine = XMLUnit.newXpathEngine();
      engine.setNamespaceContext(ctx);

      NodeList l = engine.getMatchingNodes("//faultcode", d);
      assertEquals(1, l.getLength());
      assertEquals(org.w3c.dom.Node.ELEMENT_NODE, l.item(0).getNodeType());

      if (!l.item(0).getTextContent().endsWith(":unableToHandleRequest")) {
        fail("Expecting 'unableToHandleRequest' fault code");
      }
    } finally {
      httpMixIn.uninitialize();
    }
  }
Exemplo n.º 6
0
  public void testMultiLayer() throws Exception {
    Document doc =
        getAsDOM(
            "/wfs?request=GetFeature&typename="
                + getLayerId(MockData.BASIC_POLYGONS)
                + ","
                + getLayerId(MockData.BRIDGES)
                + "&version=1.0.0&service=wfs");
    // print(doc);

    XpathEngine engine = XMLUnit.newXpathEngine();
    String schemaLocation = engine.evaluate("wfs:FeatureCollection/@xsi:schemaLocation", doc);
    assertNotNull(schemaLocation);
    String[] parsedLocations = schemaLocation.split("\\s+");
    // System.out.println(Arrays.toString(parsedLocations));
    int i = 0;
    for (; i < parsedLocations.length; i += 2) {
      if (parsedLocations[i].equals("http://www.opengis.net/cite")) {
        assertEquals(
            "http://localhost:8080/geoserver/wfs?service=WFS&version=1.0.0&request=DescribeFeatureType&typeName=cite%3ABasicPolygons,cite%3ABridges",
            parsedLocations[i + 1]);
        break;
      }
    }
    if (i >= parsedLocations.length) {
      fail("Could not find the http://www.opengis.net/cite schema location!");
    }
  }
Exemplo n.º 7
0
  /** @see {@link KMLReflector#organizeFormatOptionsParams(Map, Map)} */
  @Test
  public void testKmlFormatOptionsAsKVP() throws Exception {
    final String layerName =
        MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart();

    final String baseUrl = "wms/kml?layers=" + layerName + "&styles=&mode=superoverlay";
    final String requestUrl =
        baseUrl + "&kmltitle=myCustomLayerTitle&kmscore=10&legend=true&kmattr=true";
    Document dom = getAsDOM(requestUrl);
    XpathEngine xpath = XMLUnit.newXpathEngine();

    // print(dom);
    // all the kvp parameters (which should be set as format_options now are correctly parsed)
    String result = xpath.evaluate("//kml:NetworkLink/kml:Link/kml:href", dom);
    Map<String, Object> kvp = KvpUtils.parseQueryString(result);
    List<String> formatOptions = Arrays.asList(((String) kvp.get("format_options")).split(";"));
    assertEquals(9, formatOptions.size());
    assertTrue(formatOptions.contains("LEGEND:true"));
    assertTrue(formatOptions.contains("SUPEROVERLAY:true"));
    assertTrue(formatOptions.contains("AUTOFIT:true"));
    assertTrue(formatOptions.contains("KMPLACEMARK:false"));
    assertTrue(formatOptions.contains("OVERLAYMODE:auto"));
    assertTrue(formatOptions.contains("KMSCORE:10"));
    assertTrue(formatOptions.contains("MODE:superoverlay"));
    assertTrue(formatOptions.contains("KMATTR:true"));
    assertTrue(formatOptions.contains("KMLTITLE:myCustomLayerTitle"));
  }
Exemplo n.º 8
0
  @Test
  public void testNamespaceFilter() throws Exception {
    // try to filter on an existing namespace
    Document dom =
        getAsDOM(
            BASEPATH + "?request=GetCapabilities&service=WCS&acceptversions=1.1.1&namespace=wcs");
    Element e = dom.getDocumentElement();
    assertEquals("Capabilities", e.getLocalName());
    XpathEngine xpath = XMLUnit.newXpathEngine();
    assertTrue(
        xpath
                .getMatchingNodes("//wcs:CoverageSummary/ows:Title[starts-with(., wcs)]", dom)
                .getLength()
            > 0);
    assertEquals(
        0,
        xpath
            .getMatchingNodes("//wcs:CoverageSummary/ows:Title[not(starts-with(., wcs))]", dom)
            .getLength());

    // now filter on a missing one
    dom =
        getAsDOM(
            BASEPATH
                + "?request=GetCapabilities&service=WCS&acceptversions=1.1.1&namespace=NoThere");
    e = dom.getDocumentElement();
    assertEquals("Capabilities", e.getLocalName());
    assertEquals(0, xpath.getMatchingNodes("//wcs:CoverageSummary", dom).getLength());
  }
Exemplo n.º 9
0
  @Before
  public void prepare() throws IOException {
    xpath = XMLUnit.newXpathEngine();
    repository = (TransformRepository) applicationContext.getBean("transformRepository");

    File dd = testData.getDataDirectoryRoot();
    File wfs = new File(dd, "wfs");
    File transform = new File(wfs, "transform");
    deleteDirectory(transform);
    assertTrue(transform.mkdirs());
    FileUtils.copyDirectory(new File("src/test/resources/org/geoserver/wfs/xslt"), transform);
  }
Exemplo n.º 10
0
  @Test
  public void testResourceLink() throws Exception {
    addLayer();

    Document doc = getAsDOM("/rest/layers/states.xml");

    XpathEngine xpath = XMLUnit.newXpathEngine();
    String resourceUrl = xpath.evaluate("//resource/atom:link/@href", doc);
    resourceUrl = resourceUrl.substring(resourceUrl.indexOf("/rest"));

    doc = getAsDOM(resourceUrl);
    assertXpathEvaluatesTo("states", "/wmsLayer/name", doc);
  }
Exemplo n.º 11
0
  /**
   * Verify that NetworkLink's generated by the reflector do not include a BBOX parameter, since
   * that would override the BBOX provided by Google Earth.
   *
   * @see <a href="https://osgeo-org.atlassian.net/browse/GEOS-2185">GEOS-2185</a>
   */
  @Test
  public void testBBOXInHREF() throws Exception {
    final XpathEngine xpath = XMLUnit.newXpathEngine();
    String requestURL =
        "wms/kml?layers="
            + getLayerId(MockData.BASIC_POLYGONS)
            + "&bbox=-1,-1,-0.5,-0.5&mode=download";

    Document dom = getAsDOM(requestURL);
    // print(dom);

    assertEquals(1, xpath.getMatchingNodes("//kml:Placemark", dom).getLength());
  }
Exemplo n.º 12
0
  @Test
  public void testForceRasterKml() throws Exception {
    final String requestUrl =
        "wms/reflect?layers="
            + getLayerId(MockData.BASIC_POLYGONS)
            + "&styles=&format_options=KMSCORE:0;mode:refresh&format= "
            + KMLMapOutputFormat.MIME_TYPE;
    Document dom = getAsDOM(requestUrl);
    // print(dom);

    assertXpathEvaluatesTo("1", "count(//kml:Folder/kml:GroundOverlay)", dom);
    String href =
        XMLUnit.newXpathEngine().evaluate("//kml:Folder/kml:GroundOverlay/kml:Icon/kml:href", dom);
    assertTrue(href.startsWith("http://localhost:8080/geoserver/wms"));
    assertTrue(href.contains("request=GetMap"));
    assertTrue(href.contains("format=image%2Fpng"));
  }
Exemplo n.º 13
0
  @Test
  public void testWmsRepeatedLayerWithNonStandardStyleAndCqlFiler() throws Exception {
    final String layerName =
        MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart();
    final String titleName = MockData.BASIC_POLYGONS.getLocalPart();
    final String abstractValue = "abstract about " + titleName;

    String requestUrl =
        "wms/kml?mode=refresh&layers="
            + layerName
            + ","
            + layerName
            + "&styles=Default,Default&cql_filter=att1<10;att1>1000";
    Document dom = getAsDOM(requestUrl);

    assertEquals("kml", dom.getDocumentElement().getLocalName());

    assertXpathEvaluatesTo("2", "count(kml:kml/kml:Document/kml:NetworkLink)", dom);
    assertXpathEvaluatesTo(titleName, "kml:kml/kml:Document/kml:NetworkLink[1]/kml:name", dom);
    assertXpathEvaluatesTo(
        abstractValue, "kml:kml/kml:Document/kml:NetworkLink[1]/kml:description", dom);
    assertXpathEvaluatesTo(titleName, "kml:kml/kml:Document/kml:NetworkLink[2]/kml:name", dom);
    assertXpathEvaluatesTo(
        abstractValue, "kml:kml/kml:Document/kml:NetworkLink[2]/kml:description", dom);

    XpathEngine xpath = XMLUnit.newXpathEngine();

    String url1 = xpath.evaluate("/kml:kml/kml:Document/kml:NetworkLink[1]/kml:Url/kml:href", dom);
    String url2 = xpath.evaluate("/kml:kml/kml:Document/kml:NetworkLink[2]/kml:Url/kml:href", dom);

    assertNotNull(url1);
    assertNotNull(url2);

    Map<String, Object> kvp1 = KvpUtils.parseQueryString(url1);
    Map<String, Object> kvp2 = KvpUtils.parseQueryString(url2);

    assertEquals(layerName, kvp1.get("layers"));
    assertEquals(layerName, kvp2.get("layers"));

    assertEquals("Default", kvp1.get("styles"));
    assertEquals("Default", kvp2.get("styles"));

    assertEquals("att1<10", kvp1.get("cql_filter"));
    assertEquals("att1>1000", kvp2.get("cql_filter"));
  }
Exemplo n.º 14
0
 private void assertXPathCoordinates(
     String message, String expectedText, String xpath, Document doc) throws XpathException {
   XpathEngine engine = XMLUnit.newXpathEngine();
   String text = engine.evaluate(xpath, doc);
   if (equalsRegardingNull(expectedText, text)) {
     return;
   }
   if (expectedText != null && text != null) {
     String expectedCoordinates[] = expectedText.split("(\\s|,)");
     String actualCoordiantes[] = text.split("(\\s|,)");
     if (expectedCoordinates.length == actualCoordiantes.length) {
       final int LENGTH = actualCoordiantes.length;
       boolean checked = true;
       LIST:
       for (int i = 0; i < LENGTH; i++) {
         String expected = expectedCoordinates[i];
         String actual = actualCoordiantes[i];
         if (expected.length() == actual.length()) {
           if (!expected.equals(actual)) {
             checked = false;
             break LIST; // normal equals check will report issue
           }
         } else {
           try {
             double expectedOrdinate = Double.parseDouble(expected);
             double actualOridnate = Double.parseDouble(actual);
             if (Double.compare(expectedOrdinate, actualOridnate) != 0) {
               // Could do a Math.abs(expectedOrdinate - actualOridnate) <= delta check
               break LIST; // normal equals check will report issue
             }
           } catch (NumberFormatException formatException) {
             checked = false;
             break LIST; // normal equals check will report issue
           }
         }
       }
       if (checked) {
         return; // double based comparison checked all elements
       }
     }
   }
   // call normal assertEquals for consistent failure message
   assertEquals(message, expectedText, text);
 }
Exemplo n.º 15
0
 public void testLogBackwards() throws Exception {
   String request =
       "<wfsv:GetLog service=\"WFSV\" version=\"1.0.0\" outputFormat=\"GML2\" \r\n"
           + "  xmlns:topp=\"http://www.openplans.org/topp\"\r\n"
           + "  xmlns:ogc=\"http://www.opengis.net/ogc\"\r\n"
           + "  xmlns:wfs=\"http://www.opengis.net/wfs\"\r\n"
           + "  xmlns:wfsv=\"http://www.opengis.net/wfsv\"\r\n"
           + "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n"
           + "  <wfsv:DifferenceQuery typeName=\"topp:archsites\" fromFeatureVersion=\"100\" toFeatureVersion=\"0\"/>\r\n"
           + "</wfsv:GetLog>";
   Document doc = postAsDOM(root(), request);
   XpathEngine xpath = XMLUnit.newXpathEngine();
   NodeList nodes =
       xpath.getMatchingNodes(
           "//wfs:FeatureCollection/gml:featureMember/topp:changesets/@fid", doc);
   assertEquals(2, nodes.getLength());
   assertEquals("changesets.4", nodes.item(0).getTextContent());
   assertEquals("changesets.5", nodes.item(1).getTextContent());
 }
Exemplo n.º 16
0
  @Test
  public void testKmzEmbededPointImageSize() throws Exception {

    WMSMapContent mapContent = createMapContext(MockData.POINTS, "big-mark");

    File temp = File.createTempFile("test", "kmz", new File("target"));
    temp.delete();
    temp.mkdir();
    temp.deleteOnExit();

    File zip = new File(temp, "kmz.zip");
    zip.deleteOnExit();

    // create hte map producer
    KMZMapOutputFormat mapProducer = new KMZMapOutputFormat(getWMS());
    KMLMap map = mapProducer.produceMap(mapContent);

    FileOutputStream output = new FileOutputStream(zip);
    new KMLMapResponse(new KMLEncoder(), getWMS()).write(map, output, null);

    output.flush();
    output.close();

    assertTrue(zip.exists());

    // unzip and test it
    ZipFile zipFile = new ZipFile(zip);

    ZipEntry kmlEntry = zipFile.getEntry("wms.kml");
    InputStream kmlStream = zipFile.getInputStream(kmlEntry);

    Document kmlResult = XMLUnit.buildTestDocument(new InputSource(kmlStream));

    Double scale =
        Double.parseDouble(
            XMLUnit.newXpathEngine()
                .getMatchingNodes("(//kml:Style)[1]/kml:IconStyle/kml:scale", kmlResult)
                .item(0)
                .getTextContent());
    assertEquals(49d / 16d, scale, 0.01);

    zipFile.close();
  }
Exemplo n.º 17
0
  @Test
  public void testForceRasterKmz() throws Exception {
    final String requestUrl =
        "wms/reflect?layers="
            + getLayerId(MockData.BASIC_POLYGONS)
            + "&styles=&format_options=KMSCORE:0;mode:refresh&format= "
            + KMZMapOutputFormat.MIME_TYPE;
    MockHttpServletResponse response = getAsServletResponse(requestUrl);
    assertEquals(KMZMapOutputFormat.MIME_TYPE, response.getContentType());
    assertEquals(
        "attachment; filename=cite-BasicPolygons.kmz", response.getHeader("Content-Disposition"));

    ZipInputStream zis = new ZipInputStream(getBinaryInputStream(response));
    try {
      // first entry, the kml document itself
      ZipEntry entry = zis.getNextEntry();
      assertEquals("wms.kml", entry.getName());
      // we need to clone the input stream, as dom(is) closes the stream
      byte[] data = IOUtils.toByteArray(zis);
      Document dom = dom(new ByteArrayInputStream(data));
      assertXpathEvaluatesTo("1", "count(//kml:Folder/kml:GroundOverlay)", dom);
      String href =
          XMLUnit.newXpathEngine()
              .evaluate("//kml:Folder/kml:GroundOverlay/kml:Icon/kml:href", dom);
      assertEquals("images/layers_0.png", href);
      zis.closeEntry();

      // the images folder
      entry = zis.getNextEntry();
      assertEquals("images/", entry.getName());
      zis.closeEntry();

      // the ground overlay for the raster layer
      entry = zis.getNextEntry();
      assertEquals("images/layers_0.png", entry.getName());
      zis.closeEntry();
      assertNull(zis.getNextEntry());
    } finally {
      zis.close();
    }
  }
Exemplo n.º 18
0
  @Test
  public void testFeatureBoudingOn() throws Exception {
    WFSInfo wfs = getWFS();
    wfs.setFeatureBounding(true);
    getGeoServer().save(wfs);

    Document doc =
        getAsDOM(
            "wfs?request=GetFeature&typeName="
                + getLayerId(SystemTestData.BUILDINGS)
                + "&version=1.1.0&service=wfs&propertyName=ADDRESS");
    // print(doc);

    // check it's a feature collection
    assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection)", doc);
    // check the collection has non null bounds
    assertXpathEvaluatesTo("1", "count(//wfs:FeatureCollection/gml:boundedBy/gml:Envelope)", doc);
    // check that each feature has non null bounds
    XpathEngine xpath = XMLUnit.newXpathEngine();
    assertTrue(
        xpath.getMatchingNodes("//cite:Buildings/gml:boundedBy/gml:Envelope", doc).getLength() > 0);
  }
Exemplo n.º 19
0
  @Test
  public void testRasterTransformerSLD() throws Exception {
    URL url = getClass().getResource("allsymbolizers.sld");
    String urlExternal = URLDecoder.decode(url.toExternalForm(), "UTF-8");
    final String requestUrl =
        "wms/reflect?layers="
            + getLayerId(MockData.BASIC_POLYGONS)
            + "&format_options=KMSCORE:0;mode:refresh&format= "
            + KMLMapOutputFormat.MIME_TYPE
            + "&sld="
            + urlExternal;

    Document dom = getAsDOM(requestUrl);
    // print(dom);

    assertXpathEvaluatesTo("1", "count(//kml:Folder/kml:GroundOverlay)", dom);
    String href =
        XMLUnit.newXpathEngine().evaluate("//kml:Folder/kml:GroundOverlay/kml:Icon/kml:href", dom);
    href = URLDecoder.decode(href, "UTF-8");
    assertTrue(href.startsWith("http://localhost:8080/geoserver/wms"));
    assertTrue(href.contains("request=GetMap"));
    assertTrue(href.contains("format=image/png"));
    assertTrue(href.contains("&sld=" + urlExternal));
  }
 @Before
 public void setXpathEngine() throws Exception {
   xpath = XMLUnit.newXpathEngine();
 };
 @Before
 public void prepare() {
   xpath = XMLUnit.newXpathEngine();
 }