svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.h2spatial / org.gvsig.h2spatial.h2gis130 / org.gvsig.h2spatial.h2gis130.provider / src / test / java / org / gvsig / fmap / dal / store / h2 / operations / sql / TestCalculateEnvelope.java @ 45647
History | View | Annotate | Download (2.2 KB)
1 | 45472 | jjdelcerro | package org.gvsig.fmap.dal.store.h2.operations.sql; |
---|---|---|---|
2 | |||
3 | import java.util.List; |
||
4 | import junit.framework.TestCase; |
||
5 | import org.gvsig.fmap.dal.feature.FeatureStore; |
||
6 | import org.gvsig.fmap.dal.feature.FeatureType; |
||
7 | import org.gvsig.fmap.dal.store.h2.TestUtils; |
||
8 | import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
||
9 | import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory; |
||
10 | import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference; |
||
11 | import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
||
12 | import org.gvsig.fmap.dal.store.jdbc2.spi.operations.CalculateEnvelopeOfColumnOperation; |
||
13 | import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
||
14 | import org.slf4j.Logger; |
||
15 | import org.slf4j.LoggerFactory; |
||
16 | |||
17 | public class TestCalculateEnvelope extends TestCase { |
||
18 | |||
19 | private static final Logger LOGGER = LoggerFactory.getLogger(TestCalculateEnvelope.class); |
||
20 | |||
21 | public TestCalculateEnvelope(String testName) { |
||
22 | super(testName);
|
||
23 | } |
||
24 | |||
25 | @Override
|
||
26 | protected void setUp() throws Exception { |
||
27 | super.setUp();
|
||
28 | new DefaultLibrariesInitializer().fullInitialize();
|
||
29 | } |
||
30 | |||
31 | @Override
|
||
32 | protected void tearDown() throws Exception { |
||
33 | super.tearDown();
|
||
34 | } |
||
35 | |||
36 | // TODO add test methods here. The name must begin with 'test'. For example:
|
||
37 | // public void testHello() {}
|
||
38 | |||
39 | public void testCalculateEnvelope() throws Exception { |
||
40 | JDBCHelper helper = TestUtils.getJDBCHelper(); |
||
41 | JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
||
42 | OperationsFactory operations = helper.getOperations(); |
||
43 | |||
44 | List<String> expectedSQLs = TestUtils.getSQLs("calculateEnvelope.sql"); |
||
45 | |||
46 | FeatureStore sourceStore = TestUtils.openSourceStore1(); |
||
47 | |||
48 | TableReference table = operations.createTableReference( |
||
49 | "dbtest",
|
||
50 | sqlbuilder.default_schema(), |
||
51 | "test",
|
||
52 | null
|
||
53 | ); |
||
54 | FeatureType featureType = sourceStore.getDefaultFeatureType(); |
||
55 | CalculateEnvelopeOfColumnOperation calculateEnvelope = operations.createCalculateEnvelopeOfColumn( |
||
56 | featureType, |
||
57 | table, |
||
58 | "Geometry",
|
||
59 | null,
|
||
60 | null,
|
||
61 | featureType.getDefaultSRS() |
||
62 | ); |
||
63 | |||
64 | String sql = calculateEnvelope.getSQL();
|
||
65 | assertEquals("CalculateEnvelope SQL", expectedSQLs.get(0), sql); |
||
66 | } |
||
67 | |||
68 | } |