1 #include "tao/Utils/ORB_Manager.h"
2 #include "Offer_Importer.h"
5 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
14 "\nUsage: import_test <options>\n"
15 "Test the trader's importer role, the options are:\n"
16 "-ORBInitRef <orb_options> E.g. '-ORBInitRef TradingService=file://trading.ior'\n"
17 "-quiet or -q (optional) Run the tests in quiet mode, don't show the query and list results.\n"
18 "-federate or -f (optional) Perform federated trader tests.\n"
19 "-iorfile or -i (optional) Get TradingService reference through IOR instead of resolve.\n"
21 "This test needs the 'export_test' running so the trader has the right offers.\n"
22 "See also TAO/docs/releasenotes/trader.html.\n\n"));
25 TAO_ORB_Manager orb_manager
;
26 orb_manager
.init (argc
, argv
);
28 // Command line argument parser.
29 TT_Parse_Args
parse_args (argc
, argv
);
31 // Initialize the ORB and bootstrap to the Lookup interface.
32 CORBA::ORB_var orb
= orb_manager
.orb ();
33 ACE_DEBUG ((LM_DEBUG
, "*** Bootstrap to the Lookup interface.\n"));
34 char* ior
= parse_args
.ior ();
35 CORBA::Object_var trading_obj
= (ior
== 0) ?
36 orb
->resolve_initial_references ("TradingService") :
37 orb
->string_to_object (ior
);
39 if (CORBA::is_nil (trading_obj
.in ()))
40 ACE_ERROR_RETURN ((LM_ERROR
,
41 ACE_TEXT("ERROR, Unable to bootstrap to the Trading Service!\n")),
44 // Narrow the lookup interface.
45 ACE_DEBUG ((LM_DEBUG
, "*** Narrowing the lookup interface.\n"));
46 CosTrading::Lookup_var lookup_if
=
47 CosTrading::Lookup::_narrow (trading_obj
.in ());
49 // Run the Offer Importer tests.
50 ACE_DEBUG ((LM_DEBUG
, "*** Running the Offer Importer tests.\n"));
51 TAO_Offer_Importer
offer_importer (lookup_if
.in (), ! parse_args
.quiet ());
53 offer_importer
.perform_queries ();
55 if (parse_args
.federated ())
57 offer_importer
.perform_directed_queries ();
60 catch (const CORBA::Exception
& e
)
62 e
._tao_print_exception ("Trader import test ERROR!");