2 //=============================================================================
10 //=============================================================================
17 #include "ace/Get_Opt.h"
19 // This function runs the test (main program)
21 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
23 // get an instance of the driver object
26 // initialize the driver
27 if (drv
.init (argc
, argv
) == -1)
28 ACE_ERROR_RETURN ((LM_ERROR
,
29 "(%N:%l) driver.cpp - "
30 "Driver initialization failed\n"),
35 ACE_ERROR_RETURN ((LM_ERROR
,
36 "(%N:%l) driver.cpp - "
51 // initialize the driver
53 Driver::init (int argc
, ACE_TCHAR
**argv
)
55 // environment to track exceptions
57 // retrieve the instance of Options
58 Options
*opt
= OPTIONS::instance ();
60 char exception_string
[256];
64 ACE_OS::strcpy (exception_string
, "ORB Initialization");
66 // Retrieve the underlying ORB
67 this->orb_
= CORBA::ORB_init (argc
,
71 // Parse command line and verify parameters.
72 if (opt
->parse_args (argc
, argv
) == -1)
73 ACE_ERROR_RETURN ((LM_ERROR
,
74 "(%N:%l) driver.cpp - "
75 "parse_args failed\n"),
77 // Retrieve a Param_Test object reference
78 ACE_OS::strcpy (exception_string
,"ORB::string_to_object() failed.");
80 CORBA::Object_var temp
=
81 this->orb_
->string_to_object (opt
->param_test_ior ());
84 if (CORBA::is_nil (temp
.in()))
85 ACE_ERROR_RETURN ((LM_ERROR
,
86 "ORB::string_to_object() returned null object for IOR <%s>\n",
87 opt
->param_test_ior ()),
90 // Get the object reference
91 ACE_OS::strcpy (exception_string
,"Param_Test::_narrow () failed.");
93 this->objref_
= Alt_Mapping::_narrow (temp
.in());
95 catch (const CORBA::Exception
& ex
)
97 ex
._tao_print_exception (exception_string
);
107 // serves as a factory of Param_Client objects. It is also responsible to
110 Options
*opt
= OPTIONS::instance (); // get the options object
113 switch (opt
->test_type ())
115 case Options::TEST_UB_STRING
:
117 Alt_Mapping_Client
<Test_Unbounded_String
> *client
= new
118 Alt_Mapping_Client
<Test_Unbounded_String
> (this->orb_
.in (),
120 new Test_Unbounded_String
);
121 retstatus
= client
->run_sii_test ();
126 case Options::TEST_UB_STRUCT_SEQUENCE
:
128 Alt_Mapping_Client
<Test_Unbounded_Struct_Sequence
> *client
= new
129 Alt_Mapping_Client
<Test_Unbounded_Struct_Sequence
> (
132 new Test_Unbounded_Struct_Sequence
);
134 retstatus
= client
->run_sii_test ();
138 Alt_Mapping_Client
<Test_Unbounded_Struct_Sequence
> *client2
= new
139 Alt_Mapping_Client
<Test_Unbounded_Struct_Sequence
>
142 new Test_Unbounded_Struct_Sequence
);
144 retstatus
= client2
->run_sii_test ();
153 // Get in a new environment variable
156 if (opt
->shutdown ())
158 this->objref_
->shutdown ();
161 catch (const CORBA::Exception
& ex
)
163 ex
._tao_print_exception ("during shutdown");