svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.plugin / org.gvsig.xml2db / org.gvsig.xml2db.lib / org.gvsig.xml2db.lib.impl / src / test / java / org / gvsig / xml2db / lib / impl / TestCreateDatabase.java @ 47472
History | View | Annotate | Download (1.84 KB)
1 |
package org.gvsig.xml2db.lib.impl; |
---|---|
2 |
|
3 |
import java.io.File; |
4 |
import java.io.InputStream; |
5 |
import java.util.Locale; |
6 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
7 |
import org.gvsig.xml2db.lib.api.Xml2dbManager; |
8 |
import org.gvsig.xml2db.lib.api.xmlinfo.XMLInfo; |
9 |
|
10 |
|
11 |
public class TestCreateDatabase extends AbstractLibraryAutoInitTestCase { |
12 |
|
13 |
private TestUtilsXml2db utils;
|
14 |
|
15 |
public TestCreateDatabase(String testName) { |
16 |
super(testName);
|
17 |
} |
18 |
|
19 |
@Override
|
20 |
protected void doSetUp() throws Exception { |
21 |
|
22 |
} |
23 |
|
24 |
public TestUtilsXml2db utils() {
|
25 |
if( this.utils == null ) { |
26 |
this.utils = new TestUtilsXml2db(); |
27 |
} |
28 |
return this.utils; |
29 |
} |
30 |
|
31 |
public void testCreateDBDeclaracion() throws Exception { |
32 |
Xml2dbManager manager = new DefaultXml2dbManager();
|
33 |
|
34 |
InputStream xml = this.getClass().getResourceAsStream("Declaracion4.xml"); |
35 |
XMLInfo xmlinfo = manager.extractStructure(xml, null, null, Locale.getDefault(), null, null); |
36 |
|
37 |
File dbfile = utils().getFile(new File("databases/declaracion4")); |
38 |
manager.createDatabase(dbfile, xmlinfo, null);
|
39 |
} |
40 |
|
41 |
public void testExtractorR10graf() throws Exception { |
42 |
testExtractorR10graf(null);
|
43 |
} |
44 |
|
45 |
public void testExtractorR10grafWithTablesPrefix() throws Exception { |
46 |
testExtractorR10graf("R10G_");
|
47 |
} |
48 |
|
49 |
public void testExtractorR10graf(String tablesPrefix) throws Exception { |
50 |
Xml2dbManager manager = new DefaultXml2dbManager();
|
51 |
|
52 |
InputStream xml = this.getClass().getResourceAsStream("r10graf.xml"); |
53 |
XMLInfo xmlinfo = manager.extractStructure(xml, null, null, Locale.getDefault(), tablesPrefix, null); |
54 |
|
55 |
File dbfile = utils().getFile(new File("databases/r10graf")); |
56 |
manager.createDatabase(dbfile, xmlinfo, null);
|
57 |
} |
58 |
|
59 |
} |