Пример #1
0
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt());

  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
  one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), "IIOP_Factory");

  if (p1 != 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find IIOP_Factory\n")), -1);

  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBANAME_Parser");

  if (p2 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBANAME_Parser\n")), -1);

  ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBALOC_Parser");

  if (p3 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBALOC_Parser\n")), -1);

  return 0;
}
Пример #2
0
// Bind the handler with the request id.
int
TAO_Exclusive_TMS::bind_dispatcher (CORBA::ULong request_id,
                                    ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd)
{
    this->request_id_ = request_id;
    this->rd_ = rd.get ();

    return 0;
}
Пример #3
0
int
testSeparation (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testSeparation");

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt_Test (10));
  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  two->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");

  TAO_Protocol_Factory* p10 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);
  if (p10 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1);

  TAO_Protocol_Factory* p11 =  ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), "IIOP_Factory");
  if (p11 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBANAME_Parser");

  ACE_Service_Object* p20 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p20 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p31 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p31 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBALOC_Parser");

  ACE_Service_Object* p21 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p21 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p30 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p30 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1);

  return 0;
}
Пример #4
0
int
testReusingGlobals (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testReusingGlobals");

  {
    ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt (10, false));

    // The ACE_Service_Gestalt_Test will teardown all!
    one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
    one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

    const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
    TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);

    if (p1 != 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s locally\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBANAME_Parser");
    ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p2 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s localy\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBALOC_Parser");
    ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p3 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s locally\n"), svcname));
        return -1;
      }
  }


  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  //  ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance ()

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), svcname);

  if (p1 != 0)
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
    }

  svcname = ACE_TEXT ("CORBANAME_Parser");
  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);

  if (p2 == 0) // You should be able to find the same stuff here, too
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
      }

  return 0;
}