@Deprecated public DefaultStorageBroker(BlobStore blobStore) { this(blobStore, new TransientCache(100, 1024)); }
@Before public void setUp() throws Exception { transCache = new TransientCache(MAX_TILES, MAX_SPACE_KiB, EXPIRE_TIME); ticker = new TestTicker(System.nanoTime()); transCache.setTicker(ticker); }
private StorageBroker resetAndPrepStorageBroker() throws Exception { System.out.println("Deleting old test database."); String blobPath = findTempDir() + File.separator + TEST_BLOB_DIR_NAME; System.out.println("Creating new blobstore in " + blobPath); File blobDirs = new File(blobPath); if (!blobDirs.exists() && !blobDirs.mkdirs()) { throw new StorageException("Unable to create " + blobPath); } BlobStore blobStore = new FileBlobStore(blobPath); TransientCache transCache = new TransientCache(100, 1024, 2000); StorageBroker sb = new DefaultStorageBroker(blobStore); // long[] xyz = {1L,2L,3L}; Resource blob = new ByteArrayResource(new byte[20 * 1024]); System.out.println("Inserting into database, " + TILE_PUT_COUNT + " tiles"); long startInsert = System.currentTimeMillis(); for (int i = 1; i < TILE_PUT_COUNT; i++) { long tmp = (long) Math.log(i) + 1; long tmp2 = i % tmp; long[] xyz = {tmp2, tmp2, (long) Math.log10(i)}; TileObject completeObj = TileObject.createCompleteTileObject( "test", xyz, "hefty-gridSet:id1", "image/jpeg", null, blob); sb.put(completeObj); } long stopInsert = System.currentTimeMillis(); System.out.println( TILE_PUT_COUNT + " inserts took " + Long.toString(stopInsert - startInsert) + "ms"); return sb; }