1 j.alex 1.1.2.1 //%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.1.2.1 // 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 j.alex 1.1.2.2 // Author: Aruran (aruran.shanmug@in.ibm.com) & Melvin (msolomon@in.ibm.com),
33 // IBM for PEP# 241
|
34 j.alex 1.1.2.1 // 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 #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
|
55 j.alex 1.1.2.2 #ifdef PEGASUS_OS_TYPE_WINDOWS
56 #include <windows.h> /* DWORD etc. */
57 typedef DWORD pid_t;
58 #include <process.h> /* getpid() and others. */
|
59 j.alex 1.1.2.1 #elif !defined(PEGASUS_OS_OS400)
|
60 j.alex 1.1.2.2 #include <unistd.h>
|
61 j.alex 1.1.2.1 #endif
62
63 #ifdef PEGASUS_PLATFORM_SOLARIS_SPARC_CC
|
64 j.alex 1.1.2.2 #include <iostream.h>
|
65 j.alex 1.1.2.1 #endif
66
67 #define SIXTYSECONDS 60
68 #define MILLISECONDS 1000
69 #define CHECKUP_INTERVAL 0.8
70 #define convertmin2millisecs(x) ((x * SIXTYSECONDS * MILLISECONDS))
71
72 PEGASUS_NAMESPACE_BEGIN
73
|
74 j.alex 1.1.2.2 /** StressTest Client Status types. */
|
75 j.alex 1.1.2.1 enum CStatus
76 {
77 CLIENT_PASS,
78 CLIENT_FAIL,
79 CLIENT_UNKNOWN
80 };
81
|
82 j.alex 1.1.2.2 #ifndef PEGASUS_STRESSTESTCLIENT_LINKAGE
83 # ifdef PEGASUS_OS_TYPE_WINDOWS
84 # ifdef PEGASUS_STRESSTESTCLIENT_INTERNAL
85 # define PEGASUS_STRESSTESTCLIENT_LINKAGE PEGASUS_EXPORT
86 # else
87 # define PEGASUS_STRESSTESTCLIENT_LINKAGE PEGASUS_IMPORT
88 # endif
89 # else
90 # define PEGASUS_STRESSTESTCLIENT_LINKAGE
91 # endif
92 #endif
93
94 /** The TestStressTestClient class holds the common functionality for all the
95 stress test clients.
96 */
97 class PEGASUS_STRESSTESTCLIENT_LINKAGE TestStressTestClient
|
98 j.alex 1.1.2.1 {
99 public:
100 /** Constructor. */
101 TestStressTestClient();
102
|
103 j.alex 1.1.2.2 /* This method is use to get all the options that are passed through
104 command line.
105 */
106 int GetOptions(
107 OptionManager& om,
108 int& argc,
109 char** argv,
110 OptionRow* clientOptionsTable,
111 Uint32 clientOptionCount);
112
113 /** This method is used by clients to register client specific required
114 options to the option table. All these options are taken as mandatory
115 one.
|
116 j.alex 1.1.2.1 */
117 OptionRow* generateClientOptions(
|
118 j.alex 1.1.2.2 OptionRow* clientOptionsTable,
119 Uint32 clientOptionCount,
120 Uint32& totalOptionCount);
121
122 /** This method is used by the clients to connect to the server. If useSSL
123 is true then an SSL connection will be atemped with the userName and
124 passWord that is passed in. If localConnection is true a connectLocal
125 connection will be attempted. All parameters are required.
|
126 j.alex 1.1.2.1 */
|
127 j.alex 1.1.2.2 void connectClient(
|
128 j.alex 1.1.2.1 CIMClient *client,
129 String host,
130 Uint32 portNumber,
131 String userName,
132 String passWord,
133 Boolean useSSL,
134 Uint32 timeout,
135 Boolean verboseTest);
136
|
137 j.alex 1.1.2.2 /** This method is used by the clients to log information which are
138 required for controller reference. It logs the inofrmation with
139 Client ID and status of the client in the PID File log file.
140 */
141 void logInfo(
142 String clientId,
143 pid_t clientPid,
144 int clientStatus,
145 String &pidFile);
|
146 j.alex 1.1.2.1
|
147 j.alex 1.1.2.2 /** This method is used to take the client process start time. */
|
148 j.alex 1.1.2.1 void startTime();
149
|
150 j.alex 1.1.2.2 /** This method is used to check the time stamp for logging information
151 about the success or failure.
|
152 j.alex 1.1.2.1 */
153 Boolean checkTime();
154
|
155 j.alex 1.1.2.2 /** This method is used to log the information about the client's success
156 or failure percentage at a specific interval of time.
|
157 j.alex 1.1.2.1 */
|
158 j.alex 1.1.2.2 void logErrorPercentage(
159 Uint32 successCount,
160 Uint32 totalCount,
161 pid_t clientPid,
162 String &clientLog,
163 char client[]);
|
164 j.alex 1.1.2.1
|
165 j.alex 1.1.2.2 /** This method is used to log the informations of client logs to the
166 client log file.
|
167 j.alex 1.1.2.1 */
|
168 j.alex 1.1.2.2 void errorLog(pid_t clientPid, String &clientLog, String &message);
|
169 j.alex 1.1.2.1
|
170 j.alex 1.1.2.2 /** Timer details. */
|
171 j.alex 1.1.2.1 Uint64 startMilliseconds;
172 Uint64 nowMilliseconds;
173 Uint64 nextCheckupInMillisecs;
174 struct OptionRow *optionsTable;
175 Uint32 optionCount;
176 };
177 PEGASUS_NAMESPACE_END
|
178 j.alex 1.1.2.2 #endif /* TestStressTestClient_h */
|