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