svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.h2 / src / test / java / org / gvsig / fmap / dal / store / h2 / operations / sql / TestDropTable.java @ 44678
History | View | Annotate | Download (2.05 KB)
1 | 44678 | jjdelcerro | package org.gvsig.fmap.dal.store.h2.operations.sql; |
---|---|---|---|
2 | 43512 | jjdelcerro | |
3 | 44669 | jjdelcerro | import java.util.List; |
4 | 43512 | jjdelcerro | import junit.framework.TestCase; |
5 | 44669 | jjdelcerro | import org.gvsig.fmap.dal.feature.FeatureStore; |
6 | 44678 | jjdelcerro | import org.gvsig.fmap.dal.store.h2.H2SpatialHelper; |
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.DropTableOperation; |
||
13 | 44098 | jjdelcerro | import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
14 | 44669 | jjdelcerro | import org.slf4j.Logger; |
15 | import org.slf4j.LoggerFactory; |
||
16 | 43512 | jjdelcerro | |
17 | 44678 | jjdelcerro | public class TestDropTable extends TestCase { |
18 | 43512 | jjdelcerro | |
19 | 44678 | jjdelcerro | private static final Logger LOGGER = LoggerFactory.getLogger(TestDropTable.class); |
20 | 44139 | jjdelcerro | |
21 | 44678 | jjdelcerro | public TestDropTable(String testName) { |
22 | super(testName);
|
||
23 | } |
||
24 | 44421 | jjdelcerro | |
25 | 44678 | jjdelcerro | @Override
|
26 | protected void setUp() throws Exception { |
||
27 | super.setUp();
|
||
28 | new DefaultLibrariesInitializer().fullInitialize();
|
||
29 | } |
||
30 | 44139 | jjdelcerro | |
31 | 44678 | jjdelcerro | @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 testDropTable() throws Exception { |
||
40 | JDBCHelper helper = new H2SpatialHelper();
|
||
41 | JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
||
42 | OperationsFactory operations = helper.getOperations(); |
||
43 | |||
44 | List<String> expectedSQLs = TestUtils.getSQLs("dropTable.sql"); |
||
45 | 43512 | jjdelcerro | |
46 | 44678 | jjdelcerro | FeatureStore sourceStore = TestUtils.openSourceStore1(); |
47 | 44139 | jjdelcerro | |
48 | 44678 | jjdelcerro | TableReference table = operations.createTableReference( |
49 | "dbtest",
|
||
50 | sqlbuilder.default_schema(), |
||
51 | "test",
|
||
52 | null
|
||
53 | ); |
||
54 | DropTableOperation dropTable = operations.createDropTable( |
||
55 | table |
||
56 | ); |
||
57 | List<String> SQLs = dropTable.getSQLs(); |
||
58 | assertEquals("DropTable num. SQLs", expectedSQLs.size(), SQLs.size());
|
||
59 | for (int i = 0; i < expectedSQLs.size(); i++) { |
||
60 | assertEquals("DropTable SQL "+i, expectedSQLs.get(i), SQLs.get(i));
|
||
61 | 43512 | jjdelcerro | } |
62 | 44678 | jjdelcerro | } |
63 | |||
64 | 43939 | jjdelcerro | } |