1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.extension.job.internal; |
21 |
|
|
22 |
|
import java.util.Iterator; |
23 |
|
|
24 |
|
import org.junit.Assert; |
25 |
|
import org.junit.Before; |
26 |
|
import org.junit.Test; |
27 |
|
import org.xwiki.extension.CoreExtension; |
28 |
|
import org.xwiki.extension.ExtensionId; |
29 |
|
import org.xwiki.extension.InstallException; |
30 |
|
import org.xwiki.extension.LocalExtension; |
31 |
|
import org.xwiki.extension.TestResources; |
32 |
|
import org.xwiki.extension.job.plan.ExtensionPlan; |
33 |
|
import org.xwiki.extension.job.plan.ExtensionPlanAction; |
34 |
|
import org.xwiki.extension.job.plan.ExtensionPlanAction.Action; |
35 |
|
import org.xwiki.extension.job.plan.ExtensionPlanNode; |
36 |
|
import org.xwiki.extension.repository.CoreExtensionRepository; |
37 |
|
import org.xwiki.extension.test.AbstractExtensionHandlerTest; |
38 |
|
import org.xwiki.extension.test.ConfigurableDefaultCoreExtensionRepository; |
39 |
|
import org.xwiki.extension.version.internal.DefaultVersion; |
40 |
|
|
41 |
|
import static org.junit.Assert.fail; |
42 |
|
|
|
|
| 99.7% |
Uncovered Elements: 1 (364) |
Complexity: 31 |
Complexity Density: 0.09 |
|
43 |
|
public class InstallPlanJobTest extends AbstractExtensionHandlerTest |
44 |
|
{ |
45 |
|
private ConfigurableDefaultCoreExtensionRepository coreRepository; |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
47 |
29 |
@Override... |
48 |
|
@Before |
49 |
|
public void setUp() throws Exception |
50 |
|
{ |
51 |
29 |
super.setUp(); |
52 |
|
|
53 |
29 |
this.coreRepository = this.mocker.getInstance(CoreExtensionRepository.class); |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 1 |
Complexity Density: 0.09 |
1PASS
|
|
56 |
1 |
@Test... |
57 |
|
public void testInstallPlanWithSimpleRemoteExtensionOnRoot() throws Throwable |
58 |
|
{ |
59 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_SIMPLE_ID); |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
64 |
|
|
65 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
66 |
|
|
67 |
1 |
ExtensionPlanAction action = node.getAction(); |
68 |
|
|
69 |
1 |
Assert.assertEquals(TestResources.REMOTE_SIMPLE_ID, action.getExtension().getId()); |
70 |
1 |
Assert.assertEquals(Action.INSTALL, node.getAction().getAction()); |
71 |
1 |
Assert.assertNull(action.getPreviousExtension()); |
72 |
1 |
Assert.assertNull(action.getNamespace()); |
73 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
1 |
Assert.assertEquals(1, plan.getActions().size()); |
78 |
|
|
79 |
1 |
Assert.assertSame(action, plan.getActions().iterator().next()); |
80 |
|
} |
81 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
82 |
1 |
@Test... |
83 |
|
public void testInstallPlanWithRemoteDependencyOnRoot() throws Throwable |
84 |
|
{ |
85 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITHRDEPENDENCY_ID); |
86 |
|
|
87 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
88 |
|
|
89 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
90 |
|
|
91 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITHRDEPENDENCY_ID, node.getAction().getExtension().getId()); |
92 |
1 |
Assert.assertEquals(Action.INSTALL, node.getAction().getAction()); |
93 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
94 |
1 |
Assert.assertNull(node.getAction().getNamespace()); |
95 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
96 |
|
|
97 |
1 |
ExtensionPlanNode childnode = node.getChildren().iterator().next(); |
98 |
|
|
99 |
1 |
Assert.assertEquals(TestResources.REMOTE_SIMPLE_ID, childnode.getAction().getExtension().getId()); |
100 |
1 |
Assert.assertEquals(Action.INSTALL, node.getAction().getAction()); |
101 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
102 |
1 |
Assert.assertNull(childnode.getAction().getNamespace()); |
103 |
1 |
Assert.assertTrue(childnode.getChildren().isEmpty()); |
104 |
|
} |
105 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
106 |
1 |
@Test... |
107 |
|
public void testInstallPlanWithCoreDependencyOnRoot() throws Throwable |
108 |
|
{ |
109 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITHCDEPENDENCY_ID); |
110 |
|
|
111 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
112 |
|
|
113 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
114 |
|
|
115 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITHCDEPENDENCY_ID, node.getAction().getExtension().getId()); |
116 |
1 |
Assert.assertEquals(Action.INSTALL, node.getAction().getAction()); |
117 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
118 |
1 |
Assert.assertNull(node.getAction().getNamespace()); |
119 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
120 |
|
|
121 |
1 |
ExtensionPlanNode childnode = node.getChildren().iterator().next(); |
122 |
|
|
123 |
1 |
Assert.assertTrue(childnode.getAction().getExtension() instanceof CoreExtension); |
124 |
1 |
Assert.assertEquals(TestResources.CORE_ID, childnode.getAction().getExtension().getId()); |
125 |
1 |
Assert.assertEquals(Action.NONE, childnode.getAction().getAction()); |
126 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
127 |
1 |
Assert.assertTrue(childnode.getChildren().isEmpty()); |
128 |
|
} |
129 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 1 |
Complexity Density: 0.07 |
1PASS
|
|
130 |
1 |
@Test... |
131 |
|
public void testInstallPlanWithInstalledDependencyOnRoot() throws Throwable |
132 |
|
{ |
133 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITHLDEPENDENCY_ID); |
134 |
|
|
135 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
136 |
|
|
137 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
138 |
|
|
139 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITHLDEPENDENCY_ID, node.getAction().getExtension().getId()); |
140 |
1 |
Assert.assertEquals(Action.INSTALL, node.getAction().getAction()); |
141 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
142 |
1 |
Assert.assertNull(node.getAction().getNamespace()); |
143 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
144 |
|
|
145 |
1 |
ExtensionPlanNode childnode = node.getChildren().iterator().next(); |
146 |
|
|
147 |
1 |
Assert.assertTrue(childnode.getAction().getExtension() instanceof LocalExtension); |
148 |
1 |
Assert.assertEquals(TestResources.INSTALLED_ID, childnode.getAction().getExtension().getId()); |
149 |
1 |
Assert.assertEquals(Action.NONE, childnode.getAction().getAction()); |
150 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
151 |
1 |
Assert.assertTrue(childnode.getChildren().isEmpty()); |
152 |
|
} |
153 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
154 |
1 |
@Test... |
155 |
|
public void testInstallPlanWithUpgradeOnRoot() throws Throwable |
156 |
|
{ |
157 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID); |
158 |
|
|
159 |
|
|
160 |
|
|
161 |
|
|
162 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADE20_ID); |
163 |
|
|
164 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
165 |
|
|
166 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
167 |
|
|
168 |
1 |
ExtensionPlanAction action = node.getAction(); |
169 |
|
|
170 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getExtension().getId()); |
171 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
172 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getPreviousExtension().getId()); |
173 |
1 |
Assert.assertNull(action.getNamespace()); |
174 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
175 |
|
} |
176 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
177 |
1 |
@Test... |
178 |
|
public void testInstallPlanWithUpgradeOnDifferentId() throws Throwable |
179 |
|
{ |
180 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_NOTINSTALLED_ID); |
181 |
|
|
182 |
1 |
Iterator<ExtensionPlanNode> it = plan.getTree().iterator(); |
183 |
|
|
184 |
1 |
ExtensionPlanNode node = it.next(); |
185 |
1 |
ExtensionPlanAction action = node.getAction(); |
186 |
1 |
Assert.assertEquals(TestResources.INSTALLED_ID, action.getExtension().getId()); |
187 |
1 |
Assert.assertEquals(Action.UNINSTALL, action.getAction()); |
188 |
1 |
Assert.assertNull(action.getNamespace()); |
189 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
190 |
|
|
191 |
1 |
node = it.next(); |
192 |
1 |
action = node.getAction(); |
193 |
1 |
Assert.assertEquals(TestResources.INSTALLED_DEPENDENCY_ID, action.getExtension().getId()); |
194 |
1 |
Assert.assertEquals(Action.UNINSTALL, action.getAction()); |
195 |
1 |
Assert.assertNull(action.getNamespace()); |
196 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
197 |
|
|
198 |
1 |
node = it.next(); |
199 |
1 |
action = node.getAction(); |
200 |
1 |
Assert.assertEquals(TestResources.REMOTE_NOTINSTALLED_ID, action.getExtension().getId()); |
201 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
202 |
1 |
Assert.assertEquals(TestResources.INSTALLED_ID, action.getPreviousExtension().getId()); |
203 |
1 |
Assert.assertNull(action.getNamespace()); |
204 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
205 |
|
|
206 |
1 |
node = node.getChildren().iterator().next(); |
207 |
1 |
action = node.getAction(); |
208 |
1 |
Assert.assertEquals(TestResources.REMOTE_NOTINSTALLED_DEPENDENCY_ID, action.getExtension().getId()); |
209 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
210 |
1 |
Assert.assertEquals(TestResources.INSTALLED_DEPENDENCY_ID, action.getPreviousExtension().getId()); |
211 |
1 |
Assert.assertNull(action.getNamespace()); |
212 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
213 |
|
} |
214 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (18) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
215 |
1 |
@Test... |
216 |
|
public void testInstallPlanWithUpgradeFeatureWithDifferentVersion() throws Throwable |
217 |
|
{ |
218 |
1 |
install(TestResources.REMOTE_UPGRADEFEATURE20_ID); |
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADEWITHFEATURE10_ID); |
224 |
|
|
225 |
1 |
Assert.assertEquals(2, plan.getTree().size()); |
226 |
|
|
227 |
1 |
Iterator<ExtensionPlanNode> it = plan.getTree().iterator(); |
228 |
|
|
229 |
|
|
230 |
|
|
231 |
1 |
ExtensionPlanNode node1 = it.next(); |
232 |
|
|
233 |
1 |
ExtensionPlanAction action1 = node1.getAction(); |
234 |
|
|
235 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEFEATURE20_ID, action1.getExtension().getId()); |
236 |
1 |
Assert.assertEquals(Action.UNINSTALL, action1.getAction()); |
237 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEFEATURE20_ID, action1.getPreviousExtension().getId()); |
238 |
1 |
Assert.assertNull(action1.getNamespace()); |
239 |
1 |
Assert.assertEquals(0, node1.getChildren().size()); |
240 |
|
|
241 |
|
|
242 |
|
|
243 |
1 |
ExtensionPlanNode node2 = it.next(); |
244 |
|
|
245 |
1 |
ExtensionPlanAction action2 = node2.getAction(); |
246 |
|
|
247 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEWITHFEATURE10_ID, action2.getExtension().getId()); |
248 |
1 |
Assert.assertEquals(Action.UPGRADE, action2.getAction()); |
249 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEFEATURE20_ID, action2.getPreviousExtension().getId()); |
250 |
1 |
Assert.assertNull(action2.getNamespace()); |
251 |
1 |
Assert.assertEquals(0, node2.getChildren().size()); |
252 |
|
} |
253 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
254 |
1 |
@Test... |
255 |
|
public void testInstallPlanWithDowngradeOnRoot() throws Throwable |
256 |
|
{ |
257 |
1 |
install(TestResources.REMOTE_UPGRADE20_ID); |
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADE10_ID); |
263 |
|
|
264 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
265 |
|
|
266 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
267 |
|
|
268 |
1 |
ExtensionPlanAction action = node.getAction(); |
269 |
|
|
270 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getExtension().getId()); |
271 |
1 |
Assert.assertEquals(Action.DOWNGRADE, action.getAction()); |
272 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getPreviousExtension().getId()); |
273 |
1 |
Assert.assertNull(action.getNamespace()); |
274 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
275 |
|
} |
276 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
277 |
1 |
@Test... |
278 |
|
public void testInstallOnNamespaceThenOnRoot() throws Throwable |
279 |
|
{ |
280 |
|
|
281 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID, "namespace"); |
282 |
|
|
283 |
|
|
284 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADE10_ID); |
285 |
|
|
286 |
1 |
Assert.assertEquals(2, plan.getTree().size()); |
287 |
|
|
288 |
1 |
Iterator<ExtensionPlanNode> it = plan.getTree().iterator(); |
289 |
|
|
290 |
1 |
ExtensionPlanNode node = it.next(); |
291 |
1 |
ExtensionPlanAction action = node.getAction(); |
292 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getExtension().getId()); |
293 |
1 |
Assert.assertEquals(Action.UNINSTALL, action.getAction()); |
294 |
1 |
Assert.assertEquals(1, action.getPreviousExtensions().size()); |
295 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getPreviousExtension().getId()); |
296 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
297 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
298 |
|
|
299 |
1 |
node = it.next(); |
300 |
1 |
action = node.getAction(); |
301 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getExtension().getId()); |
302 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
303 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
304 |
1 |
Assert.assertEquals(null, action.getNamespace()); |
305 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
306 |
|
} |
307 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
1PASS
|
|
308 |
1 |
@Test... |
309 |
|
public void testInstallOnNamespaceThenUnpgradeOnRoot() throws Throwable |
310 |
|
{ |
311 |
|
|
312 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID, "namespace"); |
313 |
|
|
314 |
|
|
315 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADE20_ID); |
316 |
|
|
317 |
1 |
Assert.assertEquals(2, plan.getTree().size()); |
318 |
|
|
319 |
1 |
Iterator<ExtensionPlanNode> it = plan.getTree().iterator(); |
320 |
|
|
321 |
1 |
ExtensionPlanNode node = it.next(); |
322 |
1 |
ExtensionPlanAction action = node.getAction(); |
323 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getExtension().getId()); |
324 |
1 |
Assert.assertEquals(Action.UNINSTALL, action.getAction()); |
325 |
1 |
Assert.assertEquals(1, action.getPreviousExtensions().size()); |
326 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getPreviousExtension().getId()); |
327 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
328 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
329 |
|
|
330 |
1 |
node = it.next(); |
331 |
1 |
action = node.getAction(); |
332 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getExtension().getId()); |
333 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
334 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
335 |
1 |
Assert.assertEquals(null, action.getNamespace()); |
336 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
337 |
|
} |
338 |
|
|
339 |
|
|
340 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
341 |
1 |
@Test(expected = InstallException.class)... |
342 |
|
public void testInstallPlanWithUnsupportedType() throws Throwable |
343 |
|
{ |
344 |
1 |
installPlan(TestResources.REMOTE_UNSUPPORTED_ID); |
345 |
|
} |
346 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
347 |
1 |
@Test(expected = InstallException.class)... |
348 |
|
public void testInstallPlanWithCoreExtension() throws Throwable |
349 |
|
{ |
350 |
1 |
this.coreRepository.addExtensions(TestResources.REMOTE_SIMPLE_ID.getId(), new DefaultVersion("version")); |
351 |
|
|
352 |
1 |
installPlan(TestResources.REMOTE_SIMPLE_ID); |
353 |
|
} |
354 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
355 |
1 |
@Test(expected = InstallException.class)... |
356 |
|
public void testInstallPlanWithFeatureAsCoreExtension() throws Throwable |
357 |
|
{ |
358 |
1 |
this.coreRepository.addExtensions("rsimple-feature", new DefaultVersion("version")); |
359 |
|
|
360 |
1 |
installPlan(TestResources.REMOTE_SIMPLE_ID); |
361 |
|
} |
362 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
363 |
1 |
@Test(expected = InstallException.class)... |
364 |
|
public void testInstallPlanWithFeatureAsCoreExtensionFeature() throws Throwable |
365 |
|
{ |
366 |
1 |
this.coreRepository.addExtensions("coreextension", new DefaultVersion("version"), |
367 |
|
new ExtensionId("rsimple-feature")); |
368 |
|
|
369 |
1 |
installPlan(TestResources.REMOTE_SIMPLE_ID); |
370 |
|
} |
371 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
372 |
1 |
@Test(expected = InstallException.class)... |
373 |
|
public void testInstallPlanWithCoreExtensionFeature() throws Throwable |
374 |
|
{ |
375 |
1 |
this.coreRepository.addExtensions("coreextension", new DefaultVersion("version"), |
376 |
|
new ExtensionId(TestResources.REMOTE_SIMPLE_ID.getId())); |
377 |
|
|
378 |
1 |
installPlan(TestResources.REMOTE_SIMPLE_ID); |
379 |
|
} |
380 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
381 |
1 |
@Test(expected = InstallException.class)... |
382 |
|
public void testInstallPlanWithLowerCoreDependencyFeature() throws Throwable |
383 |
|
{ |
384 |
1 |
this.coreRepository.addExtensions("coreextension", new DefaultVersion("3.0"), |
385 |
|
TestResources.REMOTE_UPGRADE10_ID); |
386 |
|
|
387 |
1 |
installPlan(TestResources.REMOTE_UPGRADEWITHDEPENDENCY20_ID); |
388 |
|
} |
389 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
390 |
1 |
@Test... |
391 |
|
public void testInstallPlanWithHigherCoreDependencyFeature() throws Throwable |
392 |
|
{ |
393 |
1 |
this.coreRepository.addExtensions("coreextension", new DefaultVersion("0.5"), |
394 |
|
TestResources.REMOTE_UPGRADE20_ID); |
395 |
|
|
396 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADEWITHDEPENDENCY10_ID); |
397 |
|
|
398 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
399 |
|
|
400 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
401 |
|
|
402 |
1 |
ExtensionPlanAction action = node.getAction(); |
403 |
|
|
404 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEWITHDEPENDENCY10_ID, action.getExtension().getId()); |
405 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
406 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
407 |
1 |
Assert.assertNull(action.getNamespace()); |
408 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
409 |
|
|
410 |
1 |
ExtensionPlanNode childnode = node.getChildren().iterator().next(); |
411 |
|
|
412 |
1 |
Assert.assertTrue(childnode.getAction().getExtension() instanceof CoreExtension); |
413 |
1 |
Assert.assertEquals(new ExtensionId("coreextension", "0.5"), childnode.getAction().getExtension().getId()); |
414 |
1 |
Assert.assertEquals(Action.NONE, childnode.getAction().getAction()); |
415 |
1 |
Assert.assertNull(node.getAction().getPreviousExtension()); |
416 |
1 |
Assert.assertTrue(childnode.getChildren().isEmpty()); |
417 |
|
} |
418 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
419 |
1 |
@Test... |
420 |
|
public void testReInstalledWithMissingDependency() throws Throwable |
421 |
|
{ |
422 |
1 |
ExtensionPlan plan = installPlan(TestResources.INSTALLED_WITHMISSINDEPENDENCY_ID); |
423 |
|
|
424 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
425 |
|
|
426 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
427 |
|
|
428 |
1 |
ExtensionPlanAction action = node.getAction(); |
429 |
|
|
430 |
1 |
Assert.assertEquals(TestResources.INSTALLED_WITHMISSINDEPENDENCY_ID, action.getExtension().getId()); |
431 |
1 |
Assert.assertEquals(Action.REPAIR, action.getAction()); |
432 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
433 |
1 |
Assert.assertNull(action.getNamespace()); |
434 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
435 |
|
|
436 |
1 |
node = node.getChildren().iterator().next(); |
437 |
1 |
action = node.getAction(); |
438 |
|
|
439 |
1 |
Assert.assertEquals(TestResources.REMOTE_MISSINGDEPENDENCY_ID, action.getExtension().getId()); |
440 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
441 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
442 |
1 |
Assert.assertNull(action.getNamespace()); |
443 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
444 |
|
} |
445 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
446 |
1 |
@Test... |
447 |
|
public void testInstallRemoteWithMissingDependency() throws Throwable |
448 |
|
{ |
449 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITHRMISSINGDEPENDENCY_ID); |
450 |
|
|
451 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
452 |
|
|
453 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
454 |
1 |
ExtensionPlanAction action = node.getAction(); |
455 |
|
|
456 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITHRMISSINGDEPENDENCY_ID, action.getExtension().getId()); |
457 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
458 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
459 |
1 |
Assert.assertNull(action.getNamespace()); |
460 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
461 |
|
|
462 |
1 |
node = node.getChildren().iterator().next(); |
463 |
1 |
action = node.getAction(); |
464 |
|
|
465 |
1 |
Assert.assertEquals(TestResources.INSTALLED_WITHMISSINDEPENDENCY_ID, action.getExtension().getId()); |
466 |
1 |
Assert.assertEquals(Action.REPAIR, action.getAction()); |
467 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
468 |
1 |
Assert.assertNull(action.getNamespace()); |
469 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
470 |
|
|
471 |
1 |
node = node.getChildren().iterator().next(); |
472 |
1 |
action = node.getAction(); |
473 |
|
|
474 |
1 |
Assert.assertEquals(TestResources.REMOTE_MISSINGDEPENDENCY_ID, action.getExtension().getId()); |
475 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
476 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
477 |
1 |
Assert.assertNull(action.getNamespace()); |
478 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
479 |
|
} |
480 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 1 |
Complexity Density: 0.1 |
1PASS
|
|
481 |
1 |
@Test... |
482 |
|
public void testInstallNameSpaceExtensionWithExistingRootExtension() throws Throwable |
483 |
|
{ |
484 |
|
|
485 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID); |
486 |
|
|
487 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_UPGRADE20_ID, "namespace"); |
488 |
|
|
489 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
490 |
|
|
491 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
492 |
1 |
ExtensionPlanAction action = node.getAction(); |
493 |
|
|
494 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getExtension().getId()); |
495 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
496 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getPreviousExtension().getId()); |
497 |
1 |
Assert.assertEquals(null, action.getNamespace()); |
498 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
499 |
|
} |
500 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
501 |
1 |
@Test... |
502 |
|
public void testInstallNameSpaceExtensionWithDependencyAllowedOnRootOnly() throws Throwable |
503 |
|
{ |
504 |
|
|
505 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITH_ROOT_DEPENDENY10_ID, "namespace"); |
506 |
|
|
507 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
508 |
|
|
509 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
510 |
1 |
ExtensionPlanAction action = node.getAction(); |
511 |
|
|
512 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_ROOT_DEPENDENY10_ID, action.getExtension().getId()); |
513 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
514 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
515 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
516 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
517 |
|
|
518 |
1 |
node = node.getChildren().iterator().next(); |
519 |
1 |
action = node.getAction(); |
520 |
|
|
521 |
1 |
Assert.assertEquals(TestResources.REMOTE_ROOTEXTENSION10_ID, action.getExtension().getId()); |
522 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
523 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
524 |
1 |
Assert.assertNull(action.getNamespace()); |
525 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
526 |
|
} |
527 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
528 |
1 |
@Test... |
529 |
|
public void testUpgradeExtensionOnNamespaceWithDependencyAllowedOnRootOnly() throws Throwable |
530 |
|
{ |
531 |
|
|
532 |
1 |
install(TestResources.REMOTE_WITH_ROOT_DEPENDENY10_ID, "namespace"); |
533 |
|
|
534 |
|
|
535 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITH_ROOT_DEPENDENY20_ID, "namespace"); |
536 |
|
|
537 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
538 |
|
|
539 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
540 |
1 |
ExtensionPlanAction action = node.getAction(); |
541 |
|
|
542 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_ROOT_DEPENDENY20_ID, action.getExtension().getId()); |
543 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
544 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_ROOT_DEPENDENY10_ID, action.getPreviousExtension().getId()); |
545 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
546 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
547 |
|
|
548 |
1 |
node = node.getChildren().iterator().next(); |
549 |
1 |
action = node.getAction(); |
550 |
|
|
551 |
1 |
Assert.assertEquals(TestResources.REMOTE_ROOTEXTENSION20_ID, action.getExtension().getId()); |
552 |
1 |
Assert.assertEquals(Action.UPGRADE, action.getAction()); |
553 |
1 |
Assert.assertEquals(TestResources.REMOTE_ROOTEXTENSION10_ID, action.getPreviousExtension().getId()); |
554 |
1 |
Assert.assertNull(action.getNamespace()); |
555 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
556 |
|
} |
557 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
558 |
1 |
@Test... |
559 |
|
public void testInstallWithOverwrittenManagedDependency() throws Throwable |
560 |
|
{ |
561 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITH_OVERWRITTEN_MANAGED_DEPENDENY_ID, "namespace"); |
562 |
|
|
563 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
564 |
|
|
565 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
566 |
1 |
ExtensionPlanAction action = node.getAction(); |
567 |
|
|
568 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_MANAGED_DEPENDENY_ID, action.getExtension().getId()); |
569 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
570 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
571 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
572 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
573 |
|
|
574 |
1 |
node = node.getChildren().iterator().next(); |
575 |
1 |
action = node.getAction(); |
576 |
|
|
577 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getExtension().getId()); |
578 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
579 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
580 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
581 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
582 |
|
} |
583 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (23) |
Complexity: 1 |
Complexity Density: 0.04 |
1PASS
|
|
584 |
1 |
@Test... |
585 |
|
public void testInstallWithManagedTransitiveDependency() throws Throwable |
586 |
|
{ |
587 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITH_MANAGED_TRANSITIVEDEPENDENY_ID, "namespace"); |
588 |
|
|
589 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
590 |
|
|
591 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
592 |
1 |
ExtensionPlanAction action = node.getAction(); |
593 |
|
|
594 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_MANAGED_DEPENDENY_ID, action.getExtension().getId()); |
595 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
596 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
597 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
598 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
599 |
|
|
600 |
1 |
node = node.getChildren().iterator().next(); |
601 |
1 |
action = node.getAction(); |
602 |
|
|
603 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADEWITHDEPENDENCY10_ID, action.getExtension().getId()); |
604 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
605 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
606 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
607 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
608 |
|
|
609 |
1 |
node = node.getChildren().iterator().next(); |
610 |
1 |
action = node.getAction(); |
611 |
|
|
612 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE20_ID, action.getExtension().getId()); |
613 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
614 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
615 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
616 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
617 |
|
} |
618 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 1 |
Complexity Density: 0.06 |
1PASS
|
|
619 |
1 |
@Test... |
620 |
|
public void testInstallWithManagedDependency() throws Throwable |
621 |
|
{ |
622 |
1 |
ExtensionPlan plan = installPlan(TestResources.REMOTE_WITH_MANAGED_DEPENDENY_ID, "namespace"); |
623 |
|
|
624 |
1 |
Assert.assertEquals(1, plan.getTree().size()); |
625 |
|
|
626 |
1 |
ExtensionPlanNode node = plan.getTree().iterator().next(); |
627 |
1 |
ExtensionPlanAction action = node.getAction(); |
628 |
|
|
629 |
1 |
Assert.assertEquals(TestResources.REMOTE_WITH_MANAGED_DEPENDENY_ID, action.getExtension().getId()); |
630 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
631 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
632 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
633 |
1 |
Assert.assertEquals(1, node.getChildren().size()); |
634 |
|
|
635 |
1 |
node = node.getChildren().iterator().next(); |
636 |
1 |
action = node.getAction(); |
637 |
|
|
638 |
1 |
Assert.assertEquals(TestResources.REMOTE_UPGRADE10_ID, action.getExtension().getId()); |
639 |
1 |
Assert.assertEquals(Action.INSTALL, action.getAction()); |
640 |
1 |
Assert.assertEquals(0, action.getPreviousExtensions().size()); |
641 |
1 |
Assert.assertEquals("namespace", action.getNamespace()); |
642 |
1 |
Assert.assertEquals(0, node.getChildren().size()); |
643 |
|
} |
644 |
|
|
645 |
|
|
646 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
647 |
1 |
@Test(expected = InstallException.class)... |
648 |
|
public void testForbiddenInstallLowerVersionOfDependencyOnRoot() throws Throwable |
649 |
|
{ |
650 |
|
|
651 |
1 |
install(TestResources.REMOTE_UPGRADEWITHDEPENDENCY20_ID, "namespace"); |
652 |
|
|
653 |
1 |
installPlan(TestResources.REMOTE_UPGRADE10_ID, false); |
654 |
|
} |
655 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
656 |
1 |
@Test(expected = InstallException.class)... |
657 |
|
public void testForbiddenInstallNameSpaceExtensionWithExistingRootExtension() throws Throwable |
658 |
|
{ |
659 |
|
|
660 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID); |
661 |
|
|
662 |
1 |
installPlan(TestResources.REMOTE_UPGRADE20_ID, "namespace", false); |
663 |
|
} |
664 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1PASS
|
|
665 |
1 |
@Test(expected = InstallException.class)... |
666 |
|
public void testForbiddenInstallNameSpaceExtensionWithIncompatibleRootDependency() throws Throwable |
667 |
|
{ |
668 |
|
|
669 |
1 |
install(TestResources.REMOTE_UPGRADE10_ID); |
670 |
|
|
671 |
1 |
installPlan(TestResources.REMOTE_UPGRADEWITHDEPENDENCY20_ID, "namespace", false); |
672 |
|
} |
673 |
|
|
|
|
| 80% |
Uncovered Elements: 1 (5) |
Complexity: 2 |
Complexity Density: 0.4 |
1PASS
|
|
674 |
1 |
@Test... |
675 |
|
public void testForbiddenInstallExtensionOnIncompatibleNamespace() throws Throwable |
676 |
|
{ |
677 |
|
|
678 |
1 |
install(TestResources.REMOTE_ROOTEXTENSION10_ID); |
679 |
1 |
uninstall(TestResources.REMOTE_ROOTEXTENSION10_ID, null); |
680 |
|
|
681 |
|
|
682 |
1 |
try { |
683 |
1 |
install(TestResources.REMOTE_ROOTEXTENSION10_ID, "namespace", false); |
684 |
|
|
685 |
0 |
fail("Should not be allowed to install [" + TestResources.REMOTE_ROOTEXTENSION10_ID |
686 |
|
+ "] on namespace [namespace]"); |
687 |
|
} catch (InstallException e) { |
688 |
|
|
689 |
|
} |
690 |
|
} |
691 |
|
} |