Ejemplo n.º 1
0
  @Test
  public void testIsServiceEnabled() {
    Service service = mock(Service.class);

    when(service.getPathName()).thenReturn("wms");
    defaults.setWMSCEnabled(true);
    assertTrue(mediator.isServiceEnabled(service));
    defaults.setWMSCEnabled(false);
    assertFalse(mediator.isServiceEnabled(service));

    when(service.getPathName()).thenReturn("tms");
    defaults.setTMSEnabled(true);
    assertTrue(mediator.isServiceEnabled(service));
    defaults.setTMSEnabled(false);
    assertFalse(mediator.isServiceEnabled(service));

    when(service.getPathName()).thenReturn("wmts");
    defaults.setWMTSEnabled(true);
    assertTrue(mediator.isServiceEnabled(service));
    defaults.setWMTSEnabled(false);
    assertFalse(mediator.isServiceEnabled(service));

    when(service.getPathName()).thenReturn("somethingElse");
    assertTrue(mediator.isServiceEnabled(service));
  }
Ejemplo n.º 2
0
  /** NB The following code is shared across Google Maps, Mobile Google Maps and Virtual Earth */
  public void handleRequest(ConveyorTile tile) throws GeoWebCacheException {
    if (tile.getHint() != null) {
      // boolean requestTiled = true;

      if (tile.getHint().equals("not_cached,not_metatiled")) {
        // requestTiled = false;
      } else if (!tile.getHint().equals("not_cached")) {
        throw new GeoWebCacheException("Hint " + tile.getHint() + " is not known.");
      }

      TileLayer tl = tld.getTileLayer(tile.getLayerId());

      if (tl == null) {
        throw new GeoWebCacheException("Unknown layer " + tile.getLayerId());
      }

      if (!tl.isCacheBypassAllowed().booleanValue()) {
        throw new GeoWebCacheException(
            "Layer " + tile.getLayerId() + " is not configured to allow bypassing the cache.");
      }

      tile.setTileLayer(tl);
      tl.getNoncachedTile(tile);

      Service.writeTileResponse(tile, false);
    }
  }