Mercurial > dive4elements > gnv-client
comparison geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java @ 885:1c3efbd2fc5a
Removes trailing whitespace.
geo-backend/trunk@850 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 07:49:16 +0000 |
parents | 31595c0a1a33 |
children | 8b442223741c |
comparison
equal
deleted
inserted
replaced
884:12f88239fb33 | 885:1c3efbd2fc5a |
---|---|
23 * TestCase for the QueryExecutor interface | 23 * TestCase for the QueryExecutor interface |
24 * @author Tim Englich <tim.englich@intevation.de> | 24 * @author Tim Englich <tim.englich@intevation.de> |
25 * | 25 * |
26 */ | 26 */ |
27 public class QueryExecutorTestCase extends TestCase { | 27 public class QueryExecutorTestCase extends TestCase { |
28 | 28 |
29 | 29 |
30 /** | 30 /** |
31 * the logger, used to log exceptions and additonaly information | 31 * the logger, used to log exceptions and additonaly information |
32 */ | 32 */ |
33 private static Logger log = null; | 33 private static Logger log = null; |
34 | 34 |
35 static{ | 35 static{ |
36 BasicConfigurator.configure(); | 36 BasicConfigurator.configure(); |
37 log = Logger.getLogger(QueryExecutorTestCase.class); | 37 log = Logger.getLogger(QueryExecutorTestCase.class); |
38 } | 38 } |
39 | 39 |
40 /** | 40 /** |
41 * Constructor | 41 * Constructor |
42 * @param name | 42 * @param name |
43 */ | 43 */ |
44 public QueryExecutorTestCase(String name) { | 44 public QueryExecutorTestCase(String name) { |
45 super(name); | 45 super(name); |
46 } | 46 } |
47 | 47 |
48 | 48 |
49 public void testSpatialQuery(){ | 49 public void testSpatialQuery(){ |
50 try { | 50 try { |
51 | 51 |
52 this.testQuery(5, "spatial_query", null); | 52 this.testQuery(5, "spatial_query", null); |
53 } catch (QueryException e) { | 53 } catch (QueryException e) { |
54 log.error(e,e); | 54 log.error(e,e); |
55 fail(); | 55 fail(); |
56 } | 56 } |
57 } | 57 } |
58 | 58 |
59 public void testSpatialQueryWithoutIntersects(){ | 59 public void testSpatialQueryWithoutIntersects(){ |
60 try { | 60 try { |
61 // this.testQuery(286, "spatial_query_without_intersects", null); | 61 // this.testQuery(286, "spatial_query_without_intersects", null); |
62 this.testQuery(0, "spatial_query_without_intersects2", null); | 62 this.testQuery(0, "spatial_query_without_intersects2", null); |
63 this.testQuery(2060, "spatial_query_without_intersects3", null); | 63 this.testQuery(2060, "spatial_query_without_intersects3", null); |
67 } catch (QueryException e) { | 67 } catch (QueryException e) { |
68 log.error(e,e); | 68 log.error(e,e); |
69 fail(); | 69 fail(); |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 public void testSpatialQueryWithInnerSelect(){ | 73 public void testSpatialQueryWithInnerSelect(){ |
74 try { | 74 try { |
75 this.testQuery(1998, "spatial_query_with_innerselect", null); | 75 this.testQuery(1998, "spatial_query_with_innerselect", null); |
76 } catch (QueryException e) { | 76 } catch (QueryException e) { |
77 log.error(e,e); | 77 log.error(e,e); |
78 fail(); | 78 fail(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 | 82 |
83 public void testChooseFis(){ | 83 public void testChooseFis(){ |
84 try { | 84 try { |
85 this.testQuery(1, "choose_fis_query", null); | 85 this.testQuery(1, "choose_fis_query", null); |
86 } catch (QueryException e) { | 86 } catch (QueryException e) { |
87 log.error(e, e); | 87 log.error(e, e); |
88 fail(); | 88 fail(); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 /** | 93 /** |
94 * Tests if the Databaseconnection can be established and | 94 * Tests if the Databaseconnection can be established and |
95 * Data could be read from the Database | 95 * Data could be read from the Database |
96 */ | 96 */ |
97 public void testQueryExecutor(){ | 97 public void testQueryExecutor(){ |
98 | 98 |
99 try { | 99 try { |
100 | 100 |
101 this.testQuery(6, "mesh", null); | 101 this.testQuery(6, "mesh", null); |
102 | 102 |
103 this.testQuery(1, "mesh_id", new String[]{"5"}); | 103 this.testQuery(1, "mesh_id", new String[]{"5"}); |
104 | 104 |
105 | 105 |
106 | 106 |
107 } catch (QueryException e) { | 107 } catch (QueryException e) { |
108 log.error(e,e); | 108 log.error(e,e); |
109 fail(); | 109 fail(); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 public void testTimeSeriesQueries(){ | 113 public void testTimeSeriesQueries(){ |
114 | 114 |
115 try{ | 115 try{ |
116 // Test zum initialisieren der umgebung | 116 // Test zum initialisieren der umgebung |
117 this.testQuery(6, "mesh", null); | 117 this.testQuery(6, "mesh", null); |
118 | 118 |
119 | 119 |
120 this.testQuery(11, "timeseries_stations", new String[]{"4"}); | 120 this.testQuery(11, "timeseries_stations", new String[]{"4"}); |
121 this.testQuery(11, "timeseries_stations_op", new String[]{"4"}); | 121 this.testQuery(11, "timeseries_stations_op", new String[]{"4"}); |
122 this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"}); | 122 this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"}); |
123 | 123 |
124 } catch (QueryException e) { | 124 } catch (QueryException e) { |
125 log.error(e,e); | 125 log.error(e,e); |
126 fail(); | 126 fail(); |
127 } | 127 } |
128 | 128 |
129 } | 129 } |
130 | 130 |
131 /** | 131 /** |
132 * @param resultsize | 132 * @param resultsize |
133 * @param queryID | 133 * @param queryID |
157 } | 157 } |
158 } | 158 } |
159 // } | 159 // } |
160 log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms"); | 160 log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms"); |
161 } | 161 } |
162 | 162 |
163 | 163 |
164 | 164 |
165 /** | 165 /** |
166 * @see junit.framework.TestCase#setUp() | 166 * @see junit.framework.TestCase#setUp() |
167 */ | 167 */ |
168 @Override | 168 @Override |
169 protected void setUp() throws Exception { | 169 protected void setUp() throws Exception { |
170 | 170 |
171 super.setUp(); | 171 super.setUp(); |
172 InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); | 172 InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); |
173 Properties properties = new Properties(); | 173 Properties properties = new Properties(); |
174 properties.load(inputStream); | 174 properties.load(inputStream); |
175 | 175 |
176 ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); | 176 ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); |
177 cpf.initializeConnectionPool(properties); | 177 cpf.initializeConnectionPool(properties); |
178 | 178 |
179 | 179 |
180 inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); | 180 inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties"); |
181 properties = new Properties(); | 181 properties = new Properties(); |
182 properties.load(inputStream); | 182 properties.load(inputStream); |
183 | 183 |
184 QueryContainerFactory qcf = QueryContainerFactory.getInstance(); | 184 QueryContainerFactory qcf = QueryContainerFactory.getInstance(); |
185 qcf.initializeQueryContainer(properties); | 185 qcf.initializeQueryContainer(properties); |
186 } | 186 } |
187 | 187 |
188 } | 188 } |