1 j.alex 1.2 //%2006////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 j.alex 1.2 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 // Author: Aruran (aruran.shanmug@in.ibm.com) & Melvin (msolomon@in.ibm.com),
33 // IBM for PEP# 241
34 // Modified By:
35 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38 #ifndef TestStressTestClient_h
39 #define TestStressTestClient_h
40
41 #include <Pegasus/Common/Config.h>
42 #include <Pegasus/Common/Constants.h>
43 j.alex 1.2 #include <Pegasus/Common/TLS.h>
44 #include <Pegasus/Common/CIMName.h>
45 #include <Pegasus/Common/OptionManager.h>
46 #include <Pegasus/Common/FileSystem.h>
47 #include <Pegasus/Common/Exception.h>
48 #include <Pegasus/Common/XmlWriter.h>
49 #include <Pegasus/Client/CIMClient.h>
50 #include <Pegasus/Common/Signal.h>
51 #include <Pegasus/Common/Exception.h>
52 #include <Pegasus/Common/TimeValue.h>
53 #include <signal.h>
54 #include "Linkage.h"
55
56 #ifdef PEGASUS_OS_TYPE_WINDOWS
57 // DWORD etc.
|
68 j.alex 1.2 #endif
69
70 #define SIXTYSECONDS 60
71 #define MILLISECONDS 1000
72 #define CHECKUP_INTERVAL 0.8
73 #define convertmin2millisecs(x) ((x * SIXTYSECONDS * MILLISECONDS))
74
75 PEGASUS_NAMESPACE_BEGIN
76
77 /**
78 StressTest Client Status types.
79 */
80 enum CStatus
81 {
82 CLIENT_PASS,
83 CLIENT_FAIL,
84 CLIENT_UNKNOWN
85 };
86
87 /** The TestStressTestClient class holds the common functionality for all the
88 stress test clients.
89 j.alex 1.2 */
90 class PEGASUS_STRESSTESTCLIENT_LINKAGE TestStressTestClient
91 {
92 public:
93 /**
94 Constructor.
95 */
96 TestStressTestClient();
97
98 /**
99 This method is used to get all the options that are passed through
100 command line.
101 */
102 int GetOptions(
103 OptionManager& om,
104 int& argc,
105 char** argv,
106 OptionRow* clientOptionsTable,
107 Uint32 clientOptionCount);
108
109 /**
110 j.alex 1.2 This method is used by clients to register client specific required
111 options to the option table. All these options are taken as mandatory
112 one.
113 */
114 OptionRow* generateClientOptions(
115 OptionRow* clientOptionsTable,
116 Uint32 clientOptionCount,
117 Uint32& totalOptionCount);
118
119 /**
120 This method is used by the clients to connect to the server. If useSSL
121 is true then an SSL connection will be atemped with the userName and
122 passWord that is passed in. If localConnection is true a connectLocal
123 connection will be attempted. All parameters are required.
124 */
125 void connectClient(
126 CIMClient *client,
127 String host,
128 Uint32 portNumber,
129 String userName,
130 String passWord,
131 j.alex 1.2 Boolean useSSL,
132 Uint32 timeout,
133 Boolean verboseTest);
134
135 /**
136 This method is used by the clients to log information which are
137 required for controller reference. It logs the inofrmation with
138 Client ID and status of the client in the PID File log file.
139 */
140 void logInfo(
141 String clientId,
142 pid_t clientPid,
143 int clientStatus,
144 String &pidFile);
145
146 /**
147 This method is used to take the client process start time.
148 */
149 void startTime();
150
151 /**
152 j.alex 1.2 This method is used to check the time stamp for logging information
153 about the success or failure.
154 */
155 Boolean checkTime();
156
157 /**
158 This method is used to log the information about the client's success
159 or failure percentage at a specific interval of time.
160 */
161 void logErrorPercentage(
162 Uint32 successCount,
163 Uint32 totalCount,
164 pid_t clientPid,
165 String &clientLog,
166 char client[]);
167
168 /**
169 This method is used to log the informations of client logs to the
170 client log file.
171 */
172 void errorLog(pid_t clientPid, String &clientLog, String &message);
173 j.alex 1.2
174 /**
175 Timer details.
176 */
177 Uint64 startMilliseconds;
178 Uint64 nowMilliseconds;
179 Uint64 nextCheckupInMillisecs;
180 struct OptionRow *optionsTable;
181 Uint32 optionCount;
182 };
183 PEGASUS_NAMESPACE_END
184 #endif /* TestStressTestClient_h */
|