1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
package info.magnolia.integrationtests.rest; |
35 |
|
|
36 |
|
import org.apache.commons.lang3.StringUtils; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
41 |
|
public abstract class AbstractRestIntegrationTest { |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
public static final String AUTHOR_CONTEXT_PATH_PROPERTY = "authorContextPath"; |
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
public static final String DOMAIN_PROPERTY = "containerRootURL"; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
public static final String DEFAULT_DOMAIN = "http://localhost:8496/"; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 4 |
Complexity Density: 0.8 |
|
60 |
|
public enum Instance implements InstanceProperties { |
61 |
|
AUTHOR { |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
62 |
0 |
@Override... |
63 |
|
public String getContextPath() { |
64 |
0 |
final String authorContextPath = System.getProperty(AUTHOR_CONTEXT_PATH_PROPERTY); |
65 |
0 |
return StringUtils.isEmpty(authorContextPath) ? "magnoliaTest/" : authorContextPath; |
66 |
|
} |
67 |
|
}; |
68 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
69 |
|
@Override... |
70 |
|
public String getDomain() { |
71 |
|
final String domainFromProperty = System.getProperty(DOMAIN_PROPERTY); |
72 |
|
final String domain = StringUtils.defaultIfEmpty(domainFromProperty, DEFAULT_DOMAIN); |
73 |
|
return StringUtils.removeEnd(domain, "/"); |
74 |
|
} |
75 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
76 |
|
@Override... |
77 |
|
public String getURL() { |
78 |
|
return getDomain() + "/" + getContextPath(); |
79 |
|
} |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
81 |
0 |
@Override... |
82 |
|
public String getURL(String path) { |
83 |
0 |
if (path.startsWith("/")) { |
84 |
0 |
path = path.substring(1); |
85 |
|
} |
86 |
0 |
return getURL() + path; |
87 |
|
} |
88 |
|
} |
89 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
90 |
|
private interface InstanceProperties { |
91 |
|
String getContextPath(); |
92 |
|
|
93 |
|
String getDomain(); |
94 |
|
|
95 |
|
String getURL(); |
96 |
|
|
97 |
|
String getURL(String path); |
98 |
|
} |
99 |
|
} |