This commit is contained in:
Looly
2022-04-29 01:56:04 +08:00
parent c753a53173
commit 67a0f31dd9
45 changed files with 154 additions and 223 deletions

View File

@@ -1,7 +1,7 @@
package cn.hutool.extra.system;
package cn.hutool.extra.management;
import cn.hutool.core.lang.Console;
import cn.hutool.extra.system.oshi.OshiUtil;
import cn.hutool.extra.management.oshi.OshiUtil;
import org.junit.Ignore;
import org.junit.Test;

View File

@@ -1,8 +1,8 @@
package cn.hutool.extra.system;
package cn.hutool.extra.management;
import cn.hutool.core.lang.Console;
import cn.hutool.extra.system.oshi.CpuInfo;
import cn.hutool.extra.system.oshi.OshiUtil;
import cn.hutool.extra.management.oshi.CpuInfo;
import cn.hutool.extra.management.oshi.OshiUtil;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;

View File

@@ -1,4 +1,4 @@
package cn.hutool.extra.system;
package cn.hutool.extra.management;
import org.junit.Assert;
import org.junit.Ignore;
@@ -11,43 +11,43 @@ public class SystemUtilTest {
@Test
@Ignore
public void dumpTest() {
SystemUtil.dumpSystemInfo();
ManagementUtil.dumpSystemInfo();
}
@Test
public void getCurrentPidTest() {
long pid = SystemUtil.getCurrentPID();
long pid = ManagementUtil.getCurrentPID();
Assert.assertTrue(pid > 0);
}
@Test
public void getJavaInfoTest() {
JavaInfo javaInfo = SystemUtil.getJavaInfo();
JavaInfo javaInfo = ManagementUtil.getJavaInfo();
Assert.assertNotNull(javaInfo);
}
@Test
public void getJavaRuntimeInfoTest() {
JavaRuntimeInfo info = SystemUtil.getJavaRuntimeInfo();
JavaRuntimeInfo info = ManagementUtil.getJavaRuntimeInfo();
Assert.assertNotNull(info);
}
@Test
public void getOsInfoTest() {
OsInfo osInfo = SystemUtil.getOsInfo();
OsInfo osInfo = ManagementUtil.getOsInfo();
Assert.assertNotNull(osInfo);
}
@Test
public void getHostInfo() {
HostInfo hostInfo = SystemUtil.getHostInfo();
HostInfo hostInfo = ManagementUtil.getHostInfo();
Assert.assertNotNull(hostInfo);
}
@Test
public void getUserInfoTest(){
// https://gitee.com/dromara/hutool/issues/I3NM39
final UserInfo userInfo = SystemUtil.getUserInfo();
final UserInfo userInfo = ManagementUtil.getUserInfo();
Assert.assertTrue(userInfo.getTempDir().endsWith(File.separator));
}
}