@Test public void getTileDefaultsToDefaultBlobStore() throws Exception { store = create(); LiveStore liveStore = store.blobStores.get(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID); liveStore.liveInstance = spy(liveStore.liveInstance); when(defaultLayer.getBlobStoreId()).thenReturn(null); TileObject tile = queryTile(0, 0, 0); store.get(tile); verify(liveStore.liveInstance).get(tile); }
@Test public void getTileInvalidLayer() throws Exception { store = create(); LiveStore liveStore = store.blobStores.get(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID); liveStore.liveInstance = spy(liveStore.liveInstance); when(defaultLayer.getBlobStoreId()).thenReturn(null); TileObject tile = queryTile("someLayer", DEFAULT_GRIDSET, DEFAULT_FORMAT, 0, 0, 0); ex.expect(StorageException.class); ex.expectMessage("layer not found"); store.get(tile); }
@Test public void getTileDisabledStore() throws Exception { boolean isEnabled = false; configs.add( config("store1", false, isEnabled, tmpFolder.newFolder().getAbsolutePath(), 1024)); store = create(); when(defaultLayer.getBlobStoreId()).thenReturn("store1"); TileObject tile = queryTile(0, 0, 0); ex.expect(StorageException.class); ex.expectMessage("Attempted to use a blob store that's disabled"); store.get(tile); }
@Test public void getTileInvalidBlobStore() throws Exception { configs.add(config("default", true, true, tmpFolder.newFolder().getAbsolutePath(), 1024)); store = create(); when(defaultLayer.getBlobStoreId()).thenReturn("nonExistentStore"); ex.expect(StorageException.class); ex.expectMessage("No BlobStore with id 'nonExistentStore' found"); store.get(queryTile(0, 0, 0)); }