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.blossom.suite; |
35 |
|
|
36 |
|
import static org.junit.Assert.*; |
37 |
|
|
38 |
|
import info.magnolia.content2bean.Content2BeanException; |
39 |
|
import info.magnolia.module.blossom.annotation.Available; |
40 |
|
import info.magnolia.module.blossom.annotation.DialogFactory; |
41 |
|
import info.magnolia.module.blossom.annotation.TabFactory; |
42 |
|
import info.magnolia.module.blossom.annotation.Template; |
43 |
|
import info.magnolia.module.blossom.annotation.TemplateDescription; |
44 |
|
import info.magnolia.objectfactory.Components; |
45 |
|
import info.magnolia.registry.RegistrationException; |
46 |
|
import info.magnolia.rendering.template.TemplateDefinition; |
47 |
|
import info.magnolia.rendering.template.registry.TemplateDefinitionRegistry; |
48 |
|
import info.magnolia.ui.dialog.config.DialogBuilder; |
49 |
|
import info.magnolia.ui.form.config.TabBuilder; |
50 |
|
|
51 |
|
import javax.jcr.Node; |
52 |
|
import javax.jcr.RepositoryException; |
53 |
|
|
54 |
|
import org.junit.Test; |
55 |
|
import org.springframework.stereotype.Controller; |
56 |
|
import org.springframework.web.bind.annotation.RequestMapping; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
@since |
62 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 3 |
Complexity Density: 0.2 |
|
63 |
|
public class MassiveTest extends AbstractBlossomTestCase { |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
1 |
@Override... |
66 |
|
protected String getRootWebApplicationConfigLocation() { |
67 |
1 |
return "classpath:info/magnolia/module/blossom/suite/MassiveTest-test.xml"; |
68 |
|
} |
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
1 |
@Override... |
71 |
|
protected String getDispatcherServletConfigLocation() { |
72 |
1 |
return "classpath:info/magnolia/module/blossom/suite/MassiveTest-DispatcherServlet-test.xml"; |
73 |
|
} |
74 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
75 |
1 |
@Test... |
76 |
|
public void testMassively() throws RepositoryException, Content2BeanException, RegistrationException { |
77 |
|
|
78 |
1 |
TemplateDefinition testTemplate = Components.getComponent(TemplateDefinitionRegistry.class).getTemplateDefinition("testTemplate"); |
79 |
1 |
assertNotNull(testTemplate); |
80 |
1 |
assertEquals("Test Template", testTemplate.getTitle()); |
81 |
1 |
assertEquals("Test Template Description", testTemplate.getDescription()); |
82 |
1 |
assertTrue(testTemplate.getTemplateAvailability().getClass().getName().startsWith("info.magnolia.module.blossom")); |
83 |
|
|
84 |
|
|
85 |
1 |
assertDialogIsNotRegistered("blossom-template-dialog:" + TestTemplate.class.getName()); |
86 |
|
|
87 |
1 |
assertDialogIsRegistered("test-template-dialog"); |
88 |
|
|
89 |
1 |
TemplateDefinition testComponent = Components.getComponent(TemplateDefinitionRegistry.class).getTemplateDefinition("testComponent"); |
90 |
1 |
assertNotNull(testComponent); |
91 |
1 |
assertEquals("Test Component", testComponent.getTitle()); |
92 |
1 |
assertEquals("Test Component Description", testComponent.getDescription()); |
93 |
|
|
94 |
1 |
assertDialogIsRegistered("blossom-template-dialog:" + TestComponent.class.getName()); |
95 |
|
|
96 |
1 |
assertDialogIsRegistered("test-dialog"); |
97 |
|
} |
98 |
|
|
99 |
|
@Template(title = "Test Template", id = "testTemplate") |
100 |
|
@TemplateDescription("Test Template Description") |
101 |
|
@Controller |
|
|
| 20% |
Uncovered Elements: 4 (5) |
Complexity: 3 |
Complexity Density: 1.5 |
|
102 |
|
public static class TestTemplate { |
103 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
104 |
0 |
@RequestMapping("/testTemplate")... |
105 |
|
public String testTemplate() { |
106 |
0 |
return "testTemplate.jsp"; |
107 |
|
} |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0 |
@Available... |
110 |
|
public boolean isAvailable(Node node) { |
111 |
0 |
return true; |
112 |
|
} |
113 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
114 |
2 |
@DialogFactory("test-template-dialog")... |
115 |
|
public void templateDialog(DialogBuilder dialog) { |
116 |
|
|
117 |
|
} |
118 |
|
} |
119 |
|
|
120 |
|
@Template(title = "Test Component", id = "testComponent") |
121 |
|
@TemplateDescription("Test Component Description") |
122 |
|
@Controller |
|
|
| 33.3% |
Uncovered Elements: 2 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
123 |
|
public static class TestComponent { |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
125 |
0 |
@RequestMapping("/testComponent")... |
126 |
|
public String testComponent() { |
127 |
0 |
return "testComponent.jsp"; |
128 |
|
} |
129 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
130 |
2 |
@TabFactory("Content")... |
131 |
|
public void contentTab(TabBuilder tab) { |
132 |
|
} |
133 |
|
} |
134 |
|
|
135 |
|
@DialogFactory("test-dialog") |
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 0 |
Complexity Density: - |
|
136 |
|
public static class TestDialogFactory { |
137 |
|
} |
138 |
|
} |