1.***************************************************************************
2.* Software Testing Automation Framework (STAF)
3.* (C) Copyright IBM Corp. 2001
4.*
5.* This software is licensed under the Eclipse Public License (EPL) V1.0.
6.****************************************************************************
7
8.*************************-START-OF-PROLOG-****************************
9.*
10.*  File Name          : Overview SCRIPT
11.*  Descriptive Name   : Software Test Automation Framework Overview
12.*  Detail:
13.*
14.*     This file contains an overview of STAF.
15.*
16.**************************-END-OF-PROLOG-*****************************
17:ih1.handles
18:i2.concepts
19:h1 id=concepts.Concepts
20:h2 id=hndlcon.Handles
21:p.A handle is a unique identifier, representing a given process.  This
22handle is used when submitting requests to STAF.  This handle, combined with
23the machine name, uniquely identifies a particular process in the STAF
24Environment.  It is this combination of machine/handle that allows
25services to track requests from multiple processes on different machines.
26:p.In order to submit service requests to STAF, a process must have a handle.
27Thus, the first thing a process should do is register with STAF to obtain a
28handle.  Other data tied to this handle is the following:
29:ul compact.
30:li.Name - a descriptive name associated with the handle, which is specified
31when a process registers with STAF.
32:li.Last used date/time - a timestamp of the last time the handle was used to
33submit a request.
34:li.User authentication information - user authentication information
35associated with the handle if the handle has been authenticated
36:li.Variable pool - a means by which to store and retrieve information that the
37process may use, such as configuration data.
38:li.Queue - a priority queue used for interprocess communication between other
39processes/machines using STAF.
40:eul.
41:p.Before a process exits it should unregister with STAF to free up any
42resources used by that handle.
43:note.Handle 1 is always allocated to the STAF Process itself.  The name
44associated with this handle is STAF_Process.
45:p.
46If STAFProc is shutdown on a machine (or the machine is rebooted), STAF handles
47for that machine are deleted.
48:p.
49The SEM and RESPOOL services perform garbage collection for handles that have
50been deleted by default, unless you specified no garbage collection when
51requesting a mutex semaphore or resource pool entry.  Performing garbage
52collection means that when a handle is deleted, any mutex semaphores or
53resource pool entries owned by the handle will be released and any pending
54requests submitted by the handle will be removed.
55.*
56.*---------------------------------------------------------------------
57.*
58:ih1.services
59:ih2.general
60:i3.concepts
61:h2 id=srvcon.Services
62:p.Services are what provide all the capability in STAF.  Services may be
63internal services, in which case, the executable code for the service resides
64within STAFProc.  Services may also be external services, in which case, the
65executable code for the service resides outside of STAFProc, for example, in
66a Java routine.
67:p.Services are known by their name, such as PROCESS or LOG.  Internal
68services are always available and have a fixed name.  External services must
69be registered, and the name by which they are known is specified when they are
70registered.  If an external service is not registered with STAF, then the
71service is not available on that STAF Client.
72:p.Services may also be delegated to another STAF Client.  In this case, when
73a request is made for the service on the local STAF Client, it is automatically
74forwarded to the machine to which this service has been delegated.  For example,
75a testcase may request the local machine to log some information via the LOG
76service.  If the LOG service has been delegated to another machine, the
77LOG request will actually be handled by the machine to which logging has
78been delegated.  In this way, all logs could be conveniently stored on one
79system, without the testcases needing to explicitly send their LOG requests
80to the common system.  In a similar manner, if a service were only available
81on a specific operating system, then all testcases could assume that the
82service was available locally, when, in fact, the service was being delegated
83to the machine running the required operating system.
84:note.Internal services may not be delegated.
85:p.External services and delegated services are both registered in the STAF
86Configuration File.  External services also may be dynamically added (registered)
87or removed (unregistered and terminated)
88.*replaced, or renamed
89via the SERVICE service (see :hdref refid=srvService.).
90:ih1.services
91:i2.service loader
92:i1.Service loader registration
93:p.Service loaders are external services whose purpose is to load services on-demand.
94They allow services to be loaded only when they have been requested,
95so they don't take up memory until needed.
96They also allow dynamic service registration when a request is made so that
97you don't have to change the STAF configuration file to register a
98service.
99:p.When a request is encountered for a service that doesn't exist,
100STAF will call each service loader, in the order they were
101configured, until the service exists or we run out of service loaders.
102If we run out of service loaders, then the standard
103RC 2 (DoesNotExist) will be returned indicating that the service is not registered.
104Otherwise, the request will be sent to the newly added service.
105If a service is currently being attempted to be loaded by a service loader,
106any requests submitted to the service while it's being loaded will wait
107until the attempt to load the service has completed.  If the service was loaded,
108the request will be sent to the newly added service.  If the service wasn't loaded,
109RC 2 (DoesNotExist) will be returned indicating that the service is not registered.
110:p.STAF ships two service loader services:
111:ol.
112:li.A default service loader service called STAFDSLS which is written in C++ and
113can dynamically load the Log, Zip, Monitor, and ResPool C++ services.  This service
114loader is configured automatically in the default STAF.cfg file.
115See section :hdref refid=STAFDSLS. for more information about the default
116service loader service.
117:li.A HTTP service loader service called STAFHTTPSLS which is written in Java and
118can dynamically load any STAF services written in Java.  It can download the
119jar file for a STAF Java service (or a zip file that contains the jar file)
120from a web server or from a file on the local machine.  It uses a configuration
121file to determine what services it can load.  This service loader service can
122reduce the maintenance for managing STAF Java services.
123See section :hdref refid=STAFHTTPSLS. for more information about the HTTP
124service loader service.
125:eol.
126
127:ih1.services
128:i2.authenticator
129:p.Authenticators are special external services whose purpose is to
130authenticate users in order to provide user level trust, which can be used
131in addition (or instead of) machine level trust.  An Authenticator is a
132special service that accepts an authenticate request.  As a user, you
133cannot directly submit a request to an authenticator service.
134Authenticators are accessed indirectly via the Handle service.
135:p.Authenticators can only be registered in the STAF configuration file --
136they cannot be dynamically registered.  One or more Authenticators can be
137registered.  The first Authenticator registered is the default, unless
138overridden by using the DEFAULTAUTHENTICATOR operational parameter.
139If you want to authenticate across systems, you must register the
140Authenticator on each system using the same name (case-insensitive).
141.*
142.*---------------------------------------------------------------------
143.*
144:ih1.workload
145:i2.concepts
146:h2 id=wkldcon.Workloads
147:p.A workload is a set of processes running on a set of machines.  A workload
148may be as simple as a single process running on a single machine, or it may be
149as complex as multiple processes on multiple machines coordinating together to
150perform a larger complex task.  STAF was designed to help the creation and
151automation of workloads of all sizes.
152.*
153.*---------------------------------------------------------------------
154.*
155:ih1.variables
156:i2.concepts
157:h2 id=varcon.Variables
158:p.STAF provides a means to store and retrieve variables.  These variables
159may be used for any purpose the tester desires, such as storing testcase
160configuration parameters.  These variables provide two main capabilities
161to testcase writers.  One, they provide a standard means by which to store
162configuration data, i.e., each tester doesn't have to figure out how to store
163and retrieve said configuration data.  Two, these variables may be changed
164dynamically.  For example, if a testcase queries the WebServer variable
165before sending a request off to the web server, and that web server goes down,
166the WebServer variable can be dynamically changed by the tester to refer to a
167different web server, and the testcase can continue execution.  Note how STAF
168allows the variable's value to be changed outside of the scope of the running
169testcase, thus allowing the testcase to continue execution without needing to
170be stopped and restarted.
171:p.STAF maintains a "system" variable pool that is common to all
172the processes on a given STAF Client.
173STAF also maintains a "shared" variable pool which is also system-wide,
174but which will be sent across the network and used in variable resolution
175on remote systems.
176In addition, each process/handle has its own variable pool.
177By default, the values of variables in a process' variable pool override the
178values of variables in the system and shared variable pools.  However, the
179process may override this behavior when asking for the value of a variable.
180Basically, as part of every remote request, the originating handle and system
181shared variable pools are sent across the wire. These pools are stored only for
182the duration of the request for use in variable resolution.
183:i2.predefined
184:p.The following system variables are predefined:
185:ul compact.
186:li.STAF/Config/BootDrive - Indicates the drive from which the machine was
187booted
188:li.STAF/Config/CodePage - The codepage used by STAF
189:li.STAF/Config/ConfigFile - The configuration file used to start STAF
190:li.STAF/Config/DefaultAuthenticator - The default authenticator.  If no
191authenticators are registered, it's value is "none".
192:li.STAF/Config/DefaultInterface - The default interface.  If no
193network interfaces are registered, it's value is "local" to show that
194the local interface is the only interface available.
195:li.STAF/Config/InstanceName - The name of this STAF instance.  The default
196is STAF if the STAF_Instance_Name environment variable is not specified.
197:li.STAF/Config/Machine - The name of this machine
198:li.STAF/Config/MachineNickname - The nickname for this machine.  This defaults
199to the same value as STAF/Config/Machine unless overridden using the MACHINENICKNAME
200configuration setting.
201:li.STAF/Config/Mem/Physical/Bytes - The amount of physical memory in bytes.
202Note: The value is 0 on z/OS because STAF cannot determine
203the physical memory on this operating system.
204:li.STAF/Config/Mem/Physical/KB - The amount of physical memory in kilobytes.
205Note: The value is 0 on z/OS because STAF cannot determine
206the physical memory on this operating system.
207:li.STAF/Config/Mem/Physical/MB - The amount of physical memory in megabytes.
208Note: The value is 0 on z/OS because STAF cannot determine
209the physical memory on this operating system.
210:li.STAF/Config/OS/Name - The name of the operating system, e.g.
211WinXP, WinSrv2008, Linux, AIX, SunOS, HP-UX, Darwin
212:li.STAF/Config/OS/MajorVersion - This is operating system specific
213:li.STAF/Config/OS/MinorVersion - This is operating system specific
214:li.STAF/Config/OS/Revision - This is operating system specific
215:li.STAF/Config/Processor/NumAvail - The number of available processors.
216Note: The value is 0 on z/OS because STAF cannot determine
217the number of available processors on this operating system.
218:li.STAF/Config/Sep/Command - The character(s) used to separate multiple
219commands concatenated together in a single line
220:li.STAF/Config/Sep/File - The character(s) used to separate files and
221directories in a path
222:li.STAF/Config/Sep/Line - The character(s) used to separate lines in a text
223file
224:li.STAF/Config/Sep/Path - The character(s) used to separate paths in a path
225list
226:li.STAF/Config/STAFRoot - The directory in which STAF is installed
227:li.STAF/DataDir - The directory that STAF and its services use to write data
228(based on the DATADIR operational parameter)
229:li.STAF/Env/* - All environment variables accessible via STAF
230:li.STAF/Version - The version of STAF installed
231:eul.
232:p.
233:h3 id=varconbasics.The Basics of Variable References
234:p.
235To substitute a variable's value, write the name of the variable in curly braces:
236"{STAF/Config/OS/Name}" is a valid reference to the variable STAF/Config/OS/Name.
237Assuming STAF/Config/OS/Name=Win2000, string "Operating system is {STAF/Config/OS/Name}"
238resolves to "Operating system is Win2000".
239:p.
240Variable references can be used in many places when submitting a STAF request.
241For example:
242:ul compact.
243:li.When submitting a request to any service, the machine
244name and service name can contain STAF variables.
245:li.When using the Variable service, the string being resolved can contain STAF variables.
246:li.When starting a process via the Process service, the values of any of its request options
247can contain STAF variables.
248:li.When logging a message via the Log service, the value of the message can contain
249STAF variables.
250:eul.
251:p.
252See section :hdref refid=varservice. for more information on setting and resolving
253variables.
254.*
255.*---------------------------------------------------------------------
256.*
257:i1.security
258:h2 id=trstcon.Security
259:p.Security in STAF can be defined at the machine level and/or the user level.
260In other words, you grant access to machines and/or to userids.
261Access in STAF is granted by specifying a certain trust level for a machine or
262user, where trust level 0 indicates no access and trust level 5 indicates all access.
263Each service in STAF defines what trust level is required in order to use the various
264functions the service provides.
265:ih1.trust
266:i2.levels
267:p.A basic description of each level follows
268:ul compact.
269:li.Level 0 - No access
270:li.Level 1 - Restricted access.  Only PING and helps available.
271:li.Level 2 - Limited access.  Only query/view facilities available.
272:li.Level 3 - Standard access.  Non-destructive updates allowed, e.g., logging.
273:li.Level 4 - Advanced access.  Update abilities, e.g., copying files, deleting
274log files.
275:li.Level 5 - All access, e.g., SHUTDOWN, Process invocation, Trust definition
276manipulation
277:eul.
278:p.In order to use user trust security in STAF, you must have at least
279one authenticator registered.
280:note.The local machine can be granted a trust level by specifying
281interface "local" and a system identifier of "local".
282:p.User authentication overrides machine authentication.  For example,
283if the machine trust level is 3 and the authenticated user has a trust
284level of 4, then the handle will have a trust level of 4.
285If the user has been authenticated, but there are no user authentication
286trust matches, the machine trust level is used.  If there is no machine
287trust level specified, then the default trust level is used.
288.*
289.*---------------------------------------------------------------------
290.*
291:ih1.queues
292:i2.concepts
293:h2 id=queuecon.Queues
294:p.Each handle in STAF has a priority queue associated with it.  This queue
295is used to accept/retrieve messages from other processes/machines.  Each
296message in the queue has the following data associated with it.
297:ul compact.
298:li.Priority - An unsigned long value (0 - 4294967296) representing the
299importance of the message, with 0 representing the most important message
300:li.Timestamp - The date/time the message was received
301:li.Machine - The machine which sent the message
302:li.Process name - The registered name of the process which sent the message
303:li.Handle - The handle of the process which sent the message
304:li.Message - The actual message itself
305:eul.
306:p.STAF allows you to register to receive notifications for certain events,
307such as STAF starting and shutting down.  These events will appear in the
308queue of the requesting process.  They will reveal the originating handle as
309handle 1 of the originating machine, which is the reserved STAF Process handle.
310.*
311.*---------------------------------------------------------------------
312.*
313:ih1.codepage
314:i2.concepts
315:ih1.strings
316:i2.concepts
317:h2 id=stringcon.Strings and Codepages
318:p.The requests submitted to STAF and the results received from STAF are all
319strings.  These strings may contain any arbitrary set of characters, including
320the NULL (i.e., 0) character.  When working in an environment with a
321heterogeneous set of codepages, STAF will translate the request and result
322strings from and to the necessary codepages.  This ensures that the request and
323result strings are not misinterpreted by the receiver.
324:p.
325In general, when using STAF services, there shouldn't be any round trip problems.
326"Round trip" in this context means when all requests are originating from the
327same system, even if the requests are sent to, and the data is stored on, a system
328with a different codepage.  However, if you send, for example, a request to log
329data containing Japanese codepage specific characters to any system and then
330query the log from a system using a US English codepage, you won't get the
331"correct" data, as that is not a valid "round trip".
332:note.All STAF generated strings are composed of only ASCII-7 characters and
333will safely survive the translation from/to different codepages.
334.* XXX: Commented out since don't support REXX in STAF V3
335.*:note text=Caution.If you use a STAF service that is written in REXX, it
336.*can have round trip codepage translation problems.  All of STAF services
337.*currently provided are written in C++/Java so they do not have this problem.
338:p.
339:h3.Windows Codepage Translation Anomalies
340:p.
341If you need to specify non-ASCII characters in  a request, then you need to be
342aware of some anomalies if your target system is a Windows system that isn't
343using an English codepage and whose ANSI codepage (ACP) identifier is different
344from the OEM codepage (OEMCP) identifier.  The system locale determines which
345codepages are defaults for the Windows system.  However, some European locales
346such as French and German set different values for the ACP and OEMCP.
347By default, STAF uses the OEM codepage when doing codepage translation.
348But, depending on where the data is input, it may be necessary to tell STAF
349to use the ANSI codepage.  The ANSI codepage is used in the window manager
350and graphics device interface and by many applications.  However, the Windows
351command line and bat files use the OEM codepage as they are interpreted by
352cmd.exe.  You can use CHCP to display or change the codepage used by the
353command line.  Note that these anomalies occur only on Windows systems.
354:p.
355To avoid these Windows codepage anomalies, you may need to change the codepage
356used by STAF using one of these methods:
357:p.
358:ul.
359:li.Change the OEMCP value to be set to the same data as the ACP value in the
360Windows Registry.  You can use REGEDIT to start the Windows Registry Editor
361and select Edit->Find and type in ACP to find its value data and then do the
362same for OEMCP to find its value data.  Assuming they are different, you
363could change the value data for OEMCP to be the same as the value data for
364ACP by highlighting OEMCP and selecting Edit->Modify and enter the new value
365data for OEMCP and then exit the REGEDIT program.  The system must be
366rebooted for the registry change to take effect.  Also, if the system is
367abnormally rebooted, it's possible that the Windows operating system may
368reset the registry value.  This is the recommended method.
369:note text=Caution.You should NOT change the ACP value to the OEMCP value.
370:p.
371:li.Or, you can override the codepage used by STAF by setting the
372STAFCODEPAGEOVERRIDE environment variable to the ANSI codepage and then
373start STAFProc.
374:eul.
375:note.To see the codepage that STAF is using, check the value of
376STAF variable STAF/Config/CodePage.  For example:
377:xmp.    STAF testmach1 VAR RESOLVE STRING {STAF/Config/CodePage}:exmp.
378
379:p.
380:h3 id=FSGetFileConverterError.Codepage Converter Error on a FS GET FILE Request
381:p.
382On a GET FILE request to the FS service (or on another service request that
383submits a GET FILE request to the FS service like the STAX service does on
384an EXECUTE FILE request), RC 39 (Converter Error) is returned if the file
385contains data that is not valid in the codepage that STAF is using.
386To see the codepage that STAF is using, check the value of STAF variable
387STAF/Config/CodePage as discussed in the previous section.
388:p.
389To resolve an RC 39 (Converter Error) on a GET FILE request to the FS service,
390either:
391:ul.
392:li.Change the file contents to only use data that is valid in the codepage
393used by STAF, or
394:li.Override the codepage used by STAF by setting the STAFCODEPAGEOVERRIDE
395environment variable to a codepage that does support the data in the file
396and then re-start STAFProc.
397:eul.
398