<?xml version="1.0" encoding="utf-8" ?>

<testCollection 
      xmlns:xs = "http://www.w3.org/2001/XMLSchema-instance"
            xs:noNamespaceSchemaLocation='apitest.xsd'>



<name>OpenSSH</name>

<info>
    <description>
	Example for checking on OpenSSH (adapted from Will McLean's examples).
	I'm not totally certain all is correct, in fact I'm fairly sure, there 
	are issues.  I just started working with APITest.

	This does the following:
	   (1) Check to see if openssh is installed?
	   (2) If (1) was tru then check to see if sshd is running
	       - there are two methods for checking this stdout from service status
		   - the return code from service status
	   (3) [Broken I think] Lastly we check that if (1) was successful
	       and either of (2) were un-successful, we try to restart openssh.
	  </description>
	  </info>

<testList>
    <!-- Have to grep out some output...seems like i overflow buffer? -->
	<shellTest name='OpenSSH-Installed' command='rpm -qa | grep -i open'>
		<output format='REGEXP' type='stdout'>.*openssh.*</output>
	</shellTest>

	<shellTest name='OpenSSH-Running-STDOUT' command='service sshd status'>
		<dependencies>
			<dependency name='OpenSSH-Installed' maxPctMatch="100"/>
		</dependencies>
		<output format='REGEXP' type='stdout'>.*running.*</output>
	</shellTest>	

	<shellTest name='OpenSSH-Running-STATUS' command='service sshd status'>
		<dependencies>
			<dependency name='OpenSSH-Installed' maxPctMatch="100"/>
		</dependencies>
		<output format='REGEXP' type='status'>[0]</output>
	</shellTest>	

	<shellTest name='OpenSSH-Restart' command='service sshd restart'>
		<dependencies>
			<AND>
			<dependency name='OpenSSH-Installed' maxPctMatch='100'/>
			<OR>
				<dependency name='OpenSSH-Running-STDOUT' maxPctMatch='0'/>
				<dependency name='OpenSSH-Running-STATUS' maxPctMatch='0'/>
			</OR>
			</AND>
		</dependencies>
		<output format='REGEXP' type='stdout'>.*OK.*</output>
	</shellTest>	
	
</testList>

</testCollection>

