summaryrefslogtreecommitdiff
path: root/tests/Connection_Failure/client.cpp
blob: 3f7bb3729237d07d9597ba7f6fa4437000da6008 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// $Id$

#include "testC.h"
#include "tao/SystemException.h"

#include "ace/Log_Msg.h"

const char *ior =
  "corbaloc:iiop:192.3.47/10007/RandomObject";

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      CORBA::Object_var tmp =
        orb->string_to_object (ior);

      // First connection happens here..
      test::_narrow (tmp.in ());
    }
  catch (const CORBA::TRANSIENT& )
    {
      // This exception is correct.
      ACE_DEBUG ((LM_DEBUG,
                  "_narrow() to non-existent object failed correctly.  Test succeeded.\n"));
      return 0;
    }
  catch (const ::CORBA::Exception &ex)
    {
      ex._tao_print_exception("ERROR : unexpected CORBA exception caugth :");
    }
  // Should not reach here.
  ACE_ERROR_RETURN ((LM_ERROR,
                     "_narrow() succeeded to non-existent object when it should not have...\n"),
                     -1);
}