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.imaging; |
35 |
|
|
36 |
|
import static org.mockito.Mockito.*; |
37 |
|
|
38 |
|
import info.magnolia.audit.AuditLoggingManager; |
39 |
|
import info.magnolia.imaging.operations.load.DefaultImageIOImageDecoder; |
40 |
|
import info.magnolia.imaging.operations.load.ImageDecoder; |
41 |
|
import info.magnolia.module.ModuleManagementException; |
42 |
|
import info.magnolia.module.ModuleManager; |
43 |
|
import info.magnolia.module.ModuleManagerImpl; |
44 |
|
import info.magnolia.module.ModuleRegistry; |
45 |
|
import info.magnolia.module.model.ModuleDefinition; |
46 |
|
import info.magnolia.module.model.reader.ModuleDefinitionReader; |
47 |
|
import info.magnolia.test.ComponentsTestUtil; |
48 |
|
import info.magnolia.test.RepositoryTestCase; |
49 |
|
|
50 |
|
import java.io.IOException; |
51 |
|
import java.io.Reader; |
52 |
|
import java.util.ArrayList; |
53 |
|
import java.util.HashMap; |
54 |
|
import java.util.List; |
55 |
|
import java.util.Map; |
56 |
|
|
57 |
|
import org.junit.After; |
58 |
|
import org.junit.Before; |
59 |
|
|
60 |
|
|
61 |
|
@link |
62 |
|
|
|
|
| 58.3% |
Uncovered Elements: 10 (24) |
Complexity: 7 |
Complexity Density: 0.41 |
|
63 |
|
public abstract class AbstractRepositoryTestCase extends RepositoryTestCase { |
64 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
65 |
23 |
@Override... |
66 |
|
@Before |
67 |
|
public void setUp() throws Exception { |
68 |
23 |
super.setUp(); |
69 |
23 |
ComponentsTestUtil.setInstance(AuditLoggingManager.class, new AuditLoggingManager()); |
70 |
|
|
71 |
23 |
ComponentsTestUtil.setImplementation(ImageDecoder.class, DefaultImageIOImageDecoder.class); |
72 |
|
} |
73 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
74 |
23 |
@Override... |
75 |
|
@After |
76 |
|
public void tearDown() throws Exception { |
77 |
|
|
78 |
23 |
super.tearDown(); |
79 |
23 |
ComponentsTestUtil.clear(); |
80 |
|
} |
81 |
|
|
82 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
83 |
23 |
@Override... |
84 |
|
protected void initDefaultImplementations() throws IOException, ModuleManagementException { |
85 |
|
|
86 |
23 |
ModuleRegistry registry = mock(ModuleRegistry.class); |
87 |
23 |
ComponentsTestUtil.setInstance(ModuleRegistry.class, registry); |
88 |
|
|
89 |
23 |
final ModuleDefinitionReader fakeReader = new ModuleDefinitionReader() { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
90 |
0 |
@Override... |
91 |
|
public ModuleDefinition read(Reader in) throws ModuleManagementException { |
92 |
0 |
return null; |
93 |
|
} |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
95 |
0 |
@Override... |
96 |
|
public Map readAll() throws ModuleManagementException { |
97 |
0 |
Map m = new HashMap(); |
98 |
0 |
m.put("moduleDef", "dummy"); |
99 |
0 |
return m; |
100 |
|
} |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0 |
@Override... |
103 |
|
public ModuleDefinition readFromResource(String resourcePath) throws ModuleManagementException { |
104 |
0 |
return null; |
105 |
|
} |
106 |
|
}; |
107 |
23 |
final ModuleManagerImpl fakeModuleManager = new ModuleManagerImpl(null, fakeReader) { |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
108 |
0 |
@Override... |
109 |
|
public List loadDefinitions() throws ModuleManagementException { |
110 |
|
|
111 |
0 |
return new ArrayList(); |
112 |
|
} |
113 |
|
}; |
114 |
23 |
ComponentsTestUtil.setInstance(ModuleManager.class, fakeModuleManager); |
115 |
23 |
super.initDefaultImplementations(); |
116 |
|
} |
117 |
|
} |