You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
995 B
33 lines
995 B
package com.insigma.utils;
|
|
|
|
import com.insigma.config.AppCfg;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
|
|
@Slf4j
|
|
public class WinServiceToolTest {
|
|
|
|
static {
|
|
DbUtil.url = "jdbc:mysql://127.0.0.1:35017/hy_qggwy";
|
|
DbUtil.usr = "root";
|
|
DbUtil.pwd = "admin";
|
|
AppCfg.DB = "GWY20_Mysql";
|
|
AppCfg.MW = "GWY20_Tomcat";
|
|
AppCfg.HZB = "D:/hzb2021";
|
|
AppCfg.BROWSER = "360se.exe";
|
|
}
|
|
|
|
@Test
|
|
public void getService() throws Exception {
|
|
|
|
WinServiceTool.WindowsService windowsService = WinServiceTool.getService(AppCfg.DB, "GBK");
|
|
log.info("停止代码:{}", windowsService);
|
|
assertTrue(windowsService.stopService());
|
|
log.info("启动代码:{}", windowsService);
|
|
assertTrue(windowsService.startService());
|
|
log.info("重启代码:{}", windowsService);
|
|
assertTrue(windowsService.restartService());
|
|
}
|
|
}
|