/** * Should be invoked through Spring * * @param tileLayerDispatcher * @param gridSetBroker */ public GeoWebCacheDispatcher( TileLayerDispatcher tileLayerDispatcher, GridSetBroker gridSetBroker, StorageBroker storageBroker, BlobStoreAggregator blobStoreAggregator, ServerConfiguration mainConfiguration, RuntimeStats runtimeStats) { super(); this.tileLayerDispatcher = tileLayerDispatcher; this.gridSetBroker = gridSetBroker; this.runtimeStats = runtimeStats; this.storageBroker = storageBroker; this.blobStoreAggregator = blobStoreAggregator; this.mainConfiguration = mainConfiguration; if (mainConfiguration.isRuntimeStatsEnabled()) { this.runtimeStats.start(); } else { runtimeStats = null; } }
/** * Constructs a new POJO based on the provided {@link ServerConfiguration} * * @param template Template used to initialize properties */ public ServerConfigurationPOJO(ServerConfiguration template) throws IOException { this.serviceInformation = template.getServiceInformation(); this.runtimeStatsEnabled = template.isRuntimeStatsEnabled(); setLockProvider(template.getLockProvider()); this.fullWMS = template.isFullWMS(); this.wmtsCiteCompliant = template.isWmtsCiteCompliant(); this.backendTimeout = template.getBackendTimeout(); this.cacheBypassAllowed = template.isCacheBypassAllowed(); this.version = template.getVersion(); this.identifier = template.getIdentifier(); this.location = template.getLocation(); }
SRS srs = SRS.getEPSG3857(); EasyMock.expect(config.isRuntimeStatsEnabled()).andStubReturn(false);
SRS srs = SRS.getEPSG3857(); EasyMock.expect(config.isRuntimeStatsEnabled()).andStubReturn(false);
@Test public void testHomePage() throws Exception { IMocksControl stubs = EasyMock.createControl(MockType.NICE); TileLayerDispatcher tld = stubs.createMock("tld", TileLayerDispatcher.class); GridSetBroker gsb = stubs.createMock("gsb", GridSetBroker.class); StorageBroker sb = stubs.createMock("sb", StorageBroker.class); BlobStoreAggregator bsa = stubs.createMock("bsa", BlobStoreAggregator.class); ServerConfiguration config = stubs.createMock("config", ServerConfiguration.class); RuntimeStats rts = stubs.createMock("rts", RuntimeStats.class); DefaultStorageFinder dfs = stubs.createMock("dfs", DefaultStorageFinder.class); SecurityDispatcher secDisp = stubs.createMock("secDisp", SecurityDispatcher.class); EasyMock.expect(config.isRuntimeStatsEnabled()).andStubReturn(false); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/geowebcache/home"); MockHttpServletResponse response = new MockHttpServletResponse(); request.setContextPath("/geowebcache"); stubs.replay(); // Bean init GeoWebCacheDispatcher dispatcher = new GeoWebCacheDispatcher(tld, gsb, sb, bsa, config, rts); dispatcher.setApplicationContext(extensions.getMockContext()); dispatcher.setDefaultStorageFinder(dfs); dispatcher.setSecurityDispatcher(secDisp); // The test dispatcher.handleRequest(request, response); assertThat(response, hasStatus(HttpStatus.OK)); stubs.verify(); }
assertEquals("John Adams inc.", config.getServiceInformation().getProviderName()); Boolean runtimeStats = config.isRuntimeStatsEnabled(); assertTrue(runtimeStats); config.setRuntimeStatsEnabled(false); runtimeStats = config.isRuntimeStatsEnabled(); assertFalse(runtimeStats); ServiceInformation savedInfo = config.getServiceInformation(); assertEquals(savedInfo.getProviderName(), "John Adams inc."); assertFalse(config.isRuntimeStatsEnabled()); assertTrue(config.isFullWMS()); assertTrue((config.isWmtsCiteCompliant()));