1 |
|
package org.europa.together.utils; |
2 |
|
|
3 |
|
import java.nio.file.Paths; |
4 |
|
import java.util.TimeZone; |
5 |
|
import org.europa.together.application.LogbackLogger; |
6 |
|
import org.europa.together.application.PropertyFileReader; |
7 |
|
import org.europa.together.business.Logger; |
8 |
|
import org.europa.together.business.PropertyReader; |
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
|
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 4 |
Complexity Density: 0.44 |
|
13 |
|
public final class Constraints { |
14 |
|
|
15 |
|
private static final Logger LOGGER = new LogbackLogger(Constraints.class); |
16 |
|
private static final String FILE |
17 |
|
= "org/europa/together/configuration/module.properties"; |
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
22 |
1 |
private Constraints() {... |
23 |
1 |
throw new UnsupportedOperationException(); |
24 |
|
} |
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
public static final String MODULE_NAME = getAppInfo("module"); |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
public static final String MODULE_VERSION = getAppInfo("version"); |
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
public static final String LICENSE = "Apache License 2.0"; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
public static final String MODULE_DESCRIPTION = getAppInfo("description"); |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
public static final TimeZone SYSTEM_DEFAULT_TIMEZONE = TimeZone.getTimeZone("UTC"); |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
public static final String SYSTEM_OS = System.getProperty("os.name"); |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
public static final String SYSTEM_USER_HOME_DIR = System.getProperty("user.home"); |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
public static final String SYSTEM_APP_DIR = Paths.get("").toAbsolutePath().toString(); |
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
public static final int INT_128 = 128; |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
public static final int INT_512 = 512; |
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
public static final int INT_1024 = 1024; |
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
public static final int INT_4096 = 4096; |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
public static final int HEX_255 = 0xff; |
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
public static final int HEX_256 = 0x100; |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@return |
103 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
104 |
1 |
public static String printConstraintInfo() {... |
105 |
1 |
return "CORE Constraints DEBUG Info." |
106 |
|
+ "\n\t Module Name: " + MODULE_NAME |
107 |
|
+ "\n\t Module Version: " + MODULE_VERSION |
108 |
|
+ "\n\t Module Description: " + MODULE_DESCRIPTION |
109 |
|
+ "\n\t Software License: " + LICENSE |
110 |
|
+ "\n\t Operating System: " + SYSTEM_OS |
111 |
|
+ "\n\t User Home DIR: " + SYSTEM_USER_HOME_DIR |
112 |
|
+ "\n\t Application DIR: " + SYSTEM_APP_DIR |
113 |
|
+ "\n\t BYTE 512: " + INT_512 |
114 |
|
+ "\n\t BYTE 1024: " + INT_1024 |
115 |
|
+ "\n\t BYTE 4096: " + INT_4096 |
116 |
|
+ "\n\t HEX 255: " + HEX_255 |
117 |
|
+ "\n\t HEX 256: " + HEX_256; |
118 |
|
} |
119 |
|
|
120 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
121 |
3 |
private static String getAppInfo(final String propertyName) {... |
122 |
3 |
PropertyReader propertyReader = new PropertyFileReader(); |
123 |
3 |
String value = ""; |
124 |
3 |
try { |
125 |
3 |
propertyReader.appendPropertiesFromClasspath(FILE); |
126 |
3 |
value = propertyReader.getPropertyAsString(propertyName); |
127 |
|
} catch (Exception ex) { |
128 |
0 |
LOGGER.catchException(ex); |
129 |
|
} |
130 |
3 |
return value; |
131 |
|
} |
132 |
|
} |