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