public NIOLockProvider( DefaultStorageFinder storageFinder, int waitBeforeRetry, int maxLockAttempts) throws ConfigurationException { this.root = storageFinder.getDefaultPath(); this.waitBeforeRetry = waitBeforeRetry; this.maxLockAttempts = maxLockAttempts; }
public FileBlobStore(DefaultStorageFinder defStoreFinder) throws StorageException, ConfigurationException { this(defStoreFinder.getDefaultPath()); }
public NIOLockProvider(DefaultStorageFinder storageFinder) throws ConfigurationException { this(storageFinder.getDefaultPath()); }
public File getRootCacheDir() throws ConfigurationException { return new File(storageFinder.getDefaultPath()); }
public BDBQuotaStore( final DefaultStorageFinder cacheDirFinder, TilePageCalculator tilePageCalculator) throws ConfigurationException { Assert.notNull(cacheDirFinder, "cacheDirFinder can't be null"); Assert.notNull(tilePageCalculator, "tilePageCalculator can't be null"); this.tilePageCalculator = tilePageCalculator; this.cacheRootDir = cacheDirFinder.getDefaultPath(); boolean disabled = Boolean.valueOf(cacheDirFinder.findEnvVar(GWC_DISKQUOTA_DISABLED)).booleanValue(); if (disabled) { log.warn( " -- Found environment variable " + GWC_DISKQUOTA_DISABLED + " set to true. DiskQuotaMonitor is disabled."); } this.diskQuotaEnabled = !disabled; }
this.configDirectory = new File(storageDirFinder.getDefaultPath());
localStorageLoc = defaultStorageFinder.getDefaultPath(); } catch (ConfigurationException ex) { localStorageLoc = "Error";
public MetastoreRemover(DefaultStorageFinder finder) throws Exception { this.storageFinder = finder; File root = new File(storageFinder.getDefaultPath()); Connection conn = null; try {
File cacheRoot; try { cacheRoot = new File(storageFinder.getDefaultPath()); } catch (ConfigurationException e) { throw new RuntimeException(e);
@Before public void setup() throws Exception { layers = mock(TileLayerDispatcher.class); bsa = mock(BlobStoreAggregator.class); defaultStorageFinder = mock(DefaultStorageFinder.class); configuration = mock(XMLConfiguration.class); configs = new LinkedList<>(); when(bsa.getBlobStores()).thenReturn(configs); when(defaultStorageFinder.getDefaultPath()) .thenReturn(tmpFolder.getRoot().getAbsolutePath()); defaultLayer = mock(TileLayer.class); when(layers.getTileLayer(eq(DEFAULT_LAYER))).thenReturn(defaultLayer); when(layers.getTileLayer((String) argThat(new NotEq<>(DEFAULT_LAYER)))) .thenThrow(new GeoWebCacheException("layer not found")); }
/** * Prepares a simple data source for the embedded H2 * * @param cacheDirFinder * @return * @throws ConfigurationException */ private DataSource getH2DataSource(DefaultStorageFinder cacheDirFinder) throws ConfigurationException { File storeDirectory = new File(cacheDirFinder.getDefaultPath(), "diskquota_page_store_h2"); storeDirectory.mkdirs(); BasicDataSource dataSource = new BasicDataSource(); dataSource.setDriverClassName("org.h2.Driver"); String database = new File(storeDirectory, "diskquota").getAbsolutePath(); dataSource.setUrl("jdbc:h2:" + database); dataSource.setUsername("sa"); dataSource.setPoolPreparedStatements(true); dataSource.setAccessToUnderlyingConnectionAllowed(true); dataSource.setMinIdle(1); dataSource.setMaxActive(-1); // boundless dataSource.setMaxWait(5000); return dataSource; }
config.setEnabled(true); config.setDefault(true); config.setBaseDirectory(defaultStorageFinder.getDefaultPath()); BlobStore store; store = new FileBlobStore(config.getBaseDirectory());
@Before public void setUp() throws Exception { configDir = temp.newFolder("config"); cacheDir = temp.newFolder("cache"); provider = createMock(ApplicationContextProvider.class); appContext = createMock(WebApplicationContext.class); svltContext = createMock(ServletContext.class); storageFinder = createMock(DefaultStorageFinder.class); broker = new GridSetBroker(false, false); expect(provider.getApplicationContext()).andStubReturn(appContext); expect(appContext.getServletContext()).andStubReturn(svltContext); expect(svltContext.getInitParameter((String) anyObject())).andStubReturn(null); expect(storageFinder.getDefaultPath()).andStubReturn(cacheDir.getCanonicalPath()); expect(appContext.getBeansOfType(org.geowebcache.config.XMLConfigurationProvider.class)) .andReturn(Collections.emptyMap()); expect(svltContext.getRealPath("")).andStubReturn(temp.getRoot().getCanonicalPath()); replay(provider, appContext, svltContext, storageFinder); }
EasyMock.expect(storageFinder.getDefaultPath()) .andReturn(cacheDir.getAbsolutePath()) .anyTimes();
EasyMock.expect(cacheDirFinder.getDefaultPath()) .andReturn(targetDir.getRoot().getAbsolutePath()) .anyTimes();
EasyMock.expect(cacheDirFinder.getDefaultPath()) .andReturn(targetDir.getAbsolutePath()) .anyTimes();
expect(bsa.getBlobStores()).andStubReturn(configs); expect(defaultStorageFinder.getDefaultPath()) .andStubReturn(temp.getRoot().getAbsolutePath());