Ejemplo n.º 1
0
Test::Hello_var
prepare_tests (CORBA::ORB_ptr orb, PortableServer::POA_ptr root_poa)
{
  register_factories(orb);

  CORBA::Object_var objectman =
    orb->resolve_initial_references ("ORBPolicyManager");

  CORBA::PolicyManager_var policy_manager =
    CORBA::PolicyManager::_narrow (objectman.in ());

  PortableServer::POA_var my_compress_poa = 0;
  CORBA::PolicyList policies(4);
  policies.length(4);

  try
    {
      policies[0] = create_compressor_id_level_list_policy (orb);
      policies[1] = create_low_value_policy (orb);
      policies[2] = create_compression_enabled_policy (orb);
      policies[3] = create_min_ratio_policy (orb);

      my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies);
    }
  catch(const CORBA::PolicyError&)
    {
      policies.length(0);
      my_compress_poa = root_poa->create_POA("My_Compress_Poa", 0, policies);
    }

  policy_manager->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);

  CORBA::Object_var pcobject =
    orb->resolve_initial_references ("PolicyCurrent");

  CORBA::PolicyCurrent_var policy_current =
    CORBA::PolicyCurrent::_narrow (pcobject.in ());

  policy_current->set_policy_overrides (policies, CORBA::ADD_OVERRIDE);

  PortableServer::POAManager_var poa_manager = my_compress_poa->the_POAManager ();

  Hello *hello_impl = 0;
  ACE_NEW_RETURN (hello_impl,
                  Hello (orb),
                  0);
  PortableServer::ServantBase_var owner_transfer(hello_impl);

  PortableServer::ObjectId_var id =
    my_compress_poa->activate_object (hello_impl);

  CORBA::Object_var object = my_compress_poa->id_to_reference (id.in ());

  Test::Hello_var hello = Test::Hello::_narrow (object.in ());

  poa_manager->activate ();

  return hello._retn ();
}
Ejemplo n.º 2
0
Archivo: client.cpp Proyecto: manut/TAO
Test::Hello_var
create_policies (CORBA::ORB_ptr orb, bool add_zlib_compressor)
{
  CORBA::PolicyList policies(4);
  policies.length(4);

  policies[0] = create_compressor_id_level_list_policy (orb, add_zlib_compressor);
  policies[1] = create_low_value_policy (orb);
  policies[2] = create_compression_enabled_policy (orb);
  policies[3] = create_min_ratio_policy (orb);

  CORBA::Object_var tmp = orb->string_to_object(ior);
  CORBA::Object_var tmp2 = tmp->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE);
  Test::Hello_var hello = Test::Hello::_narrow(tmp2.in ());
  return hello._retn ();
}
Ejemplo n.º 3
0
Archivo: client.cpp Proyecto: manut/TAO
Test::Hello_var
prepare_tests (CORBA::ORB_ptr orb, bool create_factories=true)
{
#if defined TAO_HAS_ZIOP && TAO_HAS_ZIOP == 1
  if (create_factories)
    {
      register_factories(orb);
    }

  return create_policies (orb, !create_factories);
#else
  ACE_UNUSED_ARG (create_factories);
  CORBA::Object_var tmp = orb->string_to_object(ior);
  Test::Hello_var hello = Test::Hello::_narrow(tmp.in ());
  return hello._retn ();
#endif
}