Ejemplo n.º 1
0
  /** Test initializing a DynAny object from an Any value. */
  public void testInitDynAnyFromAny() {
    String msg;
    EmptyException type;
    org.omg.CORBA.Any any = null;
    org.omg.CORBA.TypeCode tc = null;
    org.omg.DynamicAny.DynStruct dynAny = null;
    org.omg.DynamicAny.DynStruct dynAny2 = null;

    tc = EmptyExceptionHelper.type();
    dynAny = createDynAnyFromTypeCode(tc);

    type = new EmptyException();
    any = orb.create_any();
    EmptyExceptionHelper.insert(any, type);
    dynAny2 = createDynAnyFromAny(any);

    msg = "Failed to initialize a DynAny object from an Any object ";
    msg += "using the DynAny::from_any operation";
    try {
      dynAny.from_any(any);
    } catch (Throwable ex) {
      fail(msg + ": " + ex);
    }
    assertTrue(msg, dynAny.equal(dynAny2));
  }
Ejemplo n.º 2
0
  /** Test creating a copy of a DynAny object. */
  public void testCopyDynAny() {
    String msg;
    org.omg.CORBA.TypeCode tc = null;
    org.omg.DynamicAny.DynStruct dynAny = null;
    org.omg.DynamicAny.DynStruct dynAny2 = null;

    tc = EmptyExceptionHelper.type();
    dynAny = createDynAnyFromTypeCode(tc);
    dynAny2 = (org.omg.DynamicAny.DynStruct) dynAny.copy();

    msg = "The DynAny object created with the DynAny::copy operation ";
    msg += "is not equal to the DynAny object it was copied from";
    assertTrue(msg, dynAny.equal(dynAny2));
  }
Ejemplo n.º 3
0
  /** Test comparing DynAny values. */
  public void testCompareDynAny() {
    String msg;
    EmptyException type;
    org.omg.CORBA.Any any = null;
    org.omg.DynamicAny.DynStruct dynAny = null;
    org.omg.DynamicAny.DynStruct dynAny2 = null;

    type = new EmptyException();
    any = orb.create_any();
    EmptyExceptionHelper.insert(any, type);
    dynAny = createDynAnyFromAny(any);
    dynAny2 = createDynAnyFromAny(any);

    msg = "Comparing two equal DynAny values using DynAny::equal failed";
    assertTrue(msg, dynAny.equal(dynAny2));
  }
Ejemplo n.º 4
0
  /** Test generating an Any value from a DynAny object. */
  public void testGenerateAnyFromDynAny() {
    String msg;
    org.omg.CORBA.Any any = null;
    org.omg.CORBA.TypeCode tc = null;
    org.omg.DynamicAny.DynStruct dynAny = null;
    org.omg.DynamicAny.DynStruct dynAny2 = null;

    tc = EmptyExceptionHelper.type();
    dynAny = createDynAnyFromTypeCode(tc);

    any = orb.create_any();
    any = dynAny.to_any();
    dynAny2 = createDynAnyFromAny(any);

    msg = "The DynAny::to_any operation failed to create an Any ";
    msg += "object with the same value as the DynAny object";
    assertTrue(msg, dynAny.equal(dynAny2));
  }