Package org.omg.DynamicAny

Examples of org.omg.DynamicAny.DynAny


    * Test retrieving a basic value from a DynAny that has a different typecode.
    */
   public void testRetrieveMismatch_any () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      dynAny.insert_long(700);

      try
      {
          dynAny.get_any();
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here


    * Test accessing a value of some basic type in a DynAny object.
    */
   public void testAccessBasicValue_typecode () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      String msg = "Value inserted into DynAny object is not equal to value ";
      msg += "extracted from same DynAny object";

      TypeCode payload = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      dynAny.insert_typecode (payload);

      TypeCode offload = dynAny.get_typecode();
      assertTrue(msg, payload.equal(offload));
   }
View Full Code Here

    * Test inserting a basic value into a DynAny that has a different typecode.
    */
   public void testInsertMismatch_typecode () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      TypeCode payload = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_octet);

      try
      {
          dynAny.insert_typecode (payload);
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

    * Test retrieving a basic value from a DynAny that has a different typecode.
    */
   public void testRetrieveMismatch_typecode () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      dynAny.insert_long(700);

      try
      {
          dynAny.get_typecode();
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

    * Test accessing a value of some basic type in a DynAny object.
    */
   public void testAccessBasicValue_dynany () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);

      String msg = "Value inserted into DynAny object is not equal to value ";
      msg += "extracted from same DynAny object";

      tc = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny payload = createDynAnyFromTypeCode (tc);
      payload.insert_long(787);

      dynAny.insert_dyn_any(payload);
      DynAny offload = dynAny.get_dyn_any();

      assertEquals (msg, 787, offload.get_long());
   }
View Full Code Here

    * Test inserting a basic value into a DynAny that has a different typecode.
    */
   public void testInsertMismatch_dynany () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      DynAny inAny = createDynAnyFromTypeCode(tc);
      inAny.insert_boolean (true);

      try
      {
          dynAny.insert_dyn_any (inAny);
          fail ("should have thrown TypeMismatch");
View Full Code Here

    * Test retrieving a basic value from a DynAny that has a different typecode.
    */
   public void testRetrieveMismatch_dynany () throws Exception
   {
      TypeCode tc     = orb.get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
      DynAny   dynAny = createDynAnyFromTypeCode (tc);
      dynAny.insert_long(700);

      try
      {
          dynAny.get_dyn_any();
          fail ("should have thrown TypeMismatch");
      }
      catch (TypeMismatch ex)
      {
          // ok
View Full Code Here

      + "01C00000000000100010000000105010001000101090000000105010001";


   public void testInsertDynAnyObject() throws Exception
   {
       DynAny dyn_any = null;

       org.omg.CORBA.Object  obj = orb.string_to_object (nameService);

       TypeCode tc = org.omg.CosNaming.NamingContextExtHelper.type();

       dyn_any =
           (DynAny)
           factory.create_dyn_any_from_type_code (tc);

       dyn_any.insert_reference (obj);

       dyn_any.to_any();

       dyn_any.destroy();
   }
View Full Code Here

    {
        final NVList _expectedParams = getORB().create_list(operation.parameters.length);

        for (int x = 0; x < operation.parameters.length; ++x)
        {
            final DynAny _dynAny = dynAnyFactory_
                    .create_dyn_any_from_type_code(operation.parameters[x].type);

            _expectedParams
                    .add_value(operation.parameters[x].name, _dynAny.to_any(), ARG_OUT.value);
        }

        map.put(operation.name, _expectedParams);
    }
View Full Code Here

            if (logger_.isDebugEnabled())
            {
                logger_.debug("evaluate array idx " + index + " on a Any of type: " + any.type());
            }

            DynAny _dynAny = toDynAny(any);
            DynAny _cursor;

            _dynAny.rewind();
            _dynAny.seek(index);
            _cursor = _dynAny.current_component();

            if (logger_.isDebugEnabled())
            {
                logger_.debug("evaluation result is of type: " + _cursor.type());
            }

            return _cursor.to_any();
        } catch (TypeMismatch e)
        {
            throw newEvaluationException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.omg.DynamicAny.DynAny

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.