示例#1
0
  @Test
  public void testPostAsJSON() throws Exception {
    if (!RemoteOWSTestSupport.isRemoteWMSStatesAvailable(LOGGER)) {
      LOGGER.warning("Skipping layer posting test as remote server is not available");
      return;
    }

    assertNull(catalog.getResourceByName("sf", "bugsites", WMSLayerInfo.class));

    String json =
        "{"
            + "'wmsLayer':{"
            + "'name':'bugsites',"
            + "'nativeName':'og:bugsites',"
            + "'srs':'EPSG:4326',"
            + "'nativeCRS':'EPSG:4326',"
            + "'store':'demo'"
            + "}"
            + "}";
    MockHttpServletResponse response =
        postAsServletResponse("/rest/workspaces/sf/wmsstores/demo/wmslayers/", json, "text/json");

    assertEquals(201, response.getStatusCode());
    assertNotNull(response.getHeader("Location"));
    assertTrue(
        response
            .getHeader("Location")
            .endsWith("/workspaces/sf/wmsstores/demo/wmslayers/bugsites"));

    WMSLayerInfo layer = catalog.getResourceByName("sf", "bugsites", WMSLayerInfo.class);
    assertNotNull(layer.getNativeBoundingBox());
  }
示例#2
0
  @Test
  public void testPostAsXML() throws Exception {
    if (!RemoteOWSTestSupport.isRemoteWMSStatesAvailable(LOGGER)) {
      LOGGER.warning("Skipping layer posting test as remote server is not available");
      return;
    }

    assertNull(catalog.getResourceByName("sf", "bugsites", WMSLayerInfo.class));

    String xml =
        "<wmsLayer>"
            + "<name>bugsites</name>"
            + "<nativeName>og:bugsites</nativeName>"
            + "<srs>EPSG:4326</srs>"
            + "<nativeCRS>EPSG:4326</nativeCRS>"
            + "<store>demo</store>"
            + "</wmsLayer>";
    MockHttpServletResponse response =
        postAsServletResponse("/rest/workspaces/sf/wmsstores/demo/wmslayers/", xml, "text/xml");

    assertEquals(201, response.getStatusCode());
    assertNotNull(response.getHeader("Location"));
    assertTrue(
        response
            .getHeader("Location")
            .endsWith("/workspaces/sf/wmsstores/demo/wmslayers/bugsites"));

    WMSLayerInfo layer = catalog.getResourceByName("sf", "bugsites", WMSLayerInfo.class);
    assertNotNull(layer.getNativeBoundingBox());
  }
  /**
   * Checks the bounds process returned the expected envelope
   *
   * @param request
   * @param id
   * @throws Exception
   */
  void executeState1BoundsTest(String request, String id) throws Exception {
    if (!RemoteOWSTestSupport.isRemoteWMSStatesAvailable(LOGGER)) {
      LOGGER.warning("Remote OWS tests disabled, skipping test with " + id + " reference source");
      return;
    }

    MockHttpServletResponse resp = postAsServletResponse(root(), request);
    ReferencedEnvelope re = toEnvelope(resp.getOutputStreamContent());
    assertEquals(-91.516129, re.getMinX(), 0.001);
    assertEquals(36.986771, re.getMinY(), 0.001);
    assertEquals(-87.507889, re.getMaxX(), 0.001);
    assertEquals(42.509361, re.getMaxY(), 0.001);
  }
示例#4
0
  @Test
  public void testGetAllAvailable() throws Exception {
    if (!RemoteOWSTestSupport.isRemoteWMSStatesAvailable(LOGGER)) {
      LOGGER.warning("Skipping layer availability test as remote server is not available");
      return;
    }

    Document dom = getAsDOM("/rest/workspaces/sf/wmsstores/demo/wmslayers.xml?list=available");
    // print(dom);

    // can't control the demo server enough to check the type names, but it should have something
    // more than just topp:states
    assertXpathEvaluatesTo("true", "count(//wmsLayerName) > 0", dom);
  }
示例#5
0
  public void testVectorWithRemoteLayer() throws Exception {
    if (!RemoteOWSTestSupport.isRemoteWFSStatesAvailable(LOGGER)) return;

    Document doc =
        getAsDOM(
            "wms?request=getmap&service=wms&version=1.1.1"
                + "&format="
                + KMLMapOutputFormat.MIME_TYPE
                + "&layers=topp:states"
                + "&styles=Default"
                + "&height=1024&width=1024&bbox=-180,-90,180,90&srs=EPSG:4326"
                + "&remote_ows_type=wfs"
                + "&remote_ows_url="
                + RemoteOWSTestSupport.WFS_SERVER_URL
                + "&cql_filter=PERSONS>20000000");
    print(doc);

    assertEquals(1, doc.getElementsByTagName("Placemark").getLength());
  }