buildframework/helium/sf/java/checktools/tests/src/com/nokia/helium/checktools/tests/TestOSResolver.java
equal
deleted
inserted
replaced
29 */ |
29 */ |
30 public class TestOSResolver extends TestCase { |
30 public class TestOSResolver extends TestCase { |
31 |
31 |
32 /** |
32 /** |
33 * Method to test getCommand. |
33 * Method to test getCommand. |
|
34 * @throws CheckToolException |
34 */ |
35 */ |
35 public void testGetCommand() { |
36 public void testGetCommand() throws CheckToolException { |
36 String result = OSResolver.getCommand("test"); |
37 String result = OSResolver.getCommand("test"); |
37 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
38 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
38 boolean isWindows = osName.indexOf("windows") > -1; |
39 boolean isWindows = osName.indexOf("windows") > -1; |
39 boolean is9x = (osName.indexOf("95") >= 0 || osName.indexOf("98") >= 0 |
40 boolean is9x = (osName.indexOf("95") >= 0 || osName.indexOf("98") >= 0 |
40 || osName.indexOf("me") >= 0 || osName.indexOf("ce") >= 0); |
41 || osName.indexOf("me") >= 0 || osName.indexOf("ce") >= 0); |
48 } |
49 } |
49 |
50 |
50 /** |
51 /** |
51 * Method to test whether the given os is of Windows family or not. |
52 * Method to test whether the given os is of Windows family or not. |
52 */ |
53 */ |
53 public void testIsOSWindowsFamily() { |
54 public void testIsOSWindowsFamily() throws CheckToolException { |
54 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
55 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
55 boolean isWindows = osName.indexOf("windows") > -1; |
56 boolean isWindows = osName.indexOf("windows") > -1; |
56 boolean result = OSResolver.isOs("windows"); |
57 boolean result = OSResolver.isOs("windows"); |
57 if (isWindows) { |
58 if (isWindows) { |
58 assertEquals(true, result); |
59 assertEquals(true, result); |
62 } |
63 } |
63 |
64 |
64 /** |
65 /** |
65 * Method to test whether the given os is of unix family or not. |
66 * Method to test whether the given os is of unix family or not. |
66 */ |
67 */ |
67 public void testIsOSUnixFamily() { |
68 public void testIsOSUnixFamily() throws CheckToolException { |
68 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
69 String osName = System.getProperty("os.name").toLowerCase(Locale.US); |
69 String pathSeparator = System.getProperty("path.separator"); |
70 String pathSeparator = System.getProperty("path.separator"); |
70 boolean isUnix = pathSeparator.equals(":") |
71 boolean isUnix = pathSeparator.equals(":") |
71 && (osName.indexOf("mac") == -1 || osName.endsWith("x")); |
72 && (osName.indexOf("mac") == -1 || osName.endsWith("x")); |
72 boolean result = OSResolver.isOs("unix"); |
73 boolean result = OSResolver.isOs("unix"); |