| 1 package org.jacorb.test.orb.dynany; 2 3 22 23 import junit.framework.*; 24 import junit.extensions.TestSetup; 25 import org.omg.CORBA.TCKind ; 26 27 import java.lang.reflect.Method ; 28 29 import org.jacorb.test.common.ORBSetup; 30 import org.jacorb.test.UnionDefaultIntType; 31 import org.jacorb.test.UnionDefaultIntTypeHelper; 32 import org.jacorb.test.UnionNoDefaultIntType; 33 import org.jacorb.test.UnionNoDefaultIntTypeHelper; 34 35 41 42 public class DynAnyUnionIntTest extends TestCase 43 { 44 private static org.omg.DynamicAny.DynAnyFactory factory = null; 45 private static org.omg.CORBA.ORB orb = null; 46 47 private static final String ID = "IDL:test:1.0"; 48 private static final String NAME = "MyUnion"; 49 50 public DynAnyUnionIntTest (String name) 51 { 52 super (name); 53 } 54 55 56 public static Test suite () 57 { 58 TestSuite suite = new TestSuite 59 ("DynUnion Tests using Integer Discriminator"); 60 Setup setup = new Setup (suite); 61 ORBSetup osetup = new ORBSetup (setup); 62 63 suite.addTest (new DynAnyUnionIntTest ("testFactoryCreateFromAny")); 64 suite.addTest (new DynAnyUnionIntTest ("testFactoryCreateFromTypeCode")); 65 suite.addTest (new DynAnyUnionIntTest ("testFactoryCreateFromIDLTypeCode")); 66 suite.addTest (new DynAnyUnionIntTest ("testCompareDynAnyUnamedMember")); 67 suite.addTest (new DynAnyUnionIntTest ("testCompareDynAnyNamedMember")); 68 suite.addTest (new DynAnyUnionIntTest ("testIterateDynAnyNamedMember")); 69 suite.addTest (new DynAnyUnionIntTest ("testIterateDynAnyUnamedMember")); 70 suite.addTest (new DynAnyUnionIntTest ("testAccessUnionDisc")); 71 suite.addTest (new DynAnyUnionIntTest ("testUnionDefaultCase")); 72 suite.addTest (new DynAnyUnionIntTest ("testUnionNoDefaultCase")); 73 suite.addTest (new DynAnyUnionIntTest ("testAccessNamedUnionMember")); 74 suite.addTest (new DynAnyUnionIntTest ("testAccessUnamedUnionMember")); 75 suite.addTest (new DynAnyUnionIntTest ("testDynAnyTypeCode")); 76 suite.addTest (new DynAnyUnionIntTest ("testInitDynAnyFromDynAny")); 77 suite.addTest (new DynAnyUnionIntTest ("testInitDynAnyFromAny")); 78 suite.addTest (new DynAnyUnionIntTest ("testInitFromAnyTypeMismatchEx")); 79 suite.addTest (new DynAnyUnionIntTest ("testGenerateAnyFromDynAny")); 80 suite.addTest (new DynAnyUnionIntTest ("testDestroyDynAny")); 81 suite.addTest (new DynAnyUnionIntTest ("testDestroyComponent")); 82 suite.addTest (new DynAnyUnionIntTest ("testCopyDynAny")); 83 84 return osetup; 85 } 86 87 88 92 public void testFactoryCreateFromAny () 93 { 94 UnionDefaultIntType type = null; 95 org.omg.CORBA.Any any = null; 96 97 type = new UnionDefaultIntType (); 98 type.win (10); 99 any = orb.create_any (); 100 UnionDefaultIntTypeHelper.insert (any, type); 101 102 createDynAnyFromAny (any); 103 } 104 105 106 110 public void testFactoryCreateFromTypeCode () 111 { 112 org.omg.CORBA.TypeCode tc = null; 113 114 tc = orb.create_union_tc 115 ( 116 ID, 117 NAME, 118 orb.get_primitive_tc (TCKind.tk_short), 119 getUnionMembers () 120 ); 121 createDynAnyFromTypeCode (tc); 122 } 123 124 125 129 public void testFactoryCreateFromIDLTypeCode () 130 { 131 org.omg.CORBA.TypeCode tc = null; 132 133 tc = UnionDefaultIntTypeHelper.type (); 134 createDynAnyFromTypeCode (tc); 135 } 136 137 138 141 public void testCompareDynAnyUnamedMember () 142 { 143 String msg; 144 UnionNoDefaultIntType type; 145 org.omg.CORBA.Any any = null; 146 org.omg.DynamicAny.DynUnion dynAny = null; 147 org.omg.DynamicAny.DynUnion dynAny2 = null; 148 149 type = new UnionNoDefaultIntType (); 150 151 Class unionClass = type.getClass (); 153 Method method = null; 154 155 try 157 { 158 method = unionClass.getDeclaredMethod ("__default", new Class [0]); 159 } 160 catch (NoSuchMethodException ex) 161 { 162 try 163 { 164 method = unionClass.getDeclaredMethod ("_default", new Class [0]); 165 } 166 catch (Throwable e) 167 { 168 msg = "Unexpected error trying to determine method to invoke: " + e; 169 fail (msg); 170 } 171 } 172 173 try 175 { 176 method.invoke (type, new Object [0]); 177 } 178 catch (Throwable ex) 179 { 180 fail ("Failed to invoke method via reflection: " + ex); 181 } 182 183 any = orb.create_any (); 184 UnionNoDefaultIntTypeHelper.insert (any, type); 185 dynAny = createDynAnyFromAny (any); 186 dynAny2 = createDynAnyFromAny (any); 187 188 msg = "Comparing two equal DynAny values using DynAny::equal failed"; 189 assertTrue (msg, dynAny.equal (dynAny2)); 190 } 191 192 193 196 public void testCompareDynAnyNamedMember () 197 { 198 String msg; 199 UnionDefaultIntType type; 200 org.omg.CORBA.Any any = null; 201 org.omg.DynamicAny.DynUnion dynAny = null; 202 org.omg.DynamicAny.DynUnion dynAny2 = null; 203 204 type = new UnionDefaultIntType (); 205 type.win (10); 206 any = orb.create_any (); 207 UnionDefaultIntTypeHelper.insert (any, type); 208 dynAny = createDynAnyFromAny (any); 209 dynAny2 = createDynAnyFromAny (any); 210 211 msg = "Comparing two equal DynAny values using DynAny::equal failed"; 212 assertTrue (msg, dynAny.equal (dynAny2)); 213 } 214 215 216 220 public void testIterateDynAnyNamedMember () 221 { 222 String msg; 223 int compCount = -1; 224 boolean seek; 225 org.omg.CORBA.TypeCode tc = null; 226 org.omg.DynamicAny.DynUnion dynAny = null; 227 org.omg.DynamicAny.DynAny compSeek = null; 228 org.omg.DynamicAny.DynAny compRewind = null; 229 230 tc = orb.create_union_tc 231 ( 232 ID, 233 NAME, 234 orb.get_primitive_tc (TCKind.tk_short), 235 getUnionMembers () 236 ); 237 dynAny = createDynAnyFromTypeCode (tc); 238 239 msg = "The number of components returned from the "; 241 msg += "DynAny::component_count method is incorrect"; 242 try 243 { 244 compCount = dynAny.component_count (); 245 } 246 catch (Throwable ex) 247 { 248 fail ("Unexpected error raised by DynAny::component_count operation"); 250 } 251 assertEquals (msg, 2, compCount); 252 253 msg = "The DynAny::seek operation indicates a valid current position "; 255 msg += "when the current position should be invalid"; 256 seek = dynAny.seek (-1); 257 assertTrue (msg, !seek); 258 259 msg = "The DynAny::seek operation indicates an invalid current position "; 261 msg += "when the current position should be valid"; 262 seek = dynAny.seek (0); 263 assertTrue (msg, seek); 264 265 try 267 { 268 compSeek = dynAny.current_component (); 269 } 270 catch (Throwable ex) 271 { 272 msg = "Failed to get the current component using the "; 273 msg += "DynAny::current_component operation after calling the "; 274 msg += "DynAny::seek operation"; 275 fail (msg); 276 } 277 278 msg = "The DynAny::next operation indicates an invalid current position "; 280 msg += "when the current position should be valid"; 281 seek = dynAny.next (); 282 assertTrue (msg, seek); 283 284 dynAny.rewind (); 286 287 try 289 { 290 compRewind = dynAny.current_component (); 291 } 292 catch (Throwable ex) 293 { 294 msg = "Failed to get the current component using the "; 295 msg += "DynAny::current_component operation after calling the "; 296 msg += "DynAny::rewind operation"; 297 fail (msg); 298 } 299 msg = "The component at DynAny::seek(0) is not equal to the "; 300 msg += "component at DynAny::rewind"; 301 assertTrue (msg, compSeek.equal (compRewind)); 302 } 303 304 305 309 public void testIterateDynAnyUnamedMember () 310 { 311 String msg; 312 int compCount = -1; 313 boolean seek; 314 UnionNoDefaultIntType type; 315 org.omg.CORBA.Any any = null; 316 org.omg.CORBA.TypeCode tc = null; 317 org.omg.DynamicAny.DynUnion dynAny = null; 318 org.omg.DynamicAny.DynAny disc = null; 319 320 type = new UnionNoDefaultIntType (); 321 322 Class unionClass = type.getClass (); 324 Method method = null; 325 326 try 328 { 329 method = unionClass.getDeclaredMethod ("__default", new Class [0]); 330 } 331 catch (NoSuchMethodException ex) 332 { 333 try 334 { 335 method = unionClass.getDeclaredMethod ("_default", new Class [0]); 336 } 337 catch (Throwable e) 338 { 339 msg = "Unexpected error trying to determine method to invoke: " + e; 340 fail (msg); 341 } 342 } 343 344 try 346 { 347 method.invoke (type, new Object [0]); 348 } 349 catch (Throwable ex) 350 { 351 fail ("Failed to invoke method via reflection: " + ex); 352 } 353 354 any = orb.create_any (); 355 UnionNoDefaultIntTypeHelper.insert (any, type); 356 dynAny = createDynAnyFromAny (any); 357 358 disc = dynAny.get_discriminator (); 360 361 msg = "The discriminator is incorrectly set for a DynAny created "; 363 msg += "from a union with no active member"; 364 assertEquals (msg, (short) 4, disc.to_any ().extract_short ()); 365 366 try 368 { 369 compCount = dynAny.component_count (); 370 } 371 catch (Throwable ex) 372 { 373 fail ("Unexpected error raised by DynAny::component_count operation"); 375 } 376 377 msg = "The number of components returned from the "; 378 msg += "DynAny::component_count operation is incorrect"; 379 assertEquals (msg, 1, compCount); 380 381 msg = "The DynAny::seek operation indicates an invalid current position "; 383 msg += "when the current position should be valid"; 384 seek = dynAny.seek (0); 385 assertTrue (msg, seek); 386 387 msg = "The DynAny::next operation indicates a valid current position "; 389 msg += "when the current position should be invalid"; 390 seek = dynAny.next (); 391 assertTrue (msg, !seek); 392 393 msg = "The object returned from the DynAny::current_component "; 395 msg += "operation should be null because the current position is "; 396 msg += "invalid (-1)"; 397 try 398 { 399 dynAny = (org.omg.DynamicAny.DynUnion ) dynAny.current_component (); 400 401 assertNull (msg, dynAny); 402 } 403 catch (Throwable ex) 404 { 405 fail (msg + ": " + ex); 406 } 407 } 408 409 410 413 public void testAccessUnionDisc () 414 { 415 String msg; 416 TCKind discKind = null; 417 org.omg.CORBA.TypeCode tc = null; 418 org.omg.DynamicAny.DynUnion dynAny = null; 419 org.omg.DynamicAny.DynAny disc = null; 420 org.omg.DynamicAny.DynAny invalidDisc = null; 421 422 tc = UnionDefaultIntTypeHelper.type (); 423 dynAny = createDynAnyFromTypeCode (tc); 424 425 tc = orb.get_primitive_tc (TCKind.tk_short); 427 try 428 { 429 disc = factory.create_dyn_any_from_type_code (tc); 430 } 431 catch (Throwable ex) 432 { 433 fail ("Failed to create DynAny with correct TypeCode: " + ex); 434 } 435 436 try 437 { 438 disc.insert_short ((short) 1); } 440 catch (Throwable ex) 441 { 442 fail ("Failed to set value of discriminator: " + ex); 443 } 444 445 try 446 { 447 dynAny.set_discriminator (disc); 448 } 449 catch (Throwable ex) 450 { 451 msg = "Failed to set the value of the discriminator using the "; 452 msg += "DynUnion::set_discriminator operation"; 453 fail (msg + ": " + ex); 454 } 455 456 msg = "Failed to get the correct value of the discriminator using the "; 458 msg += "DynUnion::get_discriminator operation"; 459 disc = dynAny.get_discriminator (); 460 461 assertEquals (msg, (short) 1, disc.to_any ().extract_short ()); 463 464 msg = "Failed to get the correct kind of the discriminator using "; 466 msg += "DynUnion::discriminator_kind operation"; 467 discKind = dynAny.discriminator_kind (); 468 469 assertEquals (msg, TCKind._tk_short, discKind.value ()); 471 472 tc = orb.get_primitive_tc (TCKind.tk_boolean); 474 try 475 { 476 invalidDisc = factory.create_dyn_any_from_type_code (tc); 477 } 478 catch (Throwable ex) 479 { 480 fail ("Failed to create DynAny with incorrect TypeCode: " + ex); 481 } 482 483 try 484 { 485 dynAny.set_discriminator (invalidDisc); 486 487 msg = "Failed to throw a TypeMismatch exception when calling "; 488 msg += "DynStruct::set_discriminator operation with an incorrect "; 489 msg += "TypeCode"; 490 fail (msg); 491 } 492 catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) 493 { 494 } 496 } 497 498 499 503 public void testUnionDefaultCase () 504 { 505 String msg; 506 int compCount = -1; 507 short discVal = 0; 508 UnionDefaultIntType type; 509 boolean hasNoActiveMember = true; 510 org.omg.CORBA.Any any = null; 511 org.omg.DynamicAny.DynAny disc = null; 512 org.omg.DynamicAny.DynUnion dynAny = null; 513 514 type = new UnionDefaultIntType (); 515 type.win (10); 516 any = orb.create_any (); 517 UnionDefaultIntTypeHelper.insert (any, type); 518 dynAny = createDynAnyFromAny (any); 519 520 msg = "Failed to set the discriminator to the default member using the "; 522 msg += "DynUnion::set_to_default_member operation"; 523 try 524 { 525 dynAny.set_to_default_member (); 526 } 527 catch (Throwable ex) 528 { 529 fail (msg + ": " + ex); 530 } 531 disc = dynAny.get_discriminator (); 532 533 536 discVal = disc.to_any ().extract_short (); 538 assertTrue (msg, discVal < 0 || discVal > 3); 539 540 try 542 { 543 compCount = dynAny.component_count (); 544 } 545 catch (Throwable ex) 546 { 547 fail ("Unexpected error raised by DynAny::component_count operation"); 549 } 550 msg = "Wrong number of components returned from DynAny::component_count "; 551 msg += "operation after calling DynUnion::set_to_default_member "; 552 msg += "operation"; 553 assertEquals (msg, 2, compCount); 554 555 try 557 { 558 dynAny.set_to_no_active_member (); 559 560 msg = "Failed to raise a TypeMismatch exception when calling the "; 561 msg += "DynUnion::set_to_no_active_member operation on a union with "; 562 msg += "an explicit default case"; 563 fail (msg); 564 } 565 catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) 566 { 567 } 569 570 msg = "The DynUnion::has_no_active_member operation did not return "; 571 msg += "FALSE when called on a union with an explicit default case"; 572 try 573 { 574 hasNoActiveMember = dynAny.has_no_active_member (); 575 } 576 catch (Throwable ex) 577 { 578 fail (msg + ": " + ex); 579 } 580 assertTrue (msg, !hasNoActiveMember); 581 } 582 583 584 588 public void testUnionNoDefaultCase () 589 { 590 String msg; 591 int compCount = -1; 592 UnionNoDefaultIntType type; 593 boolean hasNoActiveMember = false; 594 org.omg.CORBA.Any any = null; 595 org.omg.DynamicAny.DynUnion dynAny = null; 596 org.omg.DynamicAny.DynAny disc = null; 597 598 type = new UnionNoDefaultIntType (); 599 type.win (10); 600 any = orb.create_any (); 601 UnionNoDefaultIntTypeHelper.insert (any, type); 602 dynAny = createDynAnyFromAny (any); 603 604 msg = "Failed to set the discriminator to no active member using the "; 606 msg += "DynUnion::set_to_no_active_member operation"; 607 try 608 { 609 dynAny.set_to_no_active_member (); 610 } 611 catch (Throwable ex) 612 { 613 fail (msg + ": " + ex); 614 } 615 disc = dynAny.get_discriminator (); 616 617 assertEquals (msg, (short) 4, disc.to_any ().extract_short ()); 619 620 try 622 { 623 compCount = dynAny.component_count (); 624 } 625 catch (Throwable ex) 626 { 627 fail ("Unexpected error raised by DynAny::component_count operation"); 629 } 630 631 msg = "Wrong number of components returned from DynAny::component_count "; 632 msg += "operation after calling DynUnion::set_to_no_active_member "; 633 msg += "operation"; 634 assertEquals (msg, 1, compCount); 635 636 try 638 { 639 dynAny.set_to_default_member (); 640 641 msg = "Failed to raise a TypeMismatch exception when calling the "; 642 msg += "DynUnion::set_to_default_member operation on a union without "; 643 msg += "an explicit default case"; 644 fail (msg); 645 } 646 catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) 647 { 648 } 650 651 msg = "The DynUnion::has_no_active_member operation did not return "; 652 msg += "TRUE when called on a union without an explicit default case"; 653 try 654 { 655 hasNoActiveMember = dynAny.has_no_active_member (); 656 } 657 catch (Throwable ex) 658 { 659 fail (msg + ": " + ex); 660 } 661 assertTrue (msg, hasNoActiveMember); 662 } 663 664 665 668 public void testAccessNamedUnionMember () 669 { 670 String msg; 671 int testVal = 10; 672 UnionDefaultIntType type; 673 TCKind memberKind = null; 674 String memberName = null; 675 int memberVal = -1; 676 org.omg.CORBA.Any any = null; 677 org.omg.DynamicAny.DynUnion dynAny = null; 678 org.omg.DynamicAny.DynAny member = null; 680 type = new UnionDefaultIntType (); 681 type.win (testVal); 682 any = orb.create_any (); 683 UnionDefaultIntTypeHelper.insert (any, type); 684 dynAny = createDynAnyFromAny (any); 685 686 msg = "Failed to get the correct kind of the active member using "; 688 msg += "DynUnion::member_kind operation"; 689 try 690 { 691 memberKind = dynAny.member_kind (); 692 } 693 catch (Throwable ex) 694 { 695 fail (msg + ": " + ex); 696 } 697 698 assertEquals (msg, TCKind._tk_long, memberKind.value ()); 700 701 msg = "Failed to get the correct name of the active member using "; 703 msg += "DynUnion::member_name operation"; 704 try 705 { 706 memberName = dynAny.member_name (); 707 } 708 catch (Throwable ex) 709 { 710 fail (msg + ": " + ex); 711 } 712 713 assertEquals (msg, "win", memberName); 715 try 717 { 718 member = dynAny.member (); 719 } 720 catch (Throwable ex) 721 { 722 msg = "Failed to get the correct active union member using "; 723 msg += "DynUnion::member operation"; 724 fail (msg + ": " + ex); 725 } 726 727 msg = "Failed to get the correct value of active union member using "; 728 msg += "DynUnion::member operation"; 729 memberVal = member.to_any ().extract_long (); 730 731 assertEquals (msg, testVal, memberVal); 733 } 734 735 736 740 public void testAccessUnamedUnionMember () 741 { 742 String msg; 743 org.omg.CORBA.TypeCode tc = null; 744 org.omg.DynamicAny.DynUnion dynAny = null; 745 746 tc = UnionNoDefaultIntTypeHelper.type (); 747 dynAny = createDynAnyFromTypeCode (tc); 748 749 try 750 { 751 dynAny.set_to_no_active_member (); 752 } 753 catch (Throwable ex) 754 { 755 fail ("Failed to set the union to have no active member: " + ex); 756 } 757 758 try 760 { 761 dynAny.member_kind (); 762 763 msg = "Failed to raise an InvalidValue exception when calling the "; 764 msg += "DynUnion::member_kind operation on a union with no active "; 765 msg += "member"; 766 fail (msg); 767 } 768 catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) 769 { 770 } 772 773 try 775 { 776 dynAny.member_name (); 777 778 msg = "Failed to raise an InvalidValue exception when calling the "; 779 msg += "DynUnion::member_name operation on a union with no active "; 780 msg += "member"; 781 fail (msg); 782 } 783 catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) 784 { 785 } 787 788 try 790 { 791 dynAny.member (); 792 793 msg = "Failed to raise an InvalidValue exception when calling the "; 794 msg += "DynUnion::member operation on a union with no active member"; 795 fail (msg); 796 } 797 catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) 798 { 799 } 801 } 802 803 804 807 public void testDynAnyTypeCode () 808 { 809 String msg; 810 org.omg.CORBA.TypeCode tc = null; 811 org.omg.DynamicAny.DynUnion dynAny = null; 812 813 tc = orb.create_union_tc 814 ( 815 ID, 816 NAME, 817 orb.get_primitive_tc (TCKind.tk_short), 818 getUnionMembers () 819 ); 820 dynAny = createDynAnyFromTypeCode (tc); 821 822 msg = "Incorrect TypeCode retrieved from DynAny::type operation"; 823 assertTrue (msg, dynAny.type ().equal (tc)); 824 } 825 826 827 830 public void testInitDynAnyFromDynAny () 831 { 832 String msg; 833 UnionDefaultIntType type; 834 org.omg.CORBA.Any any = null; 835 org.omg.CORBA.TypeCode tc = null; 836 org.omg.DynamicAny.DynUnion dynAny = null; 837 org.omg.DynamicAny.DynUnion dynAny2 = null; 838 839 tc = UnionDefaultIntTypeHelper.type (); 840 dynAny = createDynAnyFromTypeCode (tc); 841 842 type = new UnionDefaultIntType (); 843 type.win (10); 844 any = orb.create_any (); 845 UnionDefaultIntTypeHelper.insert (any, type); 846 dynAny2 = createDynAnyFromAny (any); 847 848 msg = "Failed to initialize a DynAny object from another DynAny "; 849 msg += "object using the DynAny::assign operation"; 850 try 851 { 852 dynAny.assign (dynAny2); 853 } 854 catch (Throwable ex) 855 { 856 fail (msg + ": " + ex); 857 } 858 assertTrue (msg, dynAny.equal (dynAny2)); 859 } 860 861 862 865 public void testInitDynAnyFromAny () 866 { 867 String msg; 868 UnionDefaultIntType type; 869 org.omg.CORBA.Any any = null; 870 org.omg.CORBA.TypeCode tc = null; 871 org.omg.DynamicAny.DynUnion dynAny = null; 872 org.omg.DynamicAny.DynUnion dynAny2 = null; 873 874 tc = UnionDefaultIntTypeHelper.type (); 875 dynAny = createDynAnyFromTypeCode (tc); 876 877 type = new UnionDefaultIntType (); 878 type.win (10); 879 any = orb.create_any (); 880 UnionDefaultIntTypeHelper.insert (any, type); 881 dynAny2 = createDynAnyFromAny (any); 882 883 msg = "Failed to initialize a DynAny object from an Any object "; 884 msg += "using the DynAny::from_any operation"; 885 try 886 { 887 dynAny.from_any (any); 888 } 889 catch (Throwable ex) 890 { 891 fail (msg + ": " + ex); 892 } 893 assertTrue (msg, dynAny.equal (dynAny2)); 894 } 895 896 897 901 public void testInitFromAnyTypeMismatchEx () 902 { 903 String msg; 904 org.omg.CORBA.Any any = null; 905 org.omg.CORBA.TypeCode tc = null; 906 org.omg.DynamicAny.DynUnion dynAny = null; 907 908 any = orb.create_any (); 909 any.insert_string ("Hello"); 910 911 tc = orb.create_union_tc 912 ( 913 ID, 914 NAME, 915 orb.get_primitive_tc (TCKind.tk_short), 916 getUnionMembers () 917 ); 918 dynAny = createDynAnyFromTypeCode (tc); 919 920 msg = "TypeMismatch exception not thrown by DynAny::from_any "; 921 msg += "operation when DynAny and Any operands have different types"; 922 try 923 { 924 dynAny.from_any (any); 925 926 fail (msg); 927 } 928 catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) 929 { 930 } 932 catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) 933 { 934 fail (msg + ": " + ex); 935 } 936 } 937 938 939 |