Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / tests / Concurrency / CC_client.h
blob475c869b6c8acec22d0ef7daa168d911f5b26abe
2 //=============================================================================
3 /**
4 * @file CC_client.h
6 * This class implements a client used to test the CosConcurrency
7 * service.
9 * @author Torben Worm <tworm@cs.wustl.edu>
11 //=============================================================================
14 #include "ace/Get_Opt.h"
16 #if !defined (ACE_LACKS_PRAGMA_ONCE)
17 # pragma once
18 #endif /* ACE_LACKS_PRAGMA_ONCE */
20 #include "orbsvcs/CosConcurrencyControlC.h"
21 #include "orbsvcs/CosNamingC.h"
22 #include "CC_tests.h"
23 #include "CC_naming_service.h"
24 #include "CC_command.h"
25 #include "CC_command.tab.h"
27 #ifndef _CC_CLIENT_H_
28 #define _CC_CLIENT_H_
30 // Stuff to be used by the command file parser
31 int ace_cc_yyparse(void);
32 int line_no = 1;
33 char line_buf[500];
34 CC_CommandList *cmdlist;
35 extern FILE *ace_cc_yyin;
36 // end of parser stuff
39 /**
40 * @class CC_Client
42 * @brief Defines a class that encapsulates the behaviour of a clien of
43 * the concurrency service.
45 * This class declares an interface to run the test client for
46 * the concurrency service.
48 class CC_Client
50 public:
51 /// Default constructor.
52 CC_Client (void);
54 /// Destructor.
55 ~CC_Client (void);
57 /// Run the test.
58 int run (void);
60 /// Initialize the test with the parameters from the command line.
61 int init (int argc, ACE_TCHAR **argv);
63 private:
64 /// Function to initialize the naming service.
65 int init_naming_service (void);
67 /// Function to parse the command line arguments.
68 int parse_args (void);
70 /// Function to read the ior from the given file.
71 int read_ior (ACE_TCHAR *filename);
73 /// Runs the basic tests (on a single lock set). Returns CC_SUCCESS
74 /// upon success CC_FAIL otherwise.
75 int run_basic_tests (void);
77 /// Runs the extended tests (on more lock sets). Returns CC_SUCCESS
78 /// upon success CC_FAIL otherwise.
79 int run_extended_tests (ACE_TCHAR *params);
81 /// Checks the parameters given to the run_extended_tests() function.
82 /// returns -1 if an error is found.
83 int check_extended_test_params(ACE_TCHAR *params);
85 /// A pointer to the naming service used for this test.
86 CC_naming_service *naming_service_;
88 /// File from which to obtain the IOR.
89 FILE *cc_factory_ior_file_;
91 /// The factory key for the lock set factory.
92 char *cc_factory_key_;
94 /// File handle to read the IOR.
95 ACE_HANDLE f_handle_;
97 /// Flag to tell server to shutdown.
98 int shutdown_;
100 /// Remember our orb.
101 CORBA::ORB_var orb_;
103 // CosConcurrencyControl::LockSetFactory_var factory_;
104 // factory pointer for the lock set. @@TAO maybe to be used when naming
105 // service is not used (for simple testing)
107 /// The number of arguments passed on the command line.
108 int argc_;
110 /// The arguments from the command line.
111 ACE_TCHAR **argv_;
113 /// Flag to tell the client whether to use the naming service or not
114 /// to find the concurrency control factory.
115 int use_naming_service_;
117 /// flag to tell which test should be run.
118 int run_basic_tests_;
120 /// flag to tell which test should be run.
121 int run_extended_tests_;
123 /// Parameters to the extended tests. The parameters are of the
124 /// following format: <test>:<parm1>:<parm2>...
125 ACE_TCHAR *extended_tests_params_;
127 /// Flag to tell whethter to use a script file to run the tests.
128 int use_script_file_;
130 /// The script file to run
131 ACE_TCHAR *script_file_;
133 /// Prints out the options to the program.
134 void print_usage (void);
136 #endif /* !defined (_CC_CLIENT_H_) */