@Test public void testRegisterAndRemove() throws Exception { File file = getTempFile(".shp"); sm.register(SOURCE, file); sm.remove(SOURCE); FileDriverRegister fdr = sm.getDriverManager().getFileDriverRegister(); assertFalse(fdr.contains(file)); }
@Test public void testRemove() throws Exception { File shape = super.getAnySpatialResource(); FileDriver d = new ShapefileDriver(); FileDriverRegister fdr = new FileDriverRegister(); fdr.addFile(shape, d); fdr.removeFile(shape); assertFalse(fdr.contains(shape)); }
@Test public void testAddNull() { // Our source is a single, simple, ShapeFile File shape = super.getAnySpatialResource(); FileDriverRegister fdr = new FileDriverRegister(); try { fdr.addFile(shape, null); assertTrue(false); } catch (DriverLoadException e) { assertTrue(true); } }
@Test public void testAddTwice() throws Exception { File shape = super.getAnySpatialResource(); FileDriver d = new ShapefileDriver(); FileDriverRegister fdr = new FileDriverRegister(); fdr.addFile(shape, d); assertTrue(fdr.contains(shape)); assertTrue(fdr.getDriver(shape) == d); FileDriver d2 = new ShapefileDriver(); fdr.addFile(shape, d2); assertTrue(fdr.contains(shape)); assertTrue(fdr.getDriver(shape) == d2); assertFalse(fdr.getDriver(shape) == d); }