@Test public void testPathAsArgumentCreate() throws Exception { ServerConfiguration config = new XMLConfiguration(provider, configDir.getCanonicalPath()); ((XMLConfiguration) config).setGridSetBroker(broker); config.afterPropertiesSet(); assertThat(configFile(cacheDir).exists(), is(false)); assertThat(configFile(configDir).exists(), is(true)); } }
@Test public void testDefaultToCacheDirCreate() throws Exception { ServerConfiguration config = new XMLConfiguration(provider, storageFinder); ((XMLConfiguration) config).setGridSetBroker(broker); config.afterPropertiesSet(); assertThat(configFile(cacheDir).exists(), is(true)); assertThat(configFile(configDir).exists(), is(false)); }
@Test public void testOverrideWithPropertyCreate() throws Exception { gwcConfigDirProp.setValue(configDir.getCanonicalPath()); ServerConfiguration config = new XMLConfiguration(provider, storageFinder); ((XMLConfiguration) config).setGridSetBroker(broker); config.afterPropertiesSet(); assertThat(configFile(cacheDir).exists(), is(false)); assertThat(configFile(configDir).exists(), is(true)); }
protected ServerConfiguration getConfig() throws Exception { if (configFile == null) { // create a temp XML config configDir = temp.getRoot(); configFile = temp.newFile(XMLConfiguration.DEFAULT_CONFIGURATION_FILE_NAME); // copy the example XML to the temp config file URL source = XMLConfiguration.class.getResource("geowebcache_190.xml"); FileUtils.copyURLToFile(source, configFile); } // initialize the config with an XMLFileResourceProvider that uses the temp config file gridSetBroker = new GridSetBroker(true, true); ConfigurationResourceProvider configProvider = new XMLFileResourceProvider( XMLConfiguration.DEFAULT_CONFIGURATION_FILE_NAME, (WebApplicationContext) null, configDir.getAbsolutePath(), null); config = new XMLConfiguration(null, configProvider); ((XMLConfiguration) config).setGridSetBroker(gridSetBroker); config.afterPropertiesSet(); return config; } }
config.afterPropertiesSet(); ServiceInformation savedInfo = config.getServiceInformation(); assertEquals(savedInfo.getProviderName(), "John Adams inc.");