test getServiceNames

This commit is contained in:
Doug MacEachern 2008-03-26 17:47:59 +00:00
parent d95ff6f7b8
commit 5d440dcc14
1 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,10 @@
package org.hyperic.sigar.win32.test; package org.hyperic.sigar.win32.test;
import java.util.List;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.test.SigarTestCase; import org.hyperic.sigar.test.SigarTestCase;
import org.hyperic.sigar.win32.Service; import org.hyperic.sigar.win32.Service;
@ -55,6 +59,25 @@ public class TestService extends SigarTestCase {
} }
} }
public void testServiceNames() throws Exception {
List services = Service.getServiceNames();
assertGtZeroTrace("getServiceNames", services.size());
final String[] ptql = {
"Service.Name.ct=Ev",
"Service.Path.ew=.exe",
};
Sigar sigar = new Sigar();
try {
for (int i=0; i<ptql.length; i++) {
services = Service.getServiceNames(sigar, ptql[i]);
assertGtZeroTrace(ptql[i], services.size());
}
} finally {
sigar.close();
}
}
public void testServiceCreateDelete() throws Exception { public void testServiceCreateDelete() throws Exception {
if (!TEST_CREATE) { if (!TEST_CREATE) {
return; return;