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 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef TestStressTestClient_h
33 #define TestStressTestClient_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/Constants.h>
37 #include <Pegasus/Common/TLS.h>
38 #include <Pegasus/Common/CIMName.h>
39 #include <Pegasus/Common/FileSystem.h>
40 #include <Pegasus/Common/Exception.h>
41 #include <Pegasus/Common/XmlWriter.h>
42 #include <Pegasus/Common/Signal.h>
43 #include <Pegasus/Common/Exception.h>
44 #include <Pegasus/Common/TimeValue.h>
|
45 thilo.boehm 1.8
46 #include <Pegasus/General/OptionManager.h>
47
48 #include <Pegasus/Client/CIMClient.h>
49
|
50 j.alex 1.2 #include <signal.h>
51 #include "Linkage.h"
52
53 #ifdef PEGASUS_OS_TYPE_WINDOWS
54 // DWORD etc.
|
55 kumpf 1.7 # include <windows.h>
|
56 j.alex 1.2 typedef DWORD pid_t;
57 // getpid() and others.
|
58 kumpf 1.4 # include <process.h>
|
59 kumpf 1.7 #else
|
60 kumpf 1.4 # include <unistd.h>
|
61 j.alex 1.2 #endif
62
63 #ifdef PEGASUS_PLATFORM_SOLARIS_SPARC_CC
|
64 kumpf 1.4 # include <iostream.h>
|
65 j.alex 1.2 #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 kumpf 1.7 /**
|
75 j.alex 1.2 StressTest Client Status types.
76 */
77 enum CStatus
78 {
79 CLIENT_PASS,
80 CLIENT_FAIL,
81 CLIENT_UNKNOWN
82 };
83
84 /** The TestStressTestClient class holds the common functionality for all the
85 stress test clients.
86 */
87 class PEGASUS_STRESSTESTCLIENT_LINKAGE TestStressTestClient
88 {
89 public:
|
90 kumpf 1.7 /**
|
91 j.alex 1.2 Constructor.
92 */
93 TestStressTestClient();
94
95 /**
96 This method is used to get all the options that are passed through
97 command line.
98 */
99 int GetOptions(
100 OptionManager& om,
101 int& argc,
102 char** argv,
103 OptionRow* clientOptionsTable,
104 Uint32 clientOptionCount);
105
|
106 kumpf 1.7 /**
|
107 j.alex 1.2 This method is used by clients to register client specific required
108 options to the option table. All these options are taken as mandatory
109 one.
110 */
111 OptionRow* generateClientOptions(
112 OptionRow* clientOptionsTable,
113 Uint32 clientOptionCount,
114 Uint32& totalOptionCount);
115
|
116 kumpf 1.7 /**
|
117 j.alex 1.2 This method is used by the clients to connect to the server. If useSSL
118 is true then an SSL connection will be atemped with the userName and
119 passWord that is passed in. If localConnection is true a connectLocal
|
120 kumpf 1.7 connection will be attempted. All parameters are required.
|
121 j.alex 1.2 */
122 void connectClient(
123 CIMClient *client,
124 String host,
125 Uint32 portNumber,
126 String userName,
127 String passWord,
128 Boolean useSSL,
129 Uint32 timeout,
130 Boolean verboseTest);
131
|
132 kumpf 1.7 /**
|
133 j.alex 1.2 This method is used by the clients to log information which are
134 required for controller reference. It logs the inofrmation with
135 Client ID and status of the client in the PID File log file.
136 */
137 void logInfo(
138 String clientId,
139 pid_t clientPid,
140 int clientStatus,
141 String &pidFile);
142
|
143 kumpf 1.7 /**
144 This method is used to take the client process start time.
|
145 j.alex 1.2 */
146 void startTime();
147
|
148 kumpf 1.7 /**
|
149 j.alex 1.2 This method is used to check the time stamp for logging information
150 about the success or failure.
151 */
152 Boolean checkTime();
153
|
154 kumpf 1.7 /**
|
155 j.alex 1.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 */
158 void logErrorPercentage(
159 Uint32 successCount,
160 Uint32 totalCount,
161 pid_t clientPid,
162 String &clientLog,
163 char client[]);
164
|
165 kumpf 1.7 /**
|
166 j.alex 1.2 This method is used to log the informations of client logs to the
167 client log file.
168 */
169 void errorLog(pid_t clientPid, String &clientLog, String &message);
|
170 kumpf 1.7
|
171 j.alex 1.2 /**
|
172 kumpf 1.7 Timer details.
|
173 j.alex 1.2 */
174 Uint64 startMilliseconds;
175 Uint64 nowMilliseconds;
176 Uint64 nextCheckupInMillisecs;
177 struct OptionRow *optionsTable;
178 Uint32 optionCount;
179 };
180 PEGASUS_NAMESPACE_END
181 #endif /* TestStressTestClient_h */
|