1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.uruma.util.win32;
17
18 import junit.framework.TestCase;
19
20
21
22
23
24
25 public class Win32APITest extends TestCase {
26
27
28
29 public void testGetComputerName() {
30 System.out.println(Win32API.getComputerName());
31 }
32
33
34
35
36 public void testGetLogicalDrives() {
37 String[] drives = Win32API.getLogicalDrives();
38 for (int i = 0; i < drives.length; i++) {
39 System.out.println(drives[i]);
40 }
41 }
42
43
44
45
46 public void testGetVolumeInformation() {
47 VolumeInformation info = Win32API.getVolumeInformation("c:\\");
48 System.out.println(info);
49 }
50
51
52
53
54 public void testGetDriveType() {
55 String[] drives = Win32API.getLogicalDrives();
56 for (int i = 0; i < drives.length; i++) {
57 DriveType type = Win32API.getDriveType(drives[i]);
58 System.out.println(drives[i] + "..." + type);
59 }
60 }
61
62
63
64
65 public void testGetFileTypeName() {
66 String[] drives = Win32API.getLogicalDrives();
67 for (int i = 0; i < drives.length; i++) {
68 String type = Win32API.getFileTypeName(drives[i]);
69 System.out.println(drives[i] + "..." + type);
70 }
71 }
72
73
74
75
76 public void testGetFileDisplayName() {
77 String[] drives = Win32API.getLogicalDrives();
78 for (int i = 0; i < drives.length; i++) {
79 String type = Win32API.getFileDisplayName(drives[i]);
80 System.out.println(drives[i] + "..." + type);
81 }
82 }
83
84
85
86
87 public void testExpandEnvironmentStrings() {
88 String sysroot = System.getenv("systemroot");
89 String expSysroot = Win32API.expandEnvironmentStrings("%systemroot%");
90 assertEquals("1", sysroot, expSysroot);
91
92 assertEquals("2", "noenv", Win32API.expandEnvironmentStrings("noenv"));
93 }
94 }