Ejemplo n.º 1
0
bool
set_nil_servant_manager (PortableServer::POA_ptr poa)
{
  bool succeed = false;
  try
    {
      // Setting a nil servant manager should give an OBJ_Adapter exception with
      // minor code 4
      poa->set_servant_manager (PortableServer::ServantManager::_nil());
    }
  catch (const CORBA::OBJ_ADAPTER& ex)
    {
      if ((ex.minor() & 0xFFFU) == 4)
        {
          succeed = true;
        }
    }
  catch (const CORBA::Exception&)
    {
    }

  if (!succeed)
  {
    ACE_ERROR ((LM_ERROR,
                "(%t) ERROR, set nil servant manager failed\n"));
  }

  return succeed;
}
Ejemplo n.º 2
0
bool
overwrite_servant_manager (PortableServer::POA_ptr poa)
{
  bool succeed = false;
  try
    {
      Servant_Locator servant_locator (poa);

      // Setting a servant manager after it is already set should give
      // obj_adapter with minor code 6
      poa->set_servant_manager (&servant_locator);
    }
  catch (const CORBA::BAD_INV_ORDER& ex)
    {
      if ((ex.minor() & 0xFFFU) == 6)
        {
          succeed = true;
        }
    }
  catch (const CORBA::Exception&)
    {
    }

  if (!succeed)
  {
    ACE_ERROR ((LM_ERROR,
                "(%t) ERROR, overwrite servant manager failed\n"));
  }

  return succeed;
}
Ejemplo n.º 3
0
void
test_set_servant_manager (PortableServer::POA_ptr poa)
{
  bool succeed = false;
  try
    {
      // Setting the servant manager should give a wrong policy exception
      // exception
      poa->set_servant_manager (PortableServer::ServantManager::_nil());
    }
  catch (const PortableServer::POA::WrongPolicy& )
    {
      succeed = true;
    }
  catch (const CORBA::Exception&)
    {
    }

  if (!succeed)
  {
    ACE_ERROR ((LM_ERROR,
                "(%t) ERROR, set servant manager failed, should give an exception\n"));
  }
}