org.geoserver.wms.WMS.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(231)

本文整理了Java中org.geoserver.wms.WMS.<init>()方法的一些代码示例,展示了WMS.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WMS.<init>()方法的具体详情如下:
包路径:org.geoserver.wms.WMS
类名称:WMS
方法名:<init>

WMS.<init>介绍

暂无

代码示例

代码示例来源:origin: org.geoserver/gs-wms

@Before
public void setUp() {
  this.reader = new CapabilitiesKvpReader(new WMS(null));
  this.kvp = new HashMap();
  this.rawKvp = new HashMap();
}

代码示例来源:origin: org.geoserver/gs-wms

@Before
public void setWMS() throws Exception {
  wms = new WMS(getGeoServer());
}

代码示例来源:origin: org.geoserver/gs-wms

@Before
public void setUp() throws Exception {
  geoServerImpl = new GeoServerImpl();
  geoServerImpl.add(new WMSInfoImpl());
  wms = new WMS(geoServerImpl);
  params = new HashMap<String, String>();
}

代码示例来源:origin: org.geoserver/gs-wms

public void testResolveLayersForStyleGroup() throws Exception {
  WMS wms = new WMS(getGeoServer());
  GetMapXmlReader reader = new GetMapXmlReader(wms);
  GetMapRequest request = reader.createRequest();
  InputStream resourceStream =
      getClass().getResource("WMSPostLayerGroupWithStyleGroup.xml").openStream();
  BufferedReader input = new BufferedReader(new InputStreamReader(resourceStream));
  request = (GetMapRequest) reader.read(request, input, new HashMap());
  String layer = MockData.BASIC_POLYGONS.getLocalPart();
  assertEquals(1, request.getLayers().size());
  assertTrue(request.getLayers().get(0).getName().endsWith(layer));
  assertEquals(1, request.getStyles().size());
  Style expected = getCatalog().getStyleByName("BasicStyleGroup").getStyle();
  Style style = request.getStyles().get(0);
  assertEquals(expected, style);
}

代码示例来源:origin: org.geoserver.extension/gs-monitor-core

@Test
public void testWMSGetLegendGraphic() throws Exception {
  WMS wms = new WMS(createMock(GeoServer.class));
  GetLegendGraphicRequest glg = new GetLegendGraphicRequest();
  FeatureType type = createMock(FeatureType.class);
  expect(type.getName()).andReturn(new NameImpl("http://acme.org", "foo")).anyTimes();
  replay(type);
  glg.setLayer(type);
  callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", glg));
  assertEquals("http://acme.org:foo", data.getResources().get(0));
}

代码示例来源:origin: org.geoserver.extension/monitor-core

@Test
public void testWMSGetLegendGraphic() throws Exception {
  WMS wms = new WMS(createMock(GeoServer.class));
  GetLegendGraphicRequest glg = new GetLegendGraphicRequest();
  
  FeatureType type = createMock(FeatureType.class);
  expect(type.getName()).andReturn(new NameImpl("http://acme.org", "foo")).anyTimes();
  replay(type);
  
  glg.setLayer(type);
  callback.operationDispatched(new Request(), op("GetFeatureInfo", "WMS", "1.1.1", glg));

  assertEquals("http://acme.org:foo", data.getResources().get(0));
}

代码示例来源:origin: org.geoserver/gs-wms

protected void setUpInternal() throws Exception {
  super.setUpInternal();
  dispatcher = (Dispatcher) applicationContext.getBean("dispatcher");
  WMS wms = new WMS(getGeoServer());
  reader = new GetMapKvpRequestReader(wms);
}

代码示例来源:origin: org.geoserver/gs-wms

protected void setUpInternal() throws Exception {
  super.setUpInternal();
  dispatcher = (Dispatcher) applicationContext.getBean("dispatcher");
  WMS wms = new WMS(getGeoServer());
  reader = new GetFeatureInfoKvpReader(wms);
}

代码示例来源:origin: org.geoserver/gs-wms

protected void setUpInternal() throws Exception {
  super.setUpInternal();
  dispatcher = (Dispatcher) applicationContext.getBean("dispatcher");
  WMS wms = new WMS(getGeoServer());
  reader = new GetMapXmlReader(wms);
}

代码示例来源:origin: org.geoserver/gs-wms

@Test
public void testStyleGroup() throws Exception {
  WMS wms = new WMS(getGeoServer());
  GetMapKvpRequestReader reader = new GetMapKvpRequestReader(wms);
  // asserts the a layerGroup can be created with null layer and a styleGroup sld
  HashMap kvp = new HashMap();
  kvp.put("layers", "BasicStyleGroup");
  kvp.put("styles", "");
  GetMapRequest request = reader.createRequest();
  request = reader.read(request, parseKvp(kvp), kvp);
  assertNotNull(request.getLayers());
  assertNotNull(request.getStyles());
}

代码示例来源:origin: org.geoserver/gs-wms

