1 package xdoclet.modules.ojb.tests; 2 3 17 18 23 public class CollectionTagProxyAttributeTests extends OjbTestBase 24 { 25 public CollectionTagProxyAttributeTests(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 */\n"+ 37 "public class A {\n"+ 38 "/** @ojb.field primarykey=\"true\" */\n"+ 39 " private int id;\n"+ 40 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 41 " * foreignkey=\"aid\"\n"+ 42 " * proxy=\"\"\n"+ 43 " */\n"+ 44 " private java.util.List objs;\n"+ 45 "}\n"); 46 addClass( 47 "test.B", 48 "package test;\n"+ 49 "/** @ojb.class */\n"+ 50 "public class B {\n"+ 51 "/** @ojb.field */\n"+ 52 " private int aid;\n"+ 53 "}\n"); 54 55 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 56 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 57 } 58 59 public void testProxy2() 61 { 62 addClass( 63 "test.A", 64 "package test;\n"+ 65 "/** @ojb.class */\n"+ 66 "public class A {\n"+ 67 "/** @ojb.field primarykey=\"true\" */\n"+ 68 " private int id;\n"+ 69 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 70 " * foreignkey=\"aid\"\n"+ 71 " * proxy=\"no\"\n"+ 72 " */\n"+ 73 " private java.util.List objs;\n"+ 74 "}\n"); 75 addClass( 76 "test.B", 77 "package test;\n"+ 78 "/** @ojb.class */\n"+ 79 "public class B {\n"+ 80 "/** @ojb.field */\n"+ 81 " private int aid;\n"+ 82 "}\n"); 83 84 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 85 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 86 } 87 88 public void testProxy3() 90 { 91 addClass( 92 "test.A", 93 "package test;\n"+ 94 "/** @ojb.class */\n"+ 95 "public class A {\n"+ 96 "/** @ojb.field primarykey=\"true\" */\n"+ 97 " private int id;\n"+ 98 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 99 " * foreignkey=\"aid\"\n"+ 100 " * proxy=\"true\"\n"+ 101 " */\n"+ 102 " private java.util.List objs;\n"+ 103 "}\n"); 104 addClass( 105 "test.B", 106 "package test;\n"+ 107 "/** @ojb.class */\n"+ 108 "public class B {\n"+ 109 "/** @ojb.field */\n"+ 110 " private int aid;\n"+ 111 "}\n"); 112 113 assertEqualsOjbDescriptorFile( 114 "<class-descriptor\n"+ 115 " class=\"test.A\"\n"+ 116 " table=\"A\"\n"+ 117 ">\n"+ 118 " <field-descriptor\n"+ 119 " name=\"id\"\n"+ 120 " column=\"id\"\n"+ 121 " jdbc-type=\"INTEGER\"\n"+ 122 " primarykey=\"true\"\n"+ 123 " >\n"+ 124 " </field-descriptor>\n"+ 125 " <collection-descriptor\n"+ 126 " name=\"objs\"\n"+ 127 " element-class-ref=\"test.B\"\n"+ 128 " proxy=\"true\"\n"+ 129 " >\n"+ 130 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 131 " </collection-descriptor>\n"+ 132 "</class-descriptor>\n"+ 133 "<class-descriptor\n"+ 134 " class=\"test.B\"\n"+ 135 " table=\"B\"\n"+ 136 ">\n"+ 137 " <field-descriptor\n"+ 138 " name=\"aid\"\n"+ 139 " column=\"aid\"\n"+ 140 " jdbc-type=\"INTEGER\"\n"+ 141 " >\n"+ 142 " </field-descriptor>\n"+ 143 "</class-descriptor>", 144 runOjbXDoclet(OJB_DEST_FILE)); 145 assertEqualsTorqueSchemaFile( 146 "<database name=\"ojbtest\">\n"+ 147 " <table name=\"A\">\n"+ 148 " <column name=\"id\"\n"+ 149 " javaName=\"id\"\n"+ 150 " type=\"INTEGER\"\n"+ 151 " primaryKey=\"true\"\n"+ 152 " required=\"true\"\n"+ 153 " />\n"+ 154 " </table>\n"+ 155 " <table name=\"B\">\n"+ 156 " <column name=\"aid\"\n"+ 157 " javaName=\"aid\"\n"+ 158 " type=\"INTEGER\"\n"+ 159 " />\n"+ 160 " <foreign-key foreignTable=\"A\">\n"+ 161 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 162 " </foreign-key>\n"+ 163 " </table>\n"+ 164 "</database>", 165 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 166 } 167 168 public void testProxy4() 170 { 171 addClass( 172 "test.A", 173 "package test;\n"+ 174 "/** @ojb.class */\n"+ 175 "public class A {\n"+ 176 "/** @ojb.field primarykey=\"true\" */\n"+ 177 " private int id;\n"+ 178 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 179 " * foreignkey=\"aid\"\n"+ 180 " * proxy=\"false\"\n"+ 181 " */\n"+ 182 " private java.util.List objs;\n"+ 183 "}\n"); 184 addClass( 185 "test.B", 186 "package test;\n"+ 187 "/** @ojb.class */\n"+ 188 "public class B {\n"+ 189 "/** @ojb.field */\n"+ 190 " private int aid;\n"+ 191 "}\n"); 192 193 assertEqualsOjbDescriptorFile( 194 "<class-descriptor\n"+ 195 " class=\"test.A\"\n"+ 196 " table=\"A\"\n"+ 197 ">\n"+ 198 " <field-descriptor\n"+ 199 " name=\"id\"\n"+ 200 " column=\"id\"\n"+ 201 " jdbc-type=\"INTEGER\"\n"+ 202 " primarykey=\"true\"\n"+ 203 " >\n"+ 204 " </field-descriptor>\n"+ 205 " <collection-descriptor\n"+ 206 " name=\"objs\"\n"+ 207 " element-class-ref=\"test.B\"\n"+ 208 " proxy=\"false\"\n"+ 209 " >\n"+ 210 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 211 " </collection-descriptor>\n"+ 212 "</class-descriptor>\n"+ 213 "<class-descriptor\n"+ 214 " class=\"test.B\"\n"+ 215 " table=\"B\"\n"+ 216 ">\n"+ 217 " <field-descriptor\n"+ 218 " name=\"aid\"\n"+ 219 " column=\"aid\"\n"+ 220 " jdbc-type=\"INTEGER\"\n"+ 221 " >\n"+ 222 " </field-descriptor>\n"+ 223 "</class-descriptor>", 224 runOjbXDoclet(OJB_DEST_FILE)); 225 assertEqualsTorqueSchemaFile( 226 "<database name=\"ojbtest\">\n"+ 227 " <table name=\"A\">\n"+ 228 " <column name=\"id\"\n"+ 229 " javaName=\"id\"\n"+ 230 " type=\"INTEGER\"\n"+ 231 " primaryKey=\"true\"\n"+ 232 " required=\"true\"\n"+ 233 " />\n"+ 234 " </table>\n"+ 235 " <table name=\"B\">\n"+ 236 " <column name=\"aid\"\n"+ 237 " javaName=\"aid\"\n"+ 238 " type=\"INTEGER\"\n"+ 239 " />\n"+ 240 " <foreign-key foreignTable=\"A\">\n"+ 241 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 242 " </foreign-key>\n"+ 243 " </table>\n"+ 244 "</database>", 245 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 246 } 247 248 public void testProxy5() 250 { 251 addClass( 252 "test.A", 253 "package test;\n"+ 254 "/** @ojb.class */\n"+ 255 "public class A {\n"+ 256 "/** @ojb.field primarykey=\"true\" */\n"+ 257 " private int id;\n"+ 258 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 259 " * foreignkey=\"aid\"\n"+ 260 " * database-foreignkey=\"false\"\n"+ 261 " * proxy=\"true\"\n"+ 262 " * proxy-prefetching-limit=\"2\"\n"+ 263 " */\n"+ 264 " private java.util.List objs;\n"+ 265 "}\n"); 266 addClass( 267 "test.B", 268 "package test;\n"+ 269 "/** @ojb.class */\n"+ 270 "public class B {\n"+ 271 "/** @ojb.field */\n"+ 272 " private int aid;\n"+ 273 "}\n"); 274 addClass( 275 "test.C", 276 "package test;\n"+ 277 "/** @ojb.class */\n"+ 278 "public class C extends A {}\n"); 279 280 assertEqualsOjbDescriptorFile( 281 "<class-descriptor\n"+ 282 " class=\"test.A\"\n"+ 283 " table=\"A\"\n"+ 284 ">\n"+ 285 " <extent-class class-ref=\"test.C\"/>\n"+ 286 " <field-descriptor\n"+ 287 " name=\"id\"\n"+ 288 " column=\"id\"\n"+ 289 " jdbc-type=\"INTEGER\"\n"+ 290 " primarykey=\"true\"\n"+ 291 " >\n"+ 292 " </field-descriptor>\n"+ 293 " <collection-descriptor\n"+ 294 " name=\"objs\"\n"+ 295 " element-class-ref=\"test.B\"\n"+ 296 " proxy=\"true\"\n"+ 297 " proxy-prefetching-limit=\"2\"\n"+ 298 " >\n"+ 299 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 300 " </collection-descriptor>\n"+ 301 "</class-descriptor>\n"+ 302 "<class-descriptor\n"+ 303 " class=\"test.B\"\n"+ 304 " table=\"B\"\n"+ 305 ">\n"+ 306 " <field-descriptor\n"+ 307 " name=\"aid\"\n"+ 308 " column=\"aid\"\n"+ 309 " jdbc-type=\"INTEGER\"\n"+ 310 " >\n"+ 311 " </field-descriptor>\n"+ 312 "</class-descriptor>\n"+ 313 "<class-descriptor\n"+ 314 " class=\"test.C\"\n"+ 315 " table=\"C\"\n"+ 316 ">\n"+ 317 " <field-descriptor\n"+ 318 " name=\"id\"\n"+ 319 " column=\"id\"\n"+ 320 " jdbc-type=\"INTEGER\"\n"+ 321 " primarykey=\"true\"\n"+ 322 " >\n"+ 323 " </field-descriptor>\n"+ 324 " <collection-descriptor\n"+ 325 " name=\"objs\"\n"+ 326 " element-class-ref=\"test.B\"\n"+ 327 " proxy=\"true\"\n"+ 328 " proxy-prefetching-limit=\"2\"\n"+ 329 " >\n"+ 330 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 331 " </collection-descriptor>\n"+ 332 "</class-descriptor>", 333 runOjbXDoclet(OJB_DEST_FILE)); 334 assertEqualsTorqueSchemaFile( 335 "<database name=\"ojbtest\">\n"+ 336 " <table name=\"A\">\n"+ 337 " <column name=\"id\"\n"+ 338 " javaName=\"id\"\n"+ 339 " type=\"INTEGER\"\n"+ 340 " primaryKey=\"true\"\n"+ 341 " required=\"true\"\n"+ 342 " />\n"+ 343 " </table>\n"+ 344 " <table name=\"B\">\n"+ 345 " <column name=\"aid\"\n"+ 346 " javaName=\"aid\"\n"+ 347 " type=\"INTEGER\"\n"+ 348 " />\n"+ 349 " </table>\n"+ 350 " <table name=\"C\">\n"+ 351 " <column name=\"id\"\n"+ 352 " javaName=\"id\"\n"+ 353 " type=\"INTEGER\"\n"+ 354 " primaryKey=\"true\"\n"+ 355 " required=\"true\"\n"+ 356 " />\n"+ 357 " </table>\n"+ 358 "</database>", 359 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 360 } 361 362 public void testProxyPrefetchingLimit1() 364 { 365 addClass( 366 "test.A", 367 "package test;\n"+ 368 "/** @ojb.class */\n"+ 369 "public class A {\n"+ 370 "/** @ojb.field primarykey=\"true\" */\n"+ 371 " private int id;\n"+ 372 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 373 " * foreignkey=\"aid\"\n"+ 374 " * proxy=\"true\"\n"+ 375 " * proxy-prefetching-limit=\"0\"\n"+ 376 " */\n"+ 377 " private java.util.List objs;\n"+ 378 "}\n"); 379 addClass( 380 "test.B", 381 "package test;\n"+ 382 "/** @ojb.class */\n"+ 383 "public class B {\n"+ 384 "/** @ojb.field */\n"+ 385 " private int aid;\n"+ 386 "}\n"); 387 388 assertEqualsOjbDescriptorFile( 389 "<class-descriptor\n"+ 390 " class=\"test.A\"\n"+ 391 " table=\"A\"\n"+ 392 ">\n"+ 393 " <field-descriptor\n"+ 394 " name=\"id\"\n"+ 395 " column=\"id\"\n"+ 396 " jdbc-type=\"INTEGER\"\n"+ 397 " primarykey=\"true\"\n"+ 398 " >\n"+ 399 " </field-descriptor>\n"+ 400 " <collection-descriptor\n"+ 401 " name=\"objs\"\n"+ 402 " element-class-ref=\"test.B\"\n"+ 403 " proxy=\"true\"\n"+ 404 " proxy-prefetching-limit=\"0\"\n"+ 405 " >\n"+ 406 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 407 " </collection-descriptor>\n"+ 408 "</class-descriptor>\n"+ 409 "<class-descriptor\n"+ 410 " class=\"test.B\"\n"+ 411 " table=\"B\"\n"+ 412 ">\n"+ 413 " <field-descriptor\n"+ 414 " name=\"aid\"\n"+ 415 " column=\"aid\"\n"+ 416 " jdbc-type=\"INTEGER\"\n"+ 417 " >\n"+ 418 " </field-descriptor>\n"+ 419 "</class-descriptor>", 420 runOjbXDoclet(OJB_DEST_FILE)); 421 assertEqualsTorqueSchemaFile( 422 "<database name=\"ojbtest\">\n"+ 423 " <table name=\"A\">\n"+ 424 " <column name=\"id\"\n"+ 425 " javaName=\"id\"\n"+ 426 " type=\"INTEGER\"\n"+ 427 " primaryKey=\"true\"\n"+ 428 " required=\"true\"\n"+ 429 " />\n"+ 430 " </table>\n"+ 431 " <table name=\"B\">\n"+ 432 " <column name=\"aid\"\n"+ 433 " javaName=\"aid\"\n"+ 434 " type=\"INTEGER\"\n"+ 435 " />\n"+ 436 " <foreign-key foreignTable=\"A\">\n"+ 437 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 438 " </foreign-key>\n"+ 439 " </table>\n"+ 440 "</database>", 441 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 442 } 443 444 public void testProxyPrefetchingLimit2() 446 { 447 addClass( 448 "test.A", 449 "package test;\n"+ 450 "/** @ojb.class */\n"+ 451 "public class A {\n"+ 452 "/** @ojb.field primarykey=\"true\" */\n"+ 453 " private int id;\n"+ 454 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 455 " * foreignkey=\"aid\"\n"+ 456 " * proxy=\"true\"\n"+ 457 " * proxy-prefetching-limit=\"10\"\n"+ 458 " */\n"+ 459 " private java.util.List objs;\n"+ 460 "}\n"); 461 addClass( 462 "test.B", 463 "package test;\n"+ 464 "/** @ojb.class */\n"+ 465 "public class B {\n"+ 466 "/** @ojb.field */\n"+ 467 " private int aid;\n"+ 468 "}\n"); 469 470 assertEqualsOjbDescriptorFile( 471 "<class-descriptor\n"+ 472 " class=\"test.A\"\n"+ 473 " table=\"A\"\n"+ 474 ">\n"+ 475 " <field-descriptor\n"+ 476 " name=\"id\"\n"+ 477 " column=\"id\"\n"+ 478 " jdbc-type=\"INTEGER\"\n"+ 479 " primarykey=\"true\"\n"+ 480 " >\n"+ 481 " </field-descriptor>\n"+ 482 " <collection-descriptor\n"+ 483 " name=\"objs\"\n"+ 484 " element-class-ref=\"test.B\"\n"+ 485 " proxy=\"true\"\n"+ 486 " proxy-prefetching-limit=\"10\"\n"+ 487 " >\n"+ 488 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 489 " </collection-descriptor>\n"+ 490 "</class-descriptor>\n"+ 491 "<class-descriptor\n"+ 492 " class=\"test.B\"\n"+ 493 " table=\"B\"\n"+ 494 ">\n"+ 495 " <field-descriptor\n"+ 496 " name=\"aid\"\n"+ 497 " column=\"aid\"\n"+ 498 " jdbc-type=\"INTEGER\"\n"+ 499 " >\n"+ 500 " </field-descriptor>\n"+ 501 "</class-descriptor>", 502 runOjbXDoclet(OJB_DEST_FILE)); 503 assertEqualsTorqueSchemaFile( 504 "<database name=\"ojbtest\">\n"+ 505 " <table name=\"A\">\n"+ 506 " <column name=\"id\"\n"+ 507 " javaName=\"id\"\n"+ 508 " type=\"INTEGER\"\n"+ 509 " primaryKey=\"true\"\n"+ 510 " required=\"true\"\n"+ 511 " />\n"+ 512 " </table>\n"+ 513 " <table name=\"B\">\n"+ 514 " <column name=\"aid\"\n"+ 515 " javaName=\"aid\"\n"+ 516 " type=\"INTEGER\"\n"+ 517 " />\n"+ 518 " <foreign-key foreignTable=\"A\">\n"+ 519 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 520 " </foreign-key>\n"+ 521 " </table>\n"+ 522 "</database>", 523 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 524 } 525 526 public void testProxyPrefetchingLimit3() 528 { 529 addClass( 530 "test.A", 531 "package test;\n"+ 532 "/** @ojb.class */\n"+ 533 "public class A {\n"+ 534 "/** @ojb.field primarykey=\"true\" */\n"+ 535 " private int id;\n"+ 536 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 537 " * foreignkey=\"aid\"\n"+ 538 " * proxy=\"true\"\n"+ 539 " * proxy-prefetching-limit=\"a\"\n"+ 540 " */\n"+ 541 " private java.util.List objs;\n"+ 542 "}\n"); 543 addClass( 544 "test.B", 545 "package test;\n"+ 546 "/** @ojb.class */\n"+ 547 "public class B {\n"+ 548 "/** @ojb.field */\n"+ 549 " private int aid;\n"+ 550 "}\n"); 551 552 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 553 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 554 } 555 556 public void testProxyPrefetchingLimit4() 558 { 559 addClass( 560 "test.A", 561 "package test;\n"+ 562 "/** @ojb.class */\n"+ 563 "public class A {\n"+ 564 "/** @ojb.field primarykey=\"true\" */\n"+ 565 " private int id;\n"+ 566 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 567 " * foreignkey=\"aid\"\n"+ 568 " * proxy=\"true\"\n"+ 569 " * proxy-prefetching-limit=\"-3\"\n"+ 570 " */\n"+ 571 " private java.util.List objs;\n"+ 572 "}\n"); 573 addClass( 574 "test.B", 575 "package test;\n"+ 576 "/** @ojb.class */\n"+ 577 "public class B {\n"+ 578 "/** @ojb.field */\n"+ 579 " private int aid;\n"+ 580 "}\n"); 581 582 assertNull(runOjbXDoclet(OJB_DEST_FILE)); 583 assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 584 } 585 586 public void testProxyPrefetchingLimit5() 588 { 589 addClass( 590 "test.A", 591 "package test;\n"+ 592 "/** @ojb.class */\n"+ 593 "public class A {\n"+ 594 "/** @ojb.field primarykey=\"true\" */\n"+ 595 " private int id;\n"+ 596 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 597 " * foreignkey=\"aid\"\n"+ 598 " * proxy-prefetching-limit=\"3\"\n"+ 599 " */\n"+ 600 " private java.util.List objs;\n"+ 601 "}\n"); 602 addClass( 603 "test.B", 604 "package test;\n"+ 605 "/** @ojb.class */\n"+ 606 "public class B {\n"+ 607 "/** @ojb.field */\n"+ 608 " private int aid;\n"+ 609 "}\n"); 610 611 assertEqualsOjbDescriptorFile( 612 "<class-descriptor\n"+ 613 " class=\"test.A\"\n"+ 614 " table=\"A\"\n"+ 615 ">\n"+ 616 " <field-descriptor\n"+ 617 " name=\"id\"\n"+ 618 " column=\"id\"\n"+ 619 " jdbc-type=\"INTEGER\"\n"+ 620 " primarykey=\"true\"\n"+ 621 " >\n"+ 622 " </field-descriptor>\n"+ 623 " <collection-descriptor\n"+ 624 " name=\"objs\"\n"+ 625 " element-class-ref=\"test.B\"\n"+ 626 " >\n"+ 627 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 628 " </collection-descriptor>\n"+ 629 "</class-descriptor>\n"+ 630 "<class-descriptor\n"+ 631 " class=\"test.B\"\n"+ 632 " table=\"B\"\n"+ 633 ">\n"+ 634 " <field-descriptor\n"+ 635 " name=\"aid\"\n"+ 636 " column=\"aid\"\n"+ 637 " jdbc-type=\"INTEGER\"\n"+ 638 " >\n"+ 639 " </field-descriptor>\n"+ 640 "</class-descriptor>", 641 runOjbXDoclet(OJB_DEST_FILE)); 642 assertEqualsTorqueSchemaFile( 643 "<database name=\"ojbtest\">\n"+ 644 " <table name=\"A\">\n"+ 645 " <column name=\"id\"\n"+ 646 " javaName=\"id\"\n"+ 647 " type=\"INTEGER\"\n"+ 648 " primaryKey=\"true\"\n"+ 649 " required=\"true\"\n"+ 650 " />\n"+ 651 " </table>\n"+ 652 " <table name=\"B\">\n"+ 653 " <column name=\"aid\"\n"+ 654 " javaName=\"aid\"\n"+ 655 " type=\"INTEGER\"\n"+ 656 " />\n"+ 657 " <foreign-key foreignTable=\"A\">\n"+ 658 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 659 " </foreign-key>\n"+ 660 " </table>\n"+ 661 "</database>", 662 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 663 } 664 665 public void testProxyPrefetchingLimit6() 667 { 668 addClass( 669 "test.A", 670 "package test;\n"+ 671 "/** @ojb.class */\n"+ 672 "public class A {\n"+ 673 "/** @ojb.field primarykey=\"true\" */\n"+ 674 " private int id;\n"+ 675 "/** @ojb.collection element-class-ref=\"test.B\"\n"+ 676 " * foreignkey=\"aid\"\n"+ 677 " * proxy=\"false\"\n"+ 678 " * proxy-prefetching-limit=\"3\"\n"+ 679 " */\n"+ 680 " private java.util.List objs;\n"+ 681 "}\n"); 682 addClass( 683 "test.B", 684 "package test;\n"+ 685 "/** @ojb.class */\n"+ 686 "public class B {\n"+ 687 "/** @ojb.field */\n"+ 688 " private int aid;\n"+ 689 "}\n"); 690 691 assertEqualsOjbDescriptorFile( 692 "<class-descriptor\n"+ 693 " class=\"test.A\"\n"+ 694 " table=\"A\"\n"+ 695 ">\n"+ 696 " <field-descriptor\n"+ 697 " name=\"id\"\n"+ 698 " column=\"id\"\n"+ 699 " jdbc-type=\"INTEGER\"\n"+ 700 " primarykey=\"true\"\n"+ 701 " >\n"+ 702 " </field-descriptor>\n"+ 703 " <collection-descriptor\n"+ 704 " name=\"objs\"\n"+ 705 " element-class-ref=\"test.B\"\n"+ 706 " proxy=\"false\"\n"+ 707 " >\n"+ 708 " <inverse-foreignkey field-ref=\"aid\"/>\n"+ 709 " </collection-descriptor>\n"+ 710 "</class-descriptor>\n"+ 711 "<class-descriptor\n"+ 712 " class=\"test.B\"\n"+ 713 " table=\"B\"\n"+ 714 ">\n"+ 715 " <field-descriptor\n"+ 716 " name=\"aid\"\n"+ 717 " column=\"aid\"\n"+ 718 " jdbc-type=\"INTEGER\"\n"+ 719 " >\n"+ 720 " </field-descriptor>\n"+ 721 "</class-descriptor>", 722 runOjbXDoclet(OJB_DEST_FILE)); 723 assertEqualsTorqueSchemaFile( 724 "<database name=\"ojbtest\">\n"+ 725 " <table name=\"A\">\n"+ 726 " <column name=\"id\"\n"+ 727 " javaName=\"id\"\n"+ 728 " type=\"INTEGER\"\n"+ 729 " primaryKey=\"true\"\n"+ 730 " required=\"true\"\n"+ 731 " />\n"+ 732 " </table>\n"+ 733 " <table name=\"B\">\n"+ 734 " <column name=\"aid\"\n"+ 735 " javaName=\"aid\"\n"+ 736 " type=\"INTEGER\"\n"+ 737 " />\n"+ 738 " <foreign-key foreignTable=\"A\">\n"+ 739 " <reference local=\"aid\" foreign=\"id\"/>\n"+ 740 " </foreign-key>\n"+ 741 " </table>\n"+ 742 "</database>", 743 runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest")); 744 } 745 } 746 | Popular Tags |