@Test public void testGetAlreadyRegisteredSourceAnonimously() throws Exception { sm.register("myfile", testFile); if (hsqlDbAvailable) { sm.register("myDB", testDB); } sm.register("myWMS", testWMS); sm.register("myObj", obj); DataSource ds = dsf.getDataSource(testFile); assertEquals(ds.getName(), "myfile"); if (hsqlDbAvailable) { ds = dsf.getDataSource(testDB); assertEquals(ds.getName(), "myDB"); } ds = dsf.getDataSource(testWMS); assertEquals(ds.getName(), "myWMS"); ds = dsf.getDataSource(obj, "main"); assertEquals(ds.getName(), "myObj"); sm.removeAll(); sm.register("myfile", super.getAnySpatialResource()); sm.register("mySQL", sql); ds = dsf.getDataSourceFromSQL(sql); assertEquals(ds.getName(), "mySQL"); }
@Test public void testDependingNotWellKnownSourcesRemoved() throws Exception { sm.register(SOURCE, testFile); DataSource ds = dsf.getDataSourceFromSQL("select * from " + SOURCE + ";"); assertEquals(ds.getReferencedSources().length, 1); String nwkn = ds.getName(); dsf.getSourceManager().remove(SOURCE); assertFalse(dsf.getSourceManager().exists(nwkn)); }