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.app.actions.availability; |
35 |
|
|
36 |
|
import static org.junit.Assert.assertTrue; |
37 |
|
import static org.junit.Assert.assertFalse; |
38 |
|
|
39 |
|
import info.magnolia.jcr.util.NodeTypes; |
40 |
|
import info.magnolia.module.googlesitemap.GoogleSiteMapConfiguration; |
41 |
|
import info.magnolia.module.googlesitemap.SiteMapNodeTypes; |
42 |
|
import info.magnolia.module.googlesitemap.SiteMapTestUtil; |
43 |
|
import info.magnolia.ui.vaadin.integration.jcr.JcrItemId; |
44 |
|
|
45 |
|
import java.util.Arrays; |
46 |
|
|
47 |
|
import javax.jcr.Node; |
48 |
|
import javax.jcr.RepositoryException; |
49 |
|
|
50 |
|
import org.junit.Before; |
51 |
|
import org.junit.Test; |
52 |
|
|
53 |
|
|
54 |
|
@link |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 4 |
Complexity Density: 0.24 |
|
56 |
|
public class VirtualUriMappingEditingEnabledRuleTest extends SiteMapTestUtil { |
57 |
|
|
58 |
|
private VirtualUriMappingEditingEnabledRule rule; |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
60 |
3 |
@Override... |
61 |
|
@Before |
62 |
|
public void setUp() throws Exception { |
63 |
3 |
super.setUp(); |
64 |
3 |
rule = new VirtualUriMappingEditingEnabledRule(); |
65 |
|
} |
66 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
67 |
1 |
@Test... |
68 |
|
public void testHasVirtualUriMappingTest() throws RepositoryException { |
69 |
|
|
70 |
1 |
Node siteMap = googleSiteMapSession.getRootNode().addNode("siteMap", SiteMapNodeTypes.SiteMap.NAME); |
71 |
1 |
siteMap.setProperty(SiteMapNodeTypes.SiteMap.INCLUDE_VIRTUAL_URI, true); |
72 |
1 |
JcrItemId item = new JcrItemId(siteMap.getIdentifier(), GoogleSiteMapConfiguration.WORKSPACE); |
73 |
|
|
74 |
|
|
75 |
1 |
boolean isAvailable = rule.isAvailable(Arrays.asList(item)); |
76 |
|
|
77 |
|
|
78 |
1 |
assertTrue(isAvailable); |
79 |
|
} |
80 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
81 |
1 |
@Test... |
82 |
|
public void testHasNoVirtualUriMappingTest() throws RepositoryException { |
83 |
|
|
84 |
1 |
Node siteMap = googleSiteMapSession.getRootNode().addNode("siteMap", SiteMapNodeTypes.SiteMap.NAME); |
85 |
1 |
siteMap.setProperty(SiteMapNodeTypes.SiteMap.INCLUDE_VIRTUAL_URI, false); |
86 |
1 |
JcrItemId item = new JcrItemId(siteMap.getIdentifier(), GoogleSiteMapConfiguration.WORKSPACE); |
87 |
|
|
88 |
|
|
89 |
1 |
boolean isAvailable = rule.isAvailable(Arrays.asList(item)); |
90 |
|
|
91 |
|
|
92 |
1 |
assertFalse(isAvailable); |
93 |
|
} |
94 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
95 |
1 |
@Test... |
96 |
|
public void testHasVirtualUriMappingWrongTypeTest() throws RepositoryException { |
97 |
|
|
98 |
1 |
Node siteMap = googleSiteMapSession.getRootNode().addNode("siteMap", NodeTypes.Page.NAME); |
99 |
1 |
siteMap.setProperty(SiteMapNodeTypes.SiteMap.INCLUDE_VIRTUAL_URI, true); |
100 |
1 |
JcrItemId item = new JcrItemId(siteMap.getIdentifier(), GoogleSiteMapConfiguration.WORKSPACE); |
101 |
|
|
102 |
|
|
103 |
1 |
boolean isAvailable = rule.isAvailable(Arrays.asList(item)); |
104 |
|
|
105 |
|
|
106 |
1 |
assertFalse(isAvailable); |
107 |
|
} |
108 |
|
} |