1 package xdoclet.modules.ojb.tests; 2 3 17 18 23 public class ClassTagSimpleTests extends OjbTestBase 24 { 25 public ClassTagSimpleTests(String name) 26 { 27 super(name); 28 } 29 30 public void testSimple1() 32 { 33 addClass( 34 "test.A", 35 "package test;\n"+ 36 "/** @ojb.class */\n"+ 37 "public class A {}\n"); 38 39 assertEqualsOjbDescriptorFile( 40 "<class-descriptor\n"+ 41 " class=\"test.A\"\n"+ 42 " table=\"A\"\n"+ 43 ">\n"+ 44 "</class-descriptor>", 45 runOjbXDoclet(OJB_DEST_FILE)); 46 assertEqualsTorqueSchemaFile( 47 "<database name=\"ojbtest\">\n"+ 48 " <table name=\"A\">\n"+ 49 " </table>\n"+ 50 "</database>", 51 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 52 } 53 54 public void testSimple2() 56 { 57 addClass( 58 "test.A", 59 "package test;\n"+ 60 "/** @ojb.class */\n"+ 61 "public class A {}\n"); 62 addClass( 63 "test.B", 64 "package test;\n"+ 65 "/** @ojb.class */\n"+ 66 "public class B extends A {}\n"); 67 68 assertEqualsOjbDescriptorFile( 69 "<class-descriptor\n"+ 70 " class=\"test.A\"\n"+ 71 " table=\"A\"\n"+ 72 ">\n"+ 73 " <extent-class class-ref=\"test.B\"/>\n"+ 74 "</class-descriptor>\n"+ 75 "<class-descriptor\n"+ 76 " class=\"test.B\"\n"+ 77 " table=\"B\"\n"+ 78 ">\n"+ 79 "</class-descriptor>", 80 runOjbXDoclet(OJB_DEST_FILE)); 81 assertEqualsTorqueSchemaFile( 82 "<database name=\"ojbtest\">\n"+ 83 " <table name=\"A\">\n"+ 84 " </table>\n"+ 85 " <table name=\"B\">\n"+ 86 " </table>\n"+ 87 "</database>", 88 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 89 } 90 91 public void testSimple3() 93 { 94 addClass( 95 "test.A", 96 "package test;\n"+ 97 "/** @ojb.class */\n"+ 98 "public class A {}\n"); 99 addClass( 100 "test.B", 101 "package test;\n"+ 102 "public class B extends A {}\n"); 103 addClass( 104 "test.C", 105 "package test;\n"+ 106 "/** @ojb.class */\n"+ 107 "public class C extends B {}\n"); 108 addClass( 109 "test.D", 110 "package test;\n"+ 111 "public class D extends C {}\n"); 112 addClass( 113 "test.E", 114 "package test;\n"+ 115 "/** @ojb.class */\n"+ 116 "public class E extends D {}\n"); 117 118 assertEqualsOjbDescriptorFile( 119 "<class-descriptor\n"+ 120 " class=\"test.A\"\n"+ 121 " table=\"A\"\n"+ 122 ">\n"+ 123 " <extent-class class-ref=\"test.C\"/>\n"+ 124 "</class-descriptor>\n"+ 125 "<class-descriptor\n"+ 126 " class=\"test.C\"\n"+ 127 " table=\"C\"\n"+ 128 ">\n"+ 129 " <extent-class class-ref=\"test.E\"/>\n"+ 130 "</class-descriptor>\n"+ 131 "<class-descriptor\n"+ 132 " class=\"test.E\"\n"+ 133 " table=\"E\"\n"+ 134 ">\n"+ 135 "</class-descriptor>", 136 runOjbXDoclet(OJB_DEST_FILE)); 137 assertEqualsTorqueSchemaFile( 138 "<database name=\"ojbtest\">\n"+ 139 " <table name=\"A\">\n"+ 140 " </table>\n"+ 141 " <table name=\"C\">\n"+ 142 " </table>\n"+ 143 " <table name=\"E\">\n"+ 144 " </table>\n"+ 145 "</database>", 146 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 147 } 148 149 public void testSimple4() 151 { 152 addClass( 153 "test.A", 154 "package test;\n"+ 155 "/** @ojb.class */\n"+ 156 "public class A {}\n"); 157 addClass( 158 "test.B", 159 "package test;\n"+ 160 "public class B {\n"+ 161 " /** @ojb.class */\n"+ 162 " public static class Nested extends A {}\n"+ 163 "}\n"); 164 addClass( 165 "test.C", 166 "package test;\n"+ 167 "/** @ojb.class */\n"+ 168 "public class C extends test.B.Nested {}\n"); 169 170 assertEqualsOjbDescriptorFile( 171 "<class-descriptor\n"+ 172 " class=\"test.A\"\n"+ 173 " table=\"A\"\n"+ 174 ">\n"+ 175 " <extent-class class-ref=\"test.B$Nested\"/>\n"+ 176 "</class-descriptor>\n"+ 177 "<class-descriptor\n"+ 178 " class=\"test.B$Nested\"\n"+ 179 " table=\"Nested\"\n"+ 180 ">\n"+ 181 " <extent-class class-ref=\"test.C\"/>\n"+ 182 "</class-descriptor>\n"+ 183 "<class-descriptor\n"+ 184 " class=\"test.C\"\n"+ 185 " table=\"C\"\n"+ 186 ">\n"+ 187 "</class-descriptor>", 188 runOjbXDoclet(OJB_DEST_FILE)); 189 assertEqualsTorqueSchemaFile( 190 "<database name=\"ojbtest\">\n"+ 191 " <table name=\"A\">\n"+ 192 " </table>\n"+ 193 " <table name=\"C\">\n"+ 194 " </table>\n"+ 195 " <table name=\"Nested\">\n"+ 196 " </table>\n"+ 197 "</database>", 198 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 199 } 200 } 201 | Popular Tags |