1 45 package org.openejb.test.entity.bmp; 46 47 import javax.ejb.EJBHome ; 48 import javax.ejb.EJBMetaData ; 49 import javax.ejb.EJBObject ; 50 import javax.ejb.Handle ; 51 52 import org.openejb.test.object.ObjectGraph; 53 54 59 public class BmpRmiIiopTests extends BmpTestClient{ 60 61 protected RmiIiopBmpHome ejbHome; 62 protected RmiIiopBmpObject ejbObject; 63 64 public BmpRmiIiopTests(){ 65 super("RMI_IIOP."); 66 } 67 68 protected void setUp() throws Exception { 69 super.setUp(); 70 Object obj = initialContext.lookup("client/tests/entity/bmp/RMI-over-IIOP/EJBHome"); 71 ejbHome = (RmiIiopBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, RmiIiopBmpHome.class); 72 ejbObject = ejbHome.create("RMI-IIOP TestBean"); 73 } 74 75 76 77 78 79 public void test01_returnStringObject() { 80 try{ 81 String expected = new String ("1"); 82 String actual = ejbObject.returnStringObject(expected); 83 assertEquals(expected, actual); 84 } catch (Exception e){ 85 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 86 } 87 } 88 89 public void test02_returnStringObjectArray() { 90 try{ 91 String [] expected = {"1","2","3"}; 92 String [] actual = ejbObject.returnStringObjectArray(expected); 93 94 assertNotNull("The array returned is null", actual); 95 assertEquals(expected.length, actual.length); 96 for (int i=0; i < actual.length; i++){ 97 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 98 } 99 } catch (Exception e){ 100 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 101 } 102 } 103 104 105 106 107 108 109 public void test03_returnCharacterObject() { 110 try{ 111 Character expected = new Character ('1'); 112 Character actual = ejbObject.returnCharacterObject(expected); 113 assertEquals(expected, actual); 114 } catch (Exception e){ 115 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 116 } 117 } 118 119 public void test04_returnCharacterPrimitive() { 120 try{ 121 char expected = '1'; 122 char actual = ejbObject.returnCharacterPrimitive(expected); 123 assertEquals(expected, actual); 124 } catch (Exception e){ 125 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 126 } 127 } 128 129 public void test05_returnCharacterObjectArray() { 130 try{ 131 Character [] expected = {new Character ('1'),new Character ('2'),new Character ('3')}; 132 Character [] actual = ejbObject.returnCharacterObjectArray(expected); 133 134 assertNotNull("The array returned is null", actual); 135 assertEquals(expected.length, actual.length); 136 for (int i=0; i < actual.length; i++){ 137 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 138 } 139 } catch (Exception e){ 140 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 141 } 142 } 143 144 public void test06_returnCharacterPrimitiveArray() { 145 try{ 146 char[] expected = {'1','2','3'}; 147 char[] actual = ejbObject.returnCharacterPrimitiveArray(expected); 148 149 assertNotNull("The array returned is null", actual); 150 assertEquals(expected.length, actual.length); 151 for (int i=0; i < actual.length; i++){ 152 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 153 } 154 } catch (Exception e){ 155 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 156 } 157 } 158 159 160 161 162 163 164 public void test07_returnBooleanObject() { 165 try{ 166 Boolean expected = new Boolean (true); 167 Boolean actual = ejbObject.returnBooleanObject(expected); 168 assertEquals(expected, actual); 169 } catch (Exception e){ 170 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 171 } 172 } 173 174 public void test08_returnBooleanPrimitive() { 175 try{ 176 boolean expected = true; 177 boolean actual = ejbObject.returnBooleanPrimitive(expected); 178 assertEquals(""+expected, ""+actual); 179 } catch (Exception e){ 180 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 181 } 182 } 183 184 public void test09_returnBooleanObjectArray() { 185 try{ 186 Boolean [] expected = {new Boolean (true),new Boolean (false),new Boolean (true)}; 187 Boolean [] actual = ejbObject.returnBooleanObjectArray(expected); 188 189 assertNotNull("The array returned is null", actual); 190 assertEquals(expected.length, actual.length); 191 for (int i=0; i < actual.length; i++){ 192 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 193 } 194 } catch (Exception e){ 195 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 196 } 197 } 198 199 public void test10_returnBooleanPrimitiveArray() { 200 try{ 201 boolean[] expected = {false,true,true}; 202 boolean[] actual = ejbObject.returnBooleanPrimitiveArray(expected); 203 204 assertNotNull("The array returned is null", actual); 205 assertEquals(expected.length, actual.length); 206 for (int i=0; i < actual.length; i++){ 207 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 208 } 209 } catch (Exception e){ 210 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 211 } 212 } 213 214 215 216 217 218 219 public void test11_returnByteObject() { 220 try{ 221 Byte expected = new Byte ("1"); 222 Byte actual = ejbObject.returnByteObject(expected); 223 assertEquals(expected, actual); 224 } catch (Exception e){ 225 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 226 } 227 } 228 229 public void test12_returnBytePrimitive() { 230 try{ 231 byte expected = (byte)1; 232 byte actual = ejbObject.returnBytePrimitive(expected); 233 assertEquals(expected, actual); 234 } catch (Exception e){ 235 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 236 } 237 } 238 239 public void test13_returnByteObjectArray() { 240 try{ 241 Byte [] expected = {new Byte ("1"),new Byte ("2"),new Byte ("3")}; 242 Byte [] actual = ejbObject.returnByteObjectArray(expected); 243 244 assertNotNull("The array returned is null", actual); 245 assertEquals(expected.length, actual.length); 246 for (int i=0; i < actual.length; i++){ 247 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 248 } 249 } catch (Exception e){ 250 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 251 } 252 } 253 254 public void test14_returnBytePrimitiveArray() { 255 try{ 256 byte[] expected = {(byte)1,(byte)2,(byte)3}; 257 byte[] actual = ejbObject.returnBytePrimitiveArray(expected); 258 259 assertNotNull("The array returned is null", actual); 260 assertEquals(expected.length, actual.length); 261 for (int i=0; i < actual.length; i++){ 262 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 263 } 264 } catch (Exception e){ 265 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 266 } 267 } 268 269 270 271 272 273 274 public void test15_returnShortObject() { 275 try{ 276 Short expected = new Short ("1"); 277 Short actual = ejbObject.returnShortObject(expected); 278 assertEquals(expected, actual); 279 } catch (Exception e){ 280 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 281 } 282 } 283 284 public void test16_returnShortPrimitive() { 285 try{ 286 short expected = (short)1; 287 short actual = ejbObject.returnShortPrimitive(expected); 288 assertEquals(expected, actual); 289 } catch (Exception e){ 290 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 291 } 292 } 293 294 public void test17_returnShortObjectArray() { 295 try{ 296 Short [] expected = {new Short ("1"),new Short ("2"),new Short ("3")}; 297 Short [] actual = ejbObject.returnShortObjectArray(expected); 298 299 assertNotNull("The array returned is null", actual); 300 assertEquals(expected.length, actual.length); 301 for (int i=0; i < actual.length; i++){ 302 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 303 } 304 } catch (Exception e){ 305 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 306 } 307 } 308 309 public void test18_returnShortPrimitiveArray() { 310 try{ 311 short[] expected = {(short)1,(short)2,(short)3}; 312 short[] actual = ejbObject.returnShortPrimitiveArray(expected); 313 314 assertNotNull("The array returned is null", actual); 315 assertEquals(expected.length, actual.length); 316 for (int i=0; i < actual.length; i++){ 317 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 318 } 319 } catch (Exception e){ 320 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 321 } 322 } 323 324 325 326 327 328 329 public void test19_returnIntegerObject() { 330 try{ 331 Integer expected = new Integer (1); 332 Integer actual = ejbObject.returnIntegerObject(expected); 333 assertEquals(expected, actual); 334 } catch (Exception e){ 335 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 336 } 337 } 338 339 public void test20_returnIntegerPrimitive() { 340 try{ 341 int expected = 1; 342 int actual = ejbObject.returnIntegerPrimitive(expected); 343 assertEquals(expected, actual); 344 } catch (Exception e){ 345 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 346 } 347 } 348 349 public void test21_returnIntegerObjectArray() { 350 try{ 351 Integer [] expected = {new Integer (1),new Integer (2),new Integer (3)}; 352 Integer [] actual = ejbObject.returnIntegerObjectArray(expected); 353 354 assertNotNull("The array returned is null", actual); 355 assertEquals(expected.length, actual.length); 356 for (int i=0; i < actual.length; i++){ 357 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 358 } 359 } catch (Exception e){ 360 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 361 } 362 } 363 364 public void test22_returnIntegerPrimitiveArray() { 365 try{ 366 int[] expected = {1,2,3}; 367 int[] actual = ejbObject.returnIntegerPrimitiveArray(expected); 368 369 assertNotNull("The array returned is null", actual); 370 assertEquals(expected.length, actual.length); 371 for (int i=0; i < actual.length; i++){ 372 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 373 } 374 } catch (Exception e){ 375 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 376 } 377 } 378 379 380 381 382 383 384 public void test23_returnLongObject() { 385 try{ 386 Long expected = new Long ("1"); 387 Long actual = ejbObject.returnLongObject(expected); 388 assertEquals(expected, actual); 389 } catch (Exception e){ 390 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 391 } 392 } 393 394 public void test24_returnLongPrimitive() { 395 try{ 396 long expected = 1; 397 long actual = ejbObject.returnLongPrimitive(expected); 398 assertEquals(expected, actual); 399 } catch (Exception e){ 400 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 401 } 402 } 403 404 public void test25_returnLongObjectArray() { 405 try{ 406 Long [] expected = {new Long ("1"),new Long ("2"),new Long ("3")}; 407 Long [] actual = ejbObject.returnLongObjectArray(expected); 408 409 assertNotNull("The array returned is null", actual); 410 assertEquals(expected.length, actual.length); 411 for (int i=0; i < actual.length; i++){ 412 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 413 } 414 } catch (Exception e){ 415 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 416 } 417 } 418 419 public void test26_returnLongPrimitiveArray() { 420 try{ 421 long[] expected = {1,2,3}; 422 long[] actual = ejbObject.returnLongPrimitiveArray(expected); 423 424 assertNotNull("The array returned is null", actual); 425 assertEquals(expected.length, actual.length); 426 for (int i=0; i < actual.length; i++){ 427 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 428 } 429 } catch (Exception e){ 430 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 431 } 432 } 433 434 435 436 437 438 439 public void test27_returnFloatObject() { 440 try{ 441 Float expected = new Float ("1.3"); 442 Float actual = ejbObject.returnFloatObject(expected); 443 assertEquals(expected, actual); 444 } catch (Exception e){ 445 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 446 } 447 } 448 449 public void test28_returnFloatPrimitive() { 450 try{ 451 float expected = 1.2F; 452 float actual = ejbObject.returnFloatPrimitive(expected); 453 assertEquals(expected, actual, 0.00D); 454 } catch (Exception e){ 455 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 456 } 457 } 458 459 public void test29_returnFloatObjectArray() { 460 try{ 461 Float [] expected = {new Float ("1.1"),new Float ("2.2"),new Float ("3.3")}; 462 Float [] actual = ejbObject.returnFloatObjectArray(expected); 463 464 assertNotNull("The array returned is null", actual); 465 assertEquals(expected.length, actual.length); 466 for (int i=0; i < actual.length; i++){ 467 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 468 } 469 } catch (Exception e){ 470 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 471 } 472 } 473 474 public void test30_returnFloatPrimitiveArray() { 475 try{ 476 float[] expected = {1.2F,2.3F,3.4F}; 477 float[] actual = ejbObject.returnFloatPrimitiveArray(expected); 478 479 assertNotNull("The array returned is null", actual); 480 assertEquals(expected.length, actual.length); 481 for (int i=0; i < actual.length; i++){ 482 assertEquals("Array values are not equal at index "+i , expected[i], actual[i], 0.0D); 483 } 484 } catch (Exception e){ 485 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 486 } 487 } 488 489 490 491 492 493 494 public void test31_returnDoubleObject() { 495 try{ 496 Double expected = new Double ("1.1"); 497 Double actual = ejbObject.returnDoubleObject(expected); 498 assertEquals(expected, actual); 499 } catch (Exception e){ 500 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 501 } 502 } 503 504 public void test32_returnDoublePrimitive() { 505 try{ 506 double expected = 1.2; 507 double actual = ejbObject.returnDoublePrimitive(expected); 508 assertEquals(expected, actual, 0.0D); 509 } catch (Exception e){ 510 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 511 } 512 } 513 514 public void test33_returnDoubleObjectArray() { 515 try{ 516 Double [] expected = {new Double ("1.3"),new Double ("2.4"),new Double ("3.5")}; 517 Double [] actual = ejbObject.returnDoubleObjectArray(expected); 518 519 assertNotNull("The array returned is null", actual); 520 assertEquals(expected.length, actual.length); 521 for (int i=0; i < actual.length; i++){ 522 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i]); 523 } 524 } catch (Exception e){ 525 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 526 } 527 } 528 529 public void test34_returnDoublePrimitiveArray() { 530 try{ 531 double[] expected = {1.4,2.5,3.6}; 532 double[] actual = ejbObject.returnDoublePrimitiveArray(expected); 533 534 assertNotNull("The array returned is null", actual); 535 assertEquals(expected.length, actual.length); 536 for (int i=0; i < actual.length; i++){ 537 assertEquals("Array values are not equal at index "+i ,expected[i], actual[i],0.0D); 538 } 539 } catch (Exception e){ 540 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 541 } 542 } 543 544 545 546 547 548 549 public void test35_returnEJBHome() { 550 try{ 551 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 552 EncBmpHome expected = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 553 assertNotNull("The EJBHome returned from JNDI is null", expected); 554 555 EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBHome(expected), EncBmpHome.class); 556 assertNotNull("The EJBHome returned is null", actual); 557 558 } catch (Exception e){ 559 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 560 } 561 } 562 563 public void test36_returnEJBHome2() { 564 try{ 565 EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBHome(), EncBmpHome.class); 566 assertNotNull("The EJBHome returned is null", actual); 567 568 } catch (Exception e){ 569 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 570 } 571 } 572 573 public void test37_returnNestedEJBHome() { 574 try{ 575 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 576 EncBmpHome expected = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 577 assertNotNull("The EJBHome returned from JNDI is null", expected); 578 579 ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected)); 580 assertNotNull("The ObjectGraph is null", graph); 581 582 EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpHome.class); 583 assertNotNull("The EJBHome returned is null", actual); 584 } catch (Exception e){ 585 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 586 } 587 } 588 589 public void test38_returnNestedEJBHome2() { 590 try{ 591 ObjectGraph graph = ejbObject.returnNestedEJBHome(); 592 assertNotNull("The ObjectGraph is null", graph); 593 594 EncBmpHome actual = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpHome.class); 595 assertNotNull("The EJBHome returned is null", actual); 596 } catch (Exception e){ 597 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 598 } 599 } 600 601 public void test39_returnEJBHomeArray() { 602 try{ 603 604 EncBmpHome expected[] = new EncBmpHome[3]; 605 for (int i=0; i < expected.length; i++){ 606 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 607 expected[i] = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 608 assertNotNull("The EJBHome returned from JNDI is null", expected[i]); 609 } 610 611 EJBHome [] actual = ejbObject.returnEJBHomeArray(expected); 612 assertNotNull("The EJBHome array returned is null", actual); 613 assertEquals(expected.length, actual.length); 614 615 } catch (Exception e){ 616 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 617 } 618 } 619 620 621 622 623 624 625 public void test40_returnEJBObject() { 626 try{ 627 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 628 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 629 assertNotNull("The EJBHome returned from JNDI is null", home); 630 631 EncBmpObject expected = home.create("test_40 BmpBean"); 632 assertNotNull("The EJBObject created is null", expected); 633 634 EncBmpObject actual = (EncBmpObject)javax.rmi.PortableRemoteObject.narrow( ejbObject.returnEJBObject(expected), EncBmpObject.class); 635 assertNotNull("The EJBObject returned is null", actual); 636 637 assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual)); 638 } catch (Exception e){ 639 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 640 } 641 } 642 643 public void test41_returnEJBObject2() { 644 try{ 645 EncBmpObject actual = (EncBmpObject)javax.rmi.PortableRemoteObject.narrow(ejbObject.returnEJBObject(), EncBmpObject.class); 646 assertNotNull("The EJBObject returned is null", actual); 647 648 } catch (Exception e){ 649 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 650 } 651 } 652 653 public void test42_returnNestedEJBObject() { 654 try{ 655 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 656 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 657 assertNotNull("The EJBHome returned from JNDI is null", home); 658 659 EncBmpObject expected = home.create("test_42 BmpBean"); 660 assertNotNull("The EJBObject created is null", expected); 661 662 ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected)); 663 assertNotNull("The ObjectGraph is null", graph); 664 665 EncBmpObject actual = (EncBmpObject)(EncBmpObject)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpObject.class); 666 assertNotNull("The EJBObject returned is null", actual); 667 668 assertTrue("The EJBObejcts are not identical", expected.isIdentical(actual)); 669 } catch (Exception e){ 670 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 671 } 672 } 673 674 public void test43_returnNestedEJBObject2() { 675 try{ 676 ObjectGraph graph = ejbObject.returnNestedEJBObject(); 677 assertNotNull("The ObjectGraph is null", graph); 678 679 EncBmpObject actual = (EncBmpObject)(EncBmpObject)javax.rmi.PortableRemoteObject.narrow( graph.getObject(), EncBmpObject.class); 680 assertNotNull("The EJBHome returned is null", actual); 681 } catch (Exception e){ 682 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 683 } 684 } 685 686 public void test44_returnEJBObjectArray() { 687 try{ 688 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 689 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 690 assertNotNull("The EJBHome returned from JNDI is null", home); 691 692 EncBmpObject expected[] = new EncBmpObject[3]; 693 for (int i=0; i < expected.length; i++){ 694 expected[i] = home.create("test_44 BmpBean"); 695 assertNotNull("The EJBObject created is null", expected[i]); 696 } 697 698 EJBObject [] actual = ejbObject.returnEJBObjectArray(expected); 699 assertNotNull("The EJBObject array returned is null", actual); 700 assertEquals(expected.length, actual.length); 701 702 for (int i=0; i < actual.length; i++){ 703 assertTrue("The EJBObjects are not identical", expected[i].isIdentical(actual[i])); 704 } 705 706 } catch (Exception e){ 707 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 708 } 709 } 710 711 712 713 714 715 public void test45_returnEJBMetaData() { 716 try{ 717 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 718 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 719 assertNotNull("The EJBHome returned from JNDI is null", home); 720 721 EJBMetaData expected = home.getEJBMetaData(); 722 assertNotNull("The EJBMetaData returned is null", expected); 723 724 EJBMetaData actual = ejbObject.returnEJBMetaData(expected); 725 assertNotNull("The EJBMetaData returned is null", actual); 726 assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass()); 727 assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); 728 } catch (Exception e){ 729 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 730 } 731 } 732 733 public void test46_returnEJBMetaData() { 734 try{ 735 EJBMetaData actual = ejbObject.returnEJBMetaData(); 736 assertNotNull("The EJBMetaData returned is null", actual); 737 assertEquals(actual.getHomeInterfaceClass(), actual.getHomeInterfaceClass()); 738 assertEquals(actual.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); 739 } catch (Exception e){ 740 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 741 } 742 } 743 744 public void test47_returnNestedEJBMetaData() { 745 try{ 746 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 747 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 748 assertNotNull("The EJBHome returned from JNDI is null", home); 749 750 EJBMetaData expected = home.getEJBMetaData(); 751 assertNotNull("The EJBMetaData returned is null", expected); 752 753 ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected)); 754 assertNotNull("The ObjectGraph is null", graph); 755 756 EJBMetaData actual = (EJBMetaData )graph.getObject(); 757 assertNotNull("The EJBMetaData returned is null", actual); 758 assertEquals(expected.getHomeInterfaceClass(), actual.getHomeInterfaceClass()); 759 assertEquals(expected.getRemoteInterfaceClass(), actual.getRemoteInterfaceClass()); 760 } catch (Exception e){ 761 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 762 } 763 } 764 765 public void test48_returnNestedEJBMetaData2() { 766 try{ 767 ObjectGraph graph = ejbObject.returnNestedEJBMetaData(); 768 assertNotNull("The ObjectGraph is null", graph); 769 770 EJBMetaData actual = (EJBMetaData )graph.getObject(); 771 assertNotNull("The EJBMetaData returned is null", actual); 772 assertNotNull("The home interface class of the EJBMetaData is null", actual.getHomeInterfaceClass()); 773 assertNotNull("The remote interface class of the EJBMetaData is null", actual.getRemoteInterfaceClass()); 774 } catch (Exception e){ 775 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 776 } 777 } 778 779 public void test49_returnEJBMetaDataArray() { 780 try{ 781 782 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 783 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 784 assertNotNull("The EJBHome returned from JNDI is null", home); 785 786 EJBMetaData expected[] = new EJBMetaData [3]; 787 for (int i=0; i < expected.length; i++){ 788 expected[i] = home.getEJBMetaData(); 789 assertNotNull("The EJBMetaData returned is null", expected[i]); 790 } 791 792 EJBMetaData [] actual = (EJBMetaData [])ejbObject.returnEJBMetaDataArray(expected); 793 assertNotNull("The EJBMetaData array returned is null", actual); 794 assertEquals(expected.length, actual.length); 795 796 for (int i=0; i < actual.length; i++){ 797 assertNotNull("The EJBMetaData returned is null", actual[i]); 798 assertEquals(expected[i].getHomeInterfaceClass(), actual[i].getHomeInterfaceClass()); 799 assertEquals(expected[i].getRemoteInterfaceClass(), actual[i].getRemoteInterfaceClass()); 800 } 801 } catch (Exception e){ 802 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 803 } 804 } 805 806 807 808 809 810 811 public void test50_returnHandle() { 812 try{ 813 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 814 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 815 assertNotNull("The EJBHome returned from JNDI is null", home); 816 817 EncBmpObject object = home.create("test_50 BmpBean"); 818 assertNotNull("The EJBObject created is null", object); 819 820 Handle expected = object.getHandle(); 821 assertNotNull("The EJBObject Handle returned is null", expected); 822 assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject()); 823 824 Handle actual = ejbObject.returnHandle(expected); 825 assertNotNull("The EJBObject Handle returned is null", actual); 826 assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject()); 827 828 EJBObject exp = expected.getEJBObject(); 829 EJBObject act = actual.getEJBObject(); 830 831 assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act)); 832 } catch (Exception e){ 833 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 834 } 835 } 836 837 public void test51_returnHandle() { 838 try{ 839 Handle actual = ejbObject.returnHandle(); 840 assertNotNull("The EJBObject Handle returned is null", actual); 841 assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject()); 842 843 } catch (Exception e){ 844 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 845 } 846 } 847 848 public void test52_returnNestedHandle() { 849 try{ 850 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 851 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 852 assertNotNull("The EJBHome returned from JNDI is null", home); 853 854 EncBmpObject object = home.create("test_52 BmpBean"); 855 assertNotNull("The EJBObject created is null", object); 856 857 Handle expected = object.getHandle(); 858 assertNotNull("The EJBObject Handle returned is null", expected); 859 assertNotNull("The EJBObject in the Handle is null", expected.getEJBObject()); 860 861 ObjectGraph graph = ejbObject.returnObjectGraph(new ObjectGraph(expected)); 862 assertNotNull("The ObjectGraph is null", graph); 863 864 Handle actual = (Handle )graph.getObject(); 865 assertNotNull("The EJBObject Handle returned is null", actual); 866 assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject()); 867 868 EJBObject exp = expected.getEJBObject(); 869 EJBObject act = actual.getEJBObject(); 870 871 assertTrue("The EJBObjects in the Handles are not identical", exp.isIdentical(act)); 872 873 } catch (Exception e){ 874 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 875 } 876 } 877 878 public void test53_returnNestedHandle2() { 879 try{ 880 ObjectGraph graph = ejbObject.returnNestedHandle(); 881 assertNotNull("The ObjectGraph is null", graph); 882 883 Handle actual = (Handle )graph.getObject(); 884 assertNotNull("The EJBObject Handle returned is null", actual); 885 assertNotNull("The EJBObject in the Handle is null", actual.getEJBObject()); 886 } catch (Exception e){ 887 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 888 } 889 } 890 891 public void test54_returnHandleArray() { 892 try{ 893 Object obj = initialContext.lookup("client/tests/entity/bmp/EncBean"); 894 EncBmpHome home = (EncBmpHome)javax.rmi.PortableRemoteObject.narrow( obj, EncBmpHome.class); 895 assertNotNull("The EJBHome returned from JNDI is null", home); 896 897 EncBmpObject object = home.create("test_54 BmpBean"); 898 assertNotNull("The EJBObject created is null", object); 899 900 Handle expected[] = new Handle [3]; 901 for (int i=0; i < expected.length; i++){ 902 expected[i] = object.getHandle(); 903 assertNotNull("The EJBObject Handle returned is null", expected[i]); 904 } 905 906 Handle [] actual = (Handle [])ejbObject.returnHandleArray(expected); 907 assertNotNull("The Handle array returned is null", actual); 908 assertEquals(expected.length, actual.length); 909 910 for (int i=0; i < expected.length; i++){ 911 assertNotNull("The EJBObject Handle returned is null", actual[i]); 912 assertNotNull("The EJBObject in the Handle is null", actual[i].getEJBObject()); 913 assertTrue("The EJBObjects in the Handles are not equal", expected[i].getEJBObject().isIdentical(actual[i].getEJBObject())); 914 } 915 916 } catch (Exception e){ 917 fail("Received Exception "+e.getClass()+ " : "+e.getMessage()); 918 } 919 } 920 921 922 923 924 925 926 public void test55_returnObjectGraph() { 927 } 928 public void test56_returnObjectGraphArray() { 929 } 930 } 931 932 | Popular Tags |