1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package org.xwiki.security.authorization; |
22 |
|
|
23 |
|
import org.junit.Before; |
24 |
|
import org.xwiki.context.Execution; |
25 |
|
import org.xwiki.context.ExecutionContext; |
26 |
|
import org.xwiki.observation.EventListener; |
27 |
|
import org.xwiki.security.authorization.testwikibuilding.LegacyTestWiki; |
28 |
|
import org.xwiki.test.annotation.AllComponents; |
29 |
|
import org.xwiki.test.jmock.AbstractComponentTestCase; |
30 |
|
|
31 |
|
import com.xpn.xwiki.XWikiContext; |
32 |
|
import com.xpn.xwiki.web.Utils; |
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
@version |
38 |
|
@since |
39 |
|
|
40 |
|
@AllComponents |
|
|
| 100% |
Uncovered Elements: 0 (17) |
Complexity: 4 |
Complexity Density: 0.31 |
|
41 |
|
public abstract class AbstractWikiTestCase extends AbstractComponentTestCase |
42 |
|
{ |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
private ExecutionContext executionContext; |
47 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
48 |
18 |
@Before... |
49 |
|
@Override |
50 |
|
public void setUp() throws Exception |
51 |
|
{ |
52 |
18 |
super.setUp(); |
53 |
|
|
54 |
18 |
this.executionContext = new ExecutionContext(); |
55 |
18 |
Execution execution = getComponentManager().getInstance(Execution.class); |
56 |
18 |
execution.setContext(this.executionContext); |
57 |
18 |
Utils.setComponentManager(getComponentManager()); |
58 |
|
} |
59 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
60 |
18 |
@Override... |
61 |
|
protected void registerComponents() throws Exception |
62 |
|
{ |
63 |
18 |
super.registerComponents(); |
64 |
|
|
65 |
|
|
66 |
18 |
getComponentManager().unregisterComponent(EventListener.class, "XObjectEventGeneratorListener"); |
67 |
18 |
getComponentManager().unregisterComponent(EventListener.class, "AttachmentEventGeneratorListener"); |
68 |
18 |
getComponentManager().unregisterComponent(EventListener.class, "XClassPropertyEventGeneratorListener"); |
69 |
|
} |
70 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
71 |
93 |
protected void setContext(XWikiContext ctx)... |
72 |
|
{ |
73 |
93 |
this.executionContext.setProperty(XWikiContext.EXECUTIONCONTEXT_KEY, ctx); |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
@param |
78 |
|
@return |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
80 |
10 |
protected LegacyTestWiki newTestWiki(String filename, boolean legacymock) throws Exception... |
81 |
|
{ |
82 |
10 |
LegacyTestWiki testWiki = new LegacyTestWiki(getMockery(), getComponentManager(), filename, legacymock); |
83 |
10 |
setContext(testWiki.getXWikiContext()); |
84 |
10 |
return testWiki; |
85 |
|
} |
86 |
|
} |