Data Source Adapter Commands
Data Source Adapter Commands
SettingsFile
This data source adapter can be used to work on files that contain settings specified by key/value pairs. That is, Java properties files, Java manifest files and Windows ini files.
Attribues
The following table lists all attributes that can be used with this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
name | Contains the name of the file to work on. | required |
type |
Specifies the the type of the file. Currently the following
values are supported:
|
required |
Example
<?xml version="1.0" encoding="ISO-8859-1" ?> <Instructions version="1"> <Set name="testdata.dir">testdata</Set> <Set name="BasePath">{testdata.dir}/ini</Set> <SettingsFile name="{BasePath}/sample1.ini" type="ini" label="Base Configuration" id="I01" case-sensitive="no"> <AssertEquals id="AE01" element="[Configuration]/Editor">notepad.exe</AssertEquals> <AssertExistence id="AX01" element="[Packer]/InternalUnzip"/> <ReportValue id="RV01" element="[Packer]/ZIP"/> <AssertGreater id="AG01" element="[1280x1024 (8x16)]/divider">400</AssertGreater> <ReportValue id="RV02" element="[1280x1024 (8x16)]/divider"/> </SettingsFile> </Instructions>
TextFile
This data source adapter can be used to check text files.
In general it allows to search for specific text lines in
a file and check the found line(s) against a pattern.
Another useful feature is to check the line-end convention
(i.e. LF or CRLF).
Attribues
The following table lists all attributes that can be used with this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
name | Contains the name of the file to work on. | required |
XmlFile
The purpose of this data source adapter is to report or check values in XML files.
Attribues
The following table lists all attributes that can be used with this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
name | Contains the name of the file to work on. | required |
Element Syntax
The element attribute in all enclosed commands must specify a valid XPath expression. With such an expression the element is identifed that has to be checked or of which the current value should be reported.
HttpdConfFile
With this data source adapter it is possible to check values in files that comply with the Apache configuration file format as for example the httpd.conf of the Apache Web Server.
Attribues
The following table lists all attributes that can be used with this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
name | Contains the name of the file to work on. | required |
Element Syntax
The element attribute in all enclosed commands must use the following syntax to identify an element:
- Section::CommandName[@param='...']/@param
- CommandName/@param
- CommandName[@param='...']/@param
-
CommandName
This is the same as CommandName/@1
Where Section is the (optional) section name which
is enclosed <...> tags like XML.
CommandName is the command. It must always be specified.
Finally param is the
number of the command's parameter (starting with 1).
If '*' is used for param then all parameters are treated
as one string.
Example
<?xml version="1.0" encoding="ISO-8859-1" ?> <Instructions version="1"> <Include>{INSTRUCTION_DIR}/defaults.cci}</Include> <HttpdConfFile name="{RootPath}/httpd/sample1.conf"> <AssertEquals element="AccessFileName">.htaccess</AssertEquals> <AssertEquals element="DirectoryIndex/@3">welcome.html</AssertEquals> <AssertEquals element="LoadModule[@1='proxy_module']/@2">modules/ApacheModuleProxy.dll</AssertEquals> <AssertEquals element="Directory ''/usr/ApacheGroup/Apache/cgi-bin''::AllowOverride/@1">None</AssertEquals> <ReportValue element="CustomLog/@*"/> </HttpdConfFile> </Instructions>
LdifFile
With this data source adapter it is possible to report and check values in LDIF files. It allows to select one or more directory objects in the LDIF file by either a distinguished name (see RFC 2253) or a search filter (not LDAP search query - RFC 2254).
Attribues
The following table lists all attributes that can be used with this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
name | Contains the name of the file to work on. | required |
Element Syntax
The element attribute of all enclosed commands must use the following syntax to identify an element:
- dn/@attrname
- [serach filter]/@attrname
The first variant identifies exactly one object by its
distinguished name.
The second variant uses a search filter with a simple syntax.
It uses attribute names of the searched objects and compares
them with static values. The following operators are supported:
Operator | Purpose | Example |
---|---|---|
= | string match | name='Jo*' |
+ | AND | name='Fred' + surname='Flintstone' |
| | OR | location='London' | location='Paris' |
! | NOT | country='US' + ! telephoneNumber='555*' |
() | grouping | (a=7 | b=9) + (m='text' | m='ascii') |
In both variants the @attrname then is the name of the attribute of the found object(s) to be reported or checked.
Example
<?xml version="1.0" encoding="ISO-8859-1" ?> <Instructions version="1"> <LdifFile name="{RootPath}/ldif/sample1.ldif"> <AssertEquals element="uid=tmorris,ou=People, dc=example,dc=com/@roomNumber">4117</AssertEquals> <AssertOneOf element="[givenName='Gern'|sn='W*']/@location"> <Value>Santa Clara</Value> <Value>Cupertino</Value> <Value>Sunnyvale</Value> </AssertOneOf> <AssertMatch element="[(sn='B*'|sn='F*')+!(sn='Burton'|sn='Fisher')]/@telephoneNumber"> +1 ### ### #### </AssertMatch> </LdifFile> </Instructions>
FileSystem
The purpose of this data source adapter is to check/report the existence of files. It also allows to refer to the "last modified" date or the size of a file.
Attribues
This data source adapter has no attributes.
Extra Command Attribues
The following table lists attributes that can be used with assertion or report commands when used inside this data source adapter.
Attribute Name | Description | required/optional |
---|---|---|
format |
Specifies the date format for the lastmodified
field of a file.
Use "dd" for day, "MM" for month and "yy" or "yyyy" for year. If the time should also be considered use "hh" for hours, "mm" for minutes and "ss" for seconds. Examples: "MM/dd/yy", "dd.MM.yyyy", "dd/MM/yyyy hh:mm:ss" Generally everything specified for java.text.SimpleDateFormat should work. |
optional |
Example
<?xml version="1.0" encoding="ISO-8859-1" ?> <Instructions version="1"> <Set name="testdata.dir">/usr/ben/testdata</Set> <Set name="BasePath">{testdata.dir}/config</Set> <FileSystem> <AssertExistence label="default configuration" element="{BasePath}/default.cfg"/> <ReportValue id="F99" element="{BasePath}/sample.jar/base.properties|@lastmodified"/> <AssertGreater element="{BasePath}/install.log|@size">800</AssertGreater> <ReportValue label="Size of install.log" element="{BasePath}/install.log|@size"/> <AssertGreaterOrEqual element="{BasePath}/install.log|@lastmodified" format="dd.MM.yyyy">10.07.2004</AssertGreaterOrEqual> </FileSystem> </Instructions>