01: package org.geotools.data.oracle.referencing;
02:
03: import java.sql.Connection;
04: import java.util.PropertyResourceBundle;
05:
06: import javax.sql.DataSource;
07:
08: import junit.framework.TestCase;
09:
10: import org.geotools.data.oracle.OracleDataStoreFactory;
11: import org.opengis.referencing.crs.CoordinateReferenceSystem;
12:
13: public class OracleAuthorityFactoryTest extends TestCase {
14:
15: private DataSource pool;
16: private Connection conn;
17:
18: protected void setUp() throws Exception {
19: super .setUp();
20:
21: PropertyResourceBundle resource;
22: resource = new PropertyResourceBundle(this .getClass()
23: .getResourceAsStream(
24: "/org/geotools/data/oracle/fixture.properties"));
25:
26: String namespace = resource.getString("namespace");
27: String host = resource.getString("host");
28: int port = Integer.parseInt(resource.getString("port"));
29: String instance = resource.getString("instance");
30: String user = resource.getString("user");
31: String password = resource.getString("password");
32:
33: if (namespace.equals("http://www.geotools.org/data/postgis")) {
34: throw new IllegalStateException(
35: "The fixture.properties file needs to be configured for your own database");
36: }
37:
38: try {
39: pool = OracleDataStoreFactory.getDefaultDataSource(host,
40: user, password, port, instance, 10, 4, false);
41: conn = pool.getConnection();
42: } catch (Throwable t) {
43: t.printStackTrace();
44: System.out
45: .println("Could not load test fixture, configure "
46: + getClass().getResource(
47: "fixture.properties"));
48: t.printStackTrace();
49: return;
50: }
51:
52: }
53:
54: public void testSRIDLookup() throws Exception {
55: if (conn == null)
56: return;
57:
58: OracleAuthorityFactory af = new OracleAuthorityFactory(pool);
59: CoordinateReferenceSystem crs27700 = af.createCRS(27700);
60: assertNotNull(crs27700);
61:
62: CoordinateReferenceSystem crs81989 = af.createCRS(81989);
63: assertNotNull(crs81989);
64: }
65: }
|