01: package org.geotools.data.ogr;
02:
03: import java.io.IOException;
04: import java.net.URI;
05: import java.util.HashMap;
06: import java.util.Map;
07:
08: import org.geotools.data.DataStore;
09: import org.geotools.data.DataStoreFinder;
10:
11: public class OGRDataStoreFactoryTest extends TestCaseSupport {
12:
13: public OGRDataStoreFactoryTest(String name) throws IOException {
14: super (name);
15: }
16:
17: public void testLookup() throws Exception {
18: Map map = new HashMap();
19: map.put(OGRDataStoreFactory.OGR_NAME.key,
20: getAbsolutePath(STATE_POP));
21: DataStore ds = DataStoreFinder.getDataStore(map);
22: assertNotNull(ds);
23: assertTrue(ds instanceof OGRDataStore);
24: }
25:
26: public void testNamespace() throws Exception {
27: OGRDataStoreFactory factory = new OGRDataStoreFactory();
28: Map map = new HashMap();
29: URI namespace = new URI("http://jesse.com");
30: map.put(OGRDataStoreFactory.NAMESPACEP.key, namespace);
31: map.put(OGRDataStoreFactory.OGR_NAME.key,
32: getAbsolutePath(STATE_POP));
33: DataStore store = factory.createDataStore(map);
34: assertEquals(namespace, store.getSchema(
35: STATE_POP.substring(STATE_POP.lastIndexOf('/') + 1,
36: STATE_POP.lastIndexOf('.'))).getNamespace());
37: }
38:
39: }
|