1 package xdoclet.modules.ojb.tests; 2 3 17 18 23 public class ClassTagProxyAttributeTests extends OjbTestBase 24 { 25 public ClassTagProxyAttributeTests(String name) 26 { 27 super(name); 28 } 29 30 public void testProxy1() 32 { 33 addClass( 34 "test.A", 35 "package test;\n"+ 36 "/** @ojb.class proxy=\"\" */\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 testProxy2() 56 { 57 addClass( 58 "test.A", 59 "package test;\n"+ 60 "/** @ojb.class proxy=\"dynamic\" */\n"+ 61 "public class A {}\n"); 62 63 assertEqualsOjbDescriptorFile( 64 "<class-descriptor\n"+ 65 " class=\"test.A\"\n"+ 66 " proxy=\"dynamic\"\n"+ 67 " table=\"A\"\n"+ 68 ">\n"+ 69 "</class-descriptor>", 70 runOjbXDoclet(OJB_DEST_FILE)); 71 assertEqualsTorqueSchemaFile( 72 "<database name=\"ojbtest\">\n"+ 73 " <table name=\"A\">\n"+ 74 " </table>\n"+ 75 "</database>", 76 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 77 } 78 79 public void testProxy3() 82 { 83 addClass( 84 "test.A", 85 "package test;\n"+ 86 "/** @ojb.class proxy=\"SomeProxy\" */\n"+ 87 "public class A {}\n"); 88 89 assertEqualsOjbDescriptorFile( 90 "<class-descriptor\n"+ 91 " class=\"test.A\"\n"+ 92 " proxy=\"SomeProxy\"\n"+ 93 " table=\"A\"\n"+ 94 ">\n"+ 95 "</class-descriptor>", 96 runOjbXDoclet(OJB_DEST_FILE)); 97 assertEqualsTorqueSchemaFile( 98 "<database name=\"ojbtest\">\n"+ 99 " <table name=\"A\">\n"+ 100 " </table>\n"+ 101 "</database>", 102 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 103 } 104 105 public void testProxyPrefetchingLimit1() 107 { 108 addClass( 109 "test.A", 110 "package test;\n"+ 111 "/** @ojb.class proxy=\"dynamic\"\n" + 112 " * proxy-prefetching-limit=\"0\"\n"+ 113 " */\n"+ 114 "public class A {}\n"); 115 116 assertEqualsOjbDescriptorFile( 117 "<class-descriptor\n"+ 118 " class=\"test.A\"\n"+ 119 " proxy=\"dynamic\"\n"+ 120 " proxy-prefetching-limit=\"0\"\n"+ 121 " table=\"A\"\n"+ 122 ">\n"+ 123 "</class-descriptor>", 124 runOjbXDoclet(OJB_DEST_FILE)); 125 assertEqualsTorqueSchemaFile( 126 "<database name=\"ojbtest\">\n"+ 127 " <table name=\"A\">\n"+ 128 " </table>\n"+ 129 "</database>", 130 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 131 } 132 133 public void testProxyPrefetchingLimit2() 135 { 136 addClass( 137 "test.A", 138 "package test;\n"+ 139 "/** @ojb.class proxy=\"dynamic\"\n" + 140 " * proxy-prefetching-limit=\"10\"\n"+ 141 " */\n"+ 142 "public class A {}\n"); 143 144 assertEqualsOjbDescriptorFile( 145 "<class-descriptor\n"+ 146 " class=\"test.A\"\n"+ 147 " proxy=\"dynamic\"\n"+ 148 " proxy-prefetching-limit=\"10\"\n"+ 149 " table=\"A\"\n"+ 150 ">\n"+ 151 "</class-descriptor>", 152 runOjbXDoclet(OJB_DEST_FILE)); 153 assertEqualsTorqueSchemaFile( 154 "<database name=\"ojbtest\">\n"+ 155 " <table name=\"A\">\n"+ 156 " </table>\n"+ 157 "</database>", 158 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 159 } 160 161 public void testProxyPrefetchingLimit3() 163 { 164 addClass( 165 "test.A", 166 "package test;\n"+ 167 "/** @ojb.class proxy=\"dynamic\"\n" + 168 " * proxy-prefetching-limit=\"abc\"\n"+ 169 " */\n"+ 170 "public class A {}\n"); 171 172 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 173 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 174 } 175 176 public void testProxyPrefetchingLimit4() 178 { 179 addClass( 180 "test.A", 181 "package test;\n"+ 182 "/** @ojb.class proxy=\"dynamic\"\n" + 183 " * proxy-prefetching-limit=\"-2\"\n"+ 184 " */\n"+ 185 "public class A {}\n"); 186 187 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 188 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 189 } 190 } 191 | Popular Tags |