package net.hyperic.sigar.win32.test;

import junit.framework.TestCase;
import net.hyperic.sigar.win32.Service;
import net.hyperic.sigar.win32.ServiceConfig;

public class TestService extends TestCase {

    private static final boolean TEST_CREATE = false;
    
    public TestService(String name) {
        super(name);
    }

    public void testServiceOpen() throws Exception {
        Service service = new Service("Eventlog");
        service.close();
    }

    public void testServiceCreateDelete() throws Exception {
        if (!TEST_CREATE) {
            return;
        }
        ServiceConfig config = new ServiceConfig("MyTestService");
        config.setDisplayName("My Test Service");
        config.setDescription("A Description of " + config.getDisplayName());
        config.setPath("C:\\Program Files\\My Test 1.0\\mytest.exe");

        Service.create(config);
    }

    public void testDeleteService() throws Exception {
        if (!TEST_CREATE) {
            return;
        }
        Service service = new Service("MyTestService");
        service.delete();
    }
}

@@ -43,24 +43,36 @@
 ort 
-junit.framework.
+net.hyperic.sigar.test.Sigar
 Test
@@ -77,16 +77,17 @@
 stCase;%0A
+%0A
 import n
@@ -198,16 +198,21 @@
 extends 
+Sigar
 TestCase
@@ -218,61 +218,364 @@
 e %7B%0A
-%0A    private static final boolean TEST_CREATE = false
+    private static final String TEST_NAME = %22MyTestService%22;%0A%0A    private static final String PREFIX =%0A        %22sigar.test.service.%22;%0A    %0A    private static final boolean TEST_CREATE =%0A        %22true%22.equals(System.getProperty(PREFIX + %22create%22));%0A%0A    private static final boolean TEST_DELETE =%0A        %22true%22.equals(System.getProperty(PREFIX + %22delete%22))
 ;%0A  
@@ -743,24 +743,53 @@
 Eventlog%22);%0A
+        service.getConfig();%0A
         serv
@@ -976,31 +976,82 @@
 eConfig(
-%22MyTestService%22
+TEST_NAME);%0A        config.setStartType(ServiceConfig.START_MANUAL
 );%0A     
@@ -1348,36 +1348,36 @@
       if (!TEST_
-CREA
+DELE
 TE) %7B%0A          
@@ -1434,31 +1434,25 @@
 Service(
-%22MyTestService%22
+TEST_NAME
 );%0A     

test stuff