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.mdb / src / test / java / org / gvsig / fmap / dal / store / mdb / operations / sql / TestDropTable.java @ 47779
History | View | Annotate | Download (2.01 KB)
1 |
package org.gvsig.fmap.dal.store.mdb.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.store.mdb.TestUtils; |
7 |
import org.gvsig.fmap.dal.store.jdbc2.JDBCHelper; |
8 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory; |
9 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference; |
10 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
11 |
import org.gvsig.fmap.dal.store.jdbc2.spi.operations.DropTableOperation; |
12 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
13 |
import org.slf4j.Logger; |
14 |
import org.slf4j.LoggerFactory; |
15 |
|
16 |
public class TestDropTable extends TestCase { |
17 |
|
18 |
private static final Logger LOGGER = LoggerFactory.getLogger(TestDropTable.class); |
19 |
|
20 |
public TestDropTable(String testName) { |
21 |
super(testName);
|
22 |
} |
23 |
|
24 |
@Override
|
25 |
protected void setUp() throws Exception { |
26 |
super.setUp();
|
27 |
new DefaultLibrariesInitializer().fullInitialize();
|
28 |
} |
29 |
|
30 |
@Override
|
31 |
protected void tearDown() throws Exception { |
32 |
super.tearDown();
|
33 |
} |
34 |
|
35 |
// TODO add test methods here. The name must begin with 'test'. For example:
|
36 |
// public void testHello() {}
|
37 |
|
38 |
public void testDropTable() throws Exception { |
39 |
JDBCHelper helper = TestUtils.getJDBCHelper(); |
40 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
41 |
OperationsFactory operations = helper.getOperations(); |
42 |
|
43 |
List<String> expectedSQLs = TestUtils.getSQLs("dropTable.sql"); |
44 |
|
45 |
FeatureStore sourceStore = TestUtils.openSourceStore1(); |
46 |
|
47 |
TableReference table = operations.createTableReference( |
48 |
"dbtest",
|
49 |
sqlbuilder.default_schema(), |
50 |
"test",
|
51 |
null
|
52 |
); |
53 |
DropTableOperation dropTable = operations.createDropTable( |
54 |
table |
55 |
); |
56 |
List<String> SQLs = dropTable.getSQLs(); |
57 |
assertEquals("DropTable num. SQLs", expectedSQLs.size(), SQLs.size());
|
58 |
for (int i = 0; i < expectedSQLs.size(); i++) { |
59 |
assertEquals("DropTable SQL "+i, expectedSQLs.get(i), SQLs.get(i));
|
60 |
} |
61 |
} |
62 |
|
63 |
} |