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 j.alex 1.1.2.3 #include "Linkage.h"
|
55 j.alex 1.1.2.1
|
56 j.alex 1.1.2.2 #ifdef PEGASUS_OS_TYPE_WINDOWS
|
57 j.alex 1.1.2.3 // DWORD etc.
58 #include <windows.h>
|
59 j.alex 1.1.2.2 typedef DWORD pid_t;
|
60 j.alex 1.1.2.3 // getpid() and others.
61 #include <process.h>
|
62 j.alex 1.1.2.1 #elif !defined(PEGASUS_OS_OS400)
|
63 j.alex 1.1.2.2 #include <unistd.h>
|
64 j.alex 1.1.2.1 #endif
65
66 #ifdef PEGASUS_PLATFORM_SOLARIS_SPARC_CC
|
67 j.alex 1.1.2.2 #include <iostream.h>
|
68 j.alex 1.1.2.1 #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 j.alex 1.1.2.3 /**
78 StressTest Client Status types.
79 */
|
80 j.alex 1.1.2.1 enum CStatus
81 {
82 CLIENT_PASS,
83 CLIENT_FAIL,
84 CLIENT_UNKNOWN
85 };
86
|
87 j.alex 1.1.2.2 /** The TestStressTestClient class holds the common functionality for all the
88 stress test clients.
89 */
90 class PEGASUS_STRESSTESTCLIENT_LINKAGE TestStressTestClient
|
91 j.alex 1.1.2.1 {
92 public:
|
93 j.alex 1.1.2.3 /**
94 Constructor.
95 */
|
96 j.alex 1.1.2.1 TestStressTestClient();
97
|
98 j.alex 1.1.2.3 /**
99 This method is used to get all the options that are passed through
|
100 j.alex 1.1.2.2 command line.
101 */
102 int GetOptions(
103 OptionManager& om,
104 int& argc,
105 char** argv,
106 OptionRow* clientOptionsTable,
107 Uint32 clientOptionCount);
108
|
109 j.alex 1.1.2.3 /**
110 This method is used by clients to register client specific required
|
111 j.alex 1.1.2.2 options to the option table. All these options are taken as mandatory
112 one.
|
113 j.alex 1.1.2.1 */
114 OptionRow* generateClientOptions(
|
115 j.alex 1.1.2.2 OptionRow* clientOptionsTable,
116 Uint32 clientOptionCount,
117 Uint32& totalOptionCount);
118
|
119 j.alex 1.1.2.3 /**
120 This method is used by the clients to connect to the server. If useSSL
|
121 j.alex 1.1.2.2 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 j.alex 1.1.2.1 */
|
125 j.alex 1.1.2.2 void connectClient(
|
126 j.alex 1.1.2.1 CIMClient *client,
127 String host,
128 Uint32 portNumber,
129 String userName,
130 String passWord,
131 Boolean useSSL,
132 Uint32 timeout,
133 Boolean verboseTest);
134
|
135 j.alex 1.1.2.3 /**
136 This method is used by the clients to log information which are
|
137 j.alex 1.1.2.2 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 j.alex 1.1.2.1
|
146 j.alex 1.1.2.3 /**
147 This method is used to take the client process start time.
148 */
|
149 j.alex 1.1.2.1 void startTime();
150
|
151 j.alex 1.1.2.3 /**
152 This method is used to check the time stamp for logging information
|
153 j.alex 1.1.2.2 about the success or failure.
|
154 j.alex 1.1.2.1 */
155 Boolean checkTime();
156
|
157 j.alex 1.1.2.3 /**
158 This method is used to log the information about the client's success
|
159 j.alex 1.1.2.2 or failure percentage at a specific interval of time.
|
160 j.alex 1.1.2.1 */
|
161 j.alex 1.1.2.2 void logErrorPercentage(
162 Uint32 successCount,
163 Uint32 totalCount,
164 pid_t clientPid,
165 String &clientLog,
166 char client[]);
|
167 j.alex 1.1.2.1
|
168 j.alex 1.1.2.3 /**
169 This method is used to log the informations of client logs to the
|
170 j.alex 1.1.2.2 client log file.
|
171 j.alex 1.1.2.1 */
|
172 j.alex 1.1.2.2 void errorLog(pid_t clientPid, String &clientLog, String &message);
|
173 j.alex 1.1.2.3
174 /**
175 Timer details.
176 */
|
177 j.alex 1.1.2.1 Uint64 startMilliseconds;
178 Uint64 nowMilliseconds;
179 Uint64 nextCheckupInMillisecs;
180 struct OptionRow *optionsTable;
181 Uint32 optionCount;
182 };
183 PEGASUS_NAMESPACE_END
|
184 j.alex 1.1.2.2 #endif /* TestStressTestClient_h */
|