assert Pid.Pid.eq=$$ matches 1 process

This commit is contained in:
Doug MacEachern 2007-04-22 18:30:04 +00:00
parent 6da1470043
commit 983cb0d831
1 changed files with 6 additions and 1 deletions

View File

@ -28,6 +28,8 @@ import org.hyperic.sigar.ptql.MalformedQueryException;
public class TestPTQL extends SigarTestCase { public class TestPTQL extends SigarTestCase {
private static final String THIS_PROCESS = "Pid.Pid.eq=$$";
private ProcessQueryFactory qf; private ProcessQueryFactory qf;
private static final String[] OK_QUERIES = { private static final String[] OK_QUERIES = {
@ -60,7 +62,7 @@ public class TestPTQL extends SigarTestCase {
"Port.tcp.eq=8080,Cred.Uid.eq=1003", //dougm owned jboss port "Port.tcp.eq=8080,Cred.Uid.eq=1003", //dougm owned jboss port
"Pid.PidFile.eq=pid.file", "Pid.PidFile.eq=pid.file",
"Pid.Pid.eq=1", "Pid.Pid.eq=1",
"Pid.Pid.eq=$$", THIS_PROCESS,
"Pid.Service.eq=Eventlog", "Pid.Service.eq=Eventlog",
"Pid.Service.eq=NOSUCHSERVICE", "Pid.Service.eq=NOSUCHSERVICE",
"Pid.Service.eq=Hyperic HQ Agent", "Pid.Service.eq=Hyperic HQ Agent",
@ -135,6 +137,9 @@ public class TestPTQL extends SigarTestCase {
} }
private void testOK(Sigar sigar) throws Exception { private void testOK(Sigar sigar) throws Exception {
assertTrue(THIS_PROCESS,
runQuery(sigar, THIS_PROCESS) == 1);
for (int i=0; i<OK_QUERIES.length; i++) { for (int i=0; i<OK_QUERIES.length; i++) {
String qs = OK_QUERIES[i]; String qs = OK_QUERIES[i];
assertTrue(qs, assertTrue(qs,