test stuff
This commit is contained in:
parent
72e7b88512
commit
1fabb41896
|
@ -1,12 +1,21 @@
|
||||||
package net.hyperic.sigar.win32.test;
|
package net.hyperic.sigar.win32.test;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import net.hyperic.sigar.test.SigarTestCase;
|
||||||
|
|
||||||
import net.hyperic.sigar.win32.Service;
|
import net.hyperic.sigar.win32.Service;
|
||||||
import net.hyperic.sigar.win32.ServiceConfig;
|
import net.hyperic.sigar.win32.ServiceConfig;
|
||||||
|
|
||||||
public class TestService extends TestCase {
|
public class TestService extends SigarTestCase {
|
||||||
|
private static final String TEST_NAME = "MyTestService";
|
||||||
|
|
||||||
private static final boolean TEST_CREATE = false;
|
private static final String PREFIX =
|
||||||
|
"sigar.test.service.";
|
||||||
|
|
||||||
|
private static final boolean TEST_CREATE =
|
||||||
|
"true".equals(System.getProperty(PREFIX + "create"));
|
||||||
|
|
||||||
|
private static final boolean TEST_DELETE =
|
||||||
|
"true".equals(System.getProperty(PREFIX + "delete"));
|
||||||
|
|
||||||
public TestService(String name) {
|
public TestService(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
@ -14,6 +23,7 @@ public class TestService extends TestCase {
|
||||||
|
|
||||||
public void testServiceOpen() throws Exception {
|
public void testServiceOpen() throws Exception {
|
||||||
Service service = new Service("Eventlog");
|
Service service = new Service("Eventlog");
|
||||||
|
service.getConfig();
|
||||||
service.close();
|
service.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +31,8 @@ public class TestService extends TestCase {
|
||||||
if (!TEST_CREATE) {
|
if (!TEST_CREATE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ServiceConfig config = new ServiceConfig("MyTestService");
|
ServiceConfig config = new ServiceConfig(TEST_NAME);
|
||||||
|
config.setStartType(ServiceConfig.START_MANUAL);
|
||||||
config.setDisplayName("My Test Service");
|
config.setDisplayName("My Test Service");
|
||||||
config.setDescription("A Description of " + config.getDisplayName());
|
config.setDescription("A Description of " + config.getDisplayName());
|
||||||
config.setPath("C:\\Program Files\\My Test 1.0\\mytest.exe");
|
config.setPath("C:\\Program Files\\My Test 1.0\\mytest.exe");
|
||||||
|
@ -30,10 +41,10 @@ public class TestService extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testDeleteService() throws Exception {
|
public void testDeleteService() throws Exception {
|
||||||
if (!TEST_CREATE) {
|
if (!TEST_DELETE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Service service = new Service("MyTestService");
|
Service service = new Service(TEST_NAME);
|
||||||
service.delete();
|
service.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue