01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.brewer.color;
17:
18: import java.io.IOException;
19: import java.util.PropertyResourceBundle;
20:
21: /**
22: * Convenience class for postgis testing.
23: *
24: * @author Justin Deoliveira, The Open Planning Project
25: *
26: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/brewer/src/test/java/org/geotools/brewer/color/PostgisTests.java $
27: */
28: public class PostgisTests {
29: public static Fixture newFixture(String props) throws IOException {
30: PropertyResourceBundle resource;
31: resource = new PropertyResourceBundle(PostgisTests.class
32: .getResourceAsStream(props));
33:
34: Fixture f = new Fixture();
35:
36: f.namespace = resource.getString("namespace");
37: f.host = resource.getString("host");
38: f.port = Integer.valueOf(resource.getString("port"));
39: f.database = resource.getString("database");
40: f.user = resource.getString("user");
41: f.password = resource.getString("password");
42: f.schema = resource.getString("schema");
43:
44: if ((f.schema == null) || "".equals(f.schema.trim())) {
45: f.schema = "public";
46: }
47:
48: return f;
49: }
50:
51: public static Fixture newFixture() throws IOException {
52: return newFixture("fixture.properties");
53: }
54:
55: public static class Fixture {
56: public String namespace;
57: public String host;
58: public String database;
59: public Integer port;
60: public String user;
61: public String password;
62: public String schema;
63: }
64: }
|