public void testSldDisabled() throws Exception {
  HashMap kvp = new HashMap();
  URL url = GetMapKvpRequestReader.class.getResource("BasicPolygonsLibraryDefault.sld");
  String decoded = URLDecoder.decode(url.toExternalForm(), "UTF-8");
  kvp.put("sld", decoded);
  kvp.put(
      "layers",
      MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  reader = new GetMapKvpRequestReader(wms);
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp);
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

代码示例来源:origin: org.geoserver/gs-wms

public void testSldDisabled() throws Exception {
  HashMap kvp = new HashMap();
  URL url = GetMapKvpRequestReader.class.getResource("BasicPolygonsLibraryDefault.sld");
  String decoded = URLDecoder.decode(url.toExternalForm(), "UTF-8");
  kvp.put("sld", decoded);
  kvp.put(
      "layers",
      MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  reader = new GetFeatureInfoKvpReader(wms);
  GetFeatureInfoRequest request = (GetFeatureInfoRequest) reader.createRequest();
  boolean error = false;
  try {
    request = (GetFeatureInfoRequest) reader.read(request, parseKvp(kvp), kvp);
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

代码示例来源:origin: org.geoserver/gs-wms

@Before
public void internalSetUp() throws IOException {
  this.catalog = getCatalog();
  geosConfig = new GeoServerImpl();
  geosInfo = new GeoServerInfoImpl(geosConfig);
  geosInfo.setContact(new ContactInfoImpl());
  geosConfig.setGlobal(geosInfo);
  wmsInfo = new WMSInfoImpl();
  geosConfig.add(wmsInfo);
  geosConfig.setCatalog(catalog);
  wmsConfig = new WMS(geosConfig);
  wmsConfig.setApplicationContext(applicationContext);
  req = new GetCapabilitiesRequest();
  req.setBaseUrl(baseUrl);
  getTestData()
      .copyTo(
          getClass().getResourceAsStream("/legendURL/BasicPolygons.png"),
          LegendSampleImpl.LEGEND_SAMPLES_FOLDER + "/BasicPolygons.png");
  getTestData()
      .copyTo(
          getClass().getResourceAsStream("/legendURL/Bridges.png"),
          LegendSampleImpl.LEGEND_SAMPLES_FOLDER + "/Bridges.png");
  Map<String, String> namespaces = new HashMap<String, String>();
  namespaces.put("xlink", "http://www.w3.org/1999/xlink");
  namespaces.put("wms", "http://www.opengis.net/wms");
  namespaces.put("ows", "http://www.opengis.net/ows");
  XMLUnit.setXpathNamespaceContext(new SimpleNamespaceContext(namespaces));
  XPATH = XMLUnit.newXpathEngine();
}

代码示例来源:origin: org.geoserver/gs-wms

public void testSldBodyDisabled() throws Exception {
  HashMap kvp = new HashMap();
  kvp.put("sld_body", STATES_SLD);
  kvp.put(
      "layers",
      MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  reader = new GetMapKvpRequestReader(wms);
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, parseKvp(kvp), kvp);
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

代码示例来源:origin: org.geoserver/gs-wms

public void testSldBodyDisabled() throws Exception {
    HashMap kvp = new HashMap();
    kvp.put("sld_body", STATES_SLD);
    kvp.put(
        "layers",
        MockData.BASIC_POLYGONS.getPrefix() + ":" + MockData.BASIC_POLYGONS.getLocalPart());

    WMS wms = new WMS(getGeoServer());
    WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
    WMSInfo info = new WMSInfoImpl();
    info.setDynamicStylingDisabled(Boolean.TRUE);
    getGeoServer().remove(oldInfo);
    getGeoServer().add(info);
    reader = new GetFeatureInfoKvpReader(wms);
    GetFeatureInfoRequest request = (GetFeatureInfoRequest) reader.createRequest();
    boolean error = false;
    try {
      request = (GetFeatureInfoRequest) reader.read(request, parseKvp(kvp), kvp);
    } catch (ServiceException e) {
      error = true;
    }
    getGeoServer().remove(info);
    getGeoServer().add(oldInfo);
    assertTrue(error);
  }
}

代码示例来源:origin: org.geoserver/gs-wms

/**
 * Sets up the configuration objects with default values. Since they're live, specific tests can
 * modify their state before running the assertions
 */
@Before
public void setUp() throws Exception {
  geosConfig = new GeoServerImpl();
  geosInfo = new GeoServerInfoImpl(geosConfig);
  geosInfo.setContact(new ContactInfoImpl());
  geosConfig.setGlobal(geosInfo);
  wmsInfo = new WMSInfoImpl();
  geosConfig.add(wmsInfo);
  catalog = new CatalogImpl();
  geosConfig.setCatalog(catalog);
  wmsConfig = new WMS(geosConfig);
  req = new GetCapabilitiesRequest();
  req.setBaseUrl(baseUrl);
  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();
}

代码示例来源:origin: org.geoserver/gs-wms

+ sldUrl.toString();
WMS wms = new WMS(getGeoServer());
GeoServerInfo geoserverInfo = wms.getGeoServer().getGlobal();
try {

代码示例来源:origin: org.geoserver/gs-wms

+ sldUrl.toString();
WMS wms = new WMS(getGeoServer());
GeoServerInfo geoserverInfo = wms.getGeoServer().getGlobal();
try {

代码示例来源:origin: org.geoserver/gs-wms

public void testAllowDynamicStyles() throws Exception {
  GetMapRequest request = (GetMapRequest) reader.createRequest();
  BufferedReader input = getResourceInputStream("WMSPostLayerGroupNonDefaultStyle.xml");
  WMS wms = new WMS(getGeoServer());
  WMSInfo oldInfo = wms.getGeoServer().getService(WMSInfo.class);
  WMSInfo info = new WMSInfoImpl();
  info.setDynamicStylingDisabled(Boolean.TRUE);
  getGeoServer().remove(oldInfo);
  getGeoServer().add(info);
  GetMapXmlReader reader = new GetMapXmlReader(wms);
  boolean error = false;
  try {
    request = (GetMapRequest) reader.read(request, input, new HashMap());
  } catch (ServiceException e) {
    error = true;
  }
  getGeoServer().remove(info);
  getGeoServer().add(oldInfo);
  assertTrue(error);
}

代码示例来源:origin: org.geoserver/gs-wms

public void testSldEntityResolver() throws Exception {
  WMS wms = new WMS(getGeoServer());
  GeoServerInfo geoserverInfo = wms.getGeoServer().getGlobal();
  try {

相关文章