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.module.googlesitemap; |
35 |
|
|
36 |
|
import info.magnolia.cms.util.ClasspathResourcesUtil; |
37 |
|
import info.magnolia.context.MgnlContext; |
38 |
|
import info.magnolia.objectfactory.Components; |
39 |
|
import info.magnolia.repository.RepositoryManager; |
40 |
|
import info.magnolia.test.RepositoryTestCase; |
41 |
|
import info.magnolia.ui.form.EditorCallback; |
42 |
|
import info.magnolia.ui.form.EditorValidator; |
43 |
|
|
44 |
|
import javax.jcr.RepositoryException; |
45 |
|
import javax.jcr.Session; |
46 |
|
|
47 |
|
import org.junit.Before; |
48 |
|
import org.slf4j.Logger; |
49 |
|
import org.slf4j.LoggerFactory; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
54 |
|
public class SiteMapTestUtil extends RepositoryTestCase { |
55 |
|
|
56 |
|
private static final Logger log = LoggerFactory.getLogger(SiteMapTestUtil.class); |
57 |
|
|
58 |
|
protected Session googleSiteMapSession; |
59 |
|
private String siteMapNodeTypeConfigFile = "test-google-sitemap-nodetypes.xml"; |
60 |
|
private String siteMapRepositoryConfigFile = "test-siteMap-repositories.xml"; |
61 |
|
|
|
|
| 83.3% |
Uncovered Elements: 1 (6) |
Complexity: 2 |
Complexity Density: 0.33 |
|
62 |
46 |
@Override... |
63 |
|
@Before |
64 |
|
public void setUp() throws Exception { |
65 |
46 |
super.setUp(); |
66 |
46 |
googleSiteMapSession = MgnlContext.getJCRSession(GoogleSiteMapConfiguration.WORKSPACE); |
67 |
|
|
68 |
|
|
69 |
46 |
RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class); |
70 |
46 |
try { |
71 |
46 |
repositoryManager.getRepositoryProvider("magnolia").registerNodeTypes(ClasspathResourcesUtil.getResource(siteMapNodeTypeConfigFile).openStream()); |
72 |
|
} catch (RepositoryException e) { |
73 |
0 |
log.error("", e); |
74 |
|
} |
75 |
|
} |
76 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
77 |
46 |
@Override... |
78 |
|
protected String getRepositoryConfigFileName() { |
79 |
46 |
setRepositoryConfigFileName(siteMapRepositoryConfigFile); |
80 |
46 |
return siteMapRepositoryConfigFile; |
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
@link |
86 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
87 |
|
public static class GoogleMapEditorCallbackTest implements EditorCallback { |
88 |
|
|
89 |
|
private String callbackActionCalled; |
90 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
91 |
|
public String getCallbackActionCalled() {... |
92 |
|
return callbackActionCalled; |
93 |
|
} |
94 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
95 |
|
public EditorCallback getCallback() {... |
96 |
|
return new EditorCallback() { |
97 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
98 |
|
@Override... |
99 |
|
public void onSuccess(String actionName) { |
100 |
|
callbackActionCalled = "onSuccess(" + actionName + ")"; |
101 |
|
} |
102 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
103 |
|
@Override... |
104 |
|
public void onCancel() { |
105 |
|
callbackActionCalled = "onCancel()"; |
106 |
|
} |
107 |
|
}; |
108 |
|
} |
109 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
110 |
7 |
@Override... |
111 |
|
public void onSuccess(String actionName) { |
112 |
7 |
callbackActionCalled = "onSuccess(" + actionName + ")"; |
113 |
|
} |
114 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
0 |
@Override... |
116 |
|
public void onCancel() { |
117 |
0 |
callbackActionCalled = "onCancel()"; |
118 |
|
} |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
|
@link |
123 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: - |
|
124 |
|
public static class GoogleMapEditorValidatorTest implements EditorValidator { |
125 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
126 |
7 |
@Override... |
127 |
|
public void showValidation(boolean visible) { |
128 |
|
} |
129 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
130 |
|
@Override... |
131 |
|
public boolean isValid() { |
132 |
|
return true; |
133 |
|
} |
134 |
|
} |
135 |
|
} |