1 | 0 | package pt.digitalis.dif.controller.sanitycheck; |
2 | |
|
3 | |
import pt.digitalis.dif.sanitycheck.ExecutionResult; |
4 | |
import pt.digitalis.dif.sanitycheck.ISanityCheckTestSuite; |
5 | |
import pt.digitalis.dif.sanitycheck.TestResult; |
6 | |
import pt.digitalis.dif.sanitycheck.annotations.SanityCheckTest; |
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | 0 | public class GeneralCheckUp implements ISanityCheckTestSuite { |
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
@SanityCheckTest |
20 | |
public TestResult testJavaEncoding() |
21 | |
{ |
22 | 0 | TestResult result = new TestResult(ExecutionResult.FAILED); |
23 | |
|
24 | 0 | String encoding = (String) System.getProperties().get("file.encoding"); |
25 | |
|
26 | 0 | if ("ISO-8859-1".equalsIgnoreCase(encoding)) |
27 | |
{ |
28 | 0 | result = new TestResult(ExecutionResult.PASSED); |
29 | |
} |
30 | |
else |
31 | |
{ |
32 | 0 | result.setErrorMessage("The application must run on a JVM configured with the encoding 'ISO-8859-1'! Use the '-Dfile.encoding=ISO-8859-1' property to initialize the JVM."); |
33 | |
} |
34 | |
|
35 | 0 | return result; |
36 | |
} |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
@SanityCheckTest |
44 | |
public TestResult testJavaVersion() |
45 | |
{ |
46 | 0 | TestResult result = new TestResult(ExecutionResult.FAILED); |
47 | |
|
48 | 0 | String javaVersion = System.getProperty("java.version"); |
49 | |
|
50 | 0 | Integer patch = 0; |
51 | 0 | String[] split = javaVersion.split("_"); |
52 | |
|
53 | 0 | if (split.length > 1) |
54 | |
{ |
55 | 0 | patch = Integer.valueOf(split[1]); |
56 | |
} |
57 | |
|
58 | 0 | if (javaVersion.contains("1.5.0") && patch >= 51) |
59 | |
{ |
60 | 0 | result = new TestResult(ExecutionResult.PASSED); |
61 | |
} |
62 | |
else |
63 | |
{ |
64 | 0 | result.setErrorMessage("The application must run on Version 1.5.0 with the patch 51, of the Java 2 Platform Standard Edition!"); |
65 | |
} |
66 | |
|
67 | 0 | return result; |
68 | |
} |
69 | |
|
70 | |
} |