1 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 public class GeneralCheckUp implements ISanityCheckTestSuite {
13
14
15
16
17
18
19 @SanityCheckTest
20 public TestResult testJavaEncoding()
21 {
22 TestResult result = new TestResult(ExecutionResult.FAILED);
23
24 String encoding = (String) System.getProperties().get("file.encoding");
25
26 if ("ISO-8859-1".equalsIgnoreCase(encoding))
27 {
28 result = new TestResult(ExecutionResult.PASSED);
29 }
30 else
31 {
32 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 return result;
36 }
37
38
39
40
41
42
43 @SanityCheckTest
44 public TestResult testJavaVersion()
45 {
46 TestResult result = new TestResult(ExecutionResult.FAILED);
47
48 String javaVersion = System.getProperty("java.version");
49
50 Integer patch = 0;
51 String[] split = javaVersion.split("_");
52
53 if (split.length > 1)
54 {
55 patch = Integer.valueOf(split[1]);
56 }
57
58 if (javaVersion.contains("1.5.0") && patch >= 51)
59 {
60 result = new TestResult(ExecutionResult.PASSED);
61 }
62 else
63 {
64 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 return result;
68 }
69
70 }