@BeforeClass
 public static void setUp() throws Exception {
   deleteDatabases();
   sc = SpatialConnect.getInstance();
   sc.initialize(activity);
   sc.addConfig(localConfigFile);
   sc.startAllServices();
   waitForStoreToStart(WHITEHORSE_GPKG_ID);
 }
 @Test
 public void testTileSourcesAreCreatedCorrectly() {
   SCDataStore store = sc.getDataService().getStoreById(WHITEHORSE_GPKG_ID);
   Map<String, SCGpkgTileSource> tileSources =
       ((GeoPackageAdapter) store.getAdapter()).getTileSources();
   assertEquals("The Whitehorse gpkg should have 1 tile source.", 1, tileSources.size());
   SCGpkgTileSource whiteHorseTileSource = tileSources.get("WhiteHorse");
   assertEquals(
       "The Whitehorse gpkg should have 1 tile source named WhiteHorse.",
       "WhiteHorse",
       whiteHorseTileSource.getTableName());
   assertEquals(
       "The min zoom level of the WhiteHorse tile source should be 12.",
       12,
       (int) whiteHorseTileSource.getMinZoom());
   assertEquals(
       "The max zoom level of the WhiteHorse tile source should be 12.",
       12,
       (int) whiteHorseTileSource.getMaxZoom());
   assertEquals(
       "The srs id of the WhiteHorse tile source should be 3857.",
       3857,
       (int) whiteHorseTileSource.getSrsId());
   assertEquals(
       "The matrix of the WhiteHorse tile source should have 8 rows.",
       8,
       whiteHorseTileSource.getMatrix().size());
 }
 private static void waitForStoreToStart(final String storeId) {
   TestSubscriber testSubscriber = new TestSubscriber();
   sc.getDataService()
       .storeStarted(storeId)
       .timeout(3, TimeUnit.MINUTES)
       .subscribe(testSubscriber);
   testSubscriber.awaitTerminalEvent();
   testSubscriber.assertNoErrors();
   testSubscriber.assertCompleted();
 }