1 package xdoclet.sdk.xgg;
2
3 import java.io.File;
4 import java.util.Iterator;
5
6 import xdoclet.XDocletTestCase;
7 import xdoclet.sdk.xgg.binding.Binder;
8 import xdoclet.sdk.xgg.binding.Element;
9 import xdoclet.util.FileUtils;
10
11 /***
12 *
13 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a>
14 * @version $Revision: 1.7 $
15 */
16 public class XGGPluginTest extends XDocletTestCase {
17
18 public void testDtd() throws Exception {
19
20 XGGPlugin xgg = (XGGPlugin) getXDoclet().createPlugin("xgg");
21
22 Binder person1 = xgg.createBinder();
23 person1.setConstraints(new File( FileUtils.getRoot(getClass()).getParentFile().getParentFile(),"src/testdata/xgg/dtd/person-1.0.dtd" ));
24
25 Binder person2 = xgg.createBinder();
26 person2.setConstraints(new File(FileUtils.getRoot(getClass()).getParentFile().getParentFile(),"src/testdata/xgg/dtd/person-2.0.dtd"));
27
28 xgg.setPackageName("xdoclet.sdk.xgg.test.person");
29 xgg.setDestinationDir(new File( FileUtils.getRoot(getClass()).getParentFile(),"xgg/dtd" ));
30
31 getXDoclet().execute();
32 }
33
34 public void testFullDtd() throws Exception {
35
36 XGGPlugin xgg = (XGGPlugin) getXDoclet().createPlugin("xgg");
37
38 Binder binder = xgg.createBinder();
39 binder.setConstraints(new File( FileUtils.getRoot(getClass()).getParentFile().getParentFile(),"src/testdata/xgg/dtd/w3cschools.dtd" ));
40
41 xgg.setPackageName("xdoclet.sdk.xgg.test.w3cschools");
42 xgg.setDestinationDir(new File( FileUtils.getRoot(getClass()).getParentFile(),"xgg/dtd" ));
43
44 getXDoclet().execute();
45 }
46
47 public void testXsd() throws Exception {
48 XGGPlugin xgg = (XGGPlugin) getXDoclet().createPlugin("xgg");
49
50 Binder shiporder = xgg.createBinder();
51 shiporder.setConstraints( new File( FileUtils.getRoot(getClass()).getParentFile().getParentFile(),"src/testdata/xgg/xsd/shiporder.xsd" ) );
52
53 xgg.setPackageName("xdoclet.sdk.xgg.test.shiporder");
54 xgg.setDestinationDir( new File( FileUtils.getRoot(getClass()).getParentFile(),"xgg/xsd" ) );
55
56 // Assert that the collection is not null
57 assertEquals( 12, shiporder.getElements().size() );
58
59 // Assert that the collection contains elements of type Element
60 for (Iterator elements = shiporder.getElements().iterator(); elements.hasNext();) {
61 Object element = elements.next();
62 assertTrue(element instanceof Element);
63 }
64
65 getXDoclet().execute();
66 }
67
68 public void testFullXsd() throws Exception {
69
70 XGGPlugin xgg = (XGGPlugin) getXDoclet().createPlugin("xgg");
71
72 Binder binder = xgg.createBinder();
73 binder.setConstraints(new File( FileUtils.getRoot(getClass()).getParentFile().getParentFile(),"src/testdata/xgg/xsd/w3cschools.xsd" ));
74
75 xgg.setPackageName("xdoclet.sdk.xgg.test.w3cschools");
76 xgg.setDestinationDir(new File( FileUtils.getRoot(getClass()).getParentFile(),"xgg/xsd" ));
77
78 getXDoclet().execute();
79 }
80 }
This page was automatically generated by Maven