1
15
16 package gate.sgml;
17
18 import java.util.Map;
19
20 import junit.framework.*;
21
22 import gate.*;
23
24
26 public class TestSgml extends TestCase
27 {
28
29 private static final boolean DEBUG = false;
30
31
32 public TestSgml(String name) { super(name); }
33
34
35 public void setUp() {
36 }
38 public void testSgmlLoading() throws Exception {
39 assertTrue(true);
40
41 Map markupElementsMap = null;
43 gate.Document doc = null;
44
52
53 FeatureMap params = Factory.newFeatureMap();
54 params.put(Document.DOCUMENT_URL_PARAMETER_NAME, Gate.getUrl("tests/sgml/Hds.sgm"));
55 params.put(Document.DOCUMENT_MARKUP_AWARE_PARAMETER_NAME, "false");
56 doc = (Document)Factory.createResource("gate.corpora.DocumentImpl",
57 params);
58
59 gate.DocumentFormat docFormat = gate.DocumentFormat.getDocumentFormat (
63 doc, doc.getSourceUrl()
64 );
65 assertTrue( "Bad document Format was produced. SgmlDocumentFormat was expected",
66 docFormat instanceof gate.corpora.SgmlDocumentFormat
67 );
68
69 docFormat.setMarkupElementsMap(markupElementsMap);
71 docFormat.unpackMarkup (doc,"DocumentContent");
72 AnnotationSet annotSet = doc.getAnnotations(
73 GateConstants.ORIGINAL_MARKUPS_ANNOT_SET_NAME);
74 assertEquals("For "+doc.getSourceUrl()+" the number of annotations"+
75 " should be:1022",1022,annotSet.size());
76 gate.corpora.TestDocument.verifyNodeIdConsistency(doc);
78 }
80
81 public static Test suite() {
82 return new TestSuite(TestSgml.class);
83 }
85 }