@Test public void testChangeNameOnExistingDataSources() throws Exception { sm.register("file", super.getAnyNonSpatialResource()); DataSource ds = dsf.getDataSourceFromSQL("select * from file;"); sm.rename(ds.getName(), "sql"); DataSource ds2 = dsf.getDataSource("sql"); assertEquals(ds.getName(), ds2.getName()); }
@Test public void testNameAndID() { Map<String, Object> raw = new HashMap<String, Object>(); raw.put("id", "abcdef"); raw.put("name", "MyDS"); DataSource dataSource = new DataSource(raw, mock(ApiClient.class)); assertEquals(dataSource.getId(), raw.get("id")); assertEquals(dataSource.getName(), raw.get("name")); }
@Test public void testRemoveDataSources() throws Exception { sm.register("temp", super.getAnyNonSpatialResource()); DataSource d = dsf.getDataSource("temp"); sm.remove(d.getName()); try { dsf.getDataSource("temp"); fail(); } catch (NoSuchTableException e) { } }
@Test public void testOperationDataSourceName() throws Throwable { sm.register("temp", super.getAnyNonSpatialResource()); DataSource d = dsf.getDataSourceFromSQL("select * from temp;"); assertNotNull(dsf.getDataSource(d.getName())); }