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