Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Trading / import_test.cpp
blob86b10a73b729c9b898fe8271c5eb5f10507fcd6c
1 #include "tao/Utils/ORB_Manager.h"
2 #include "Offer_Importer.h"
4 int
5 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
7 int failure = 0;
9 try
11 if (argc<=1)
13 ACE_DEBUG ((LM_INFO,
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"
20 "\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"));
23 return 1;
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")),
42 1);
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!");
63 failure = 1;
66 return failure;