Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
59   260   18   4,54
0   112   0,31   13
13     1,38  
1    
 
  LoadRequiredModulesTest       Line # 32 59 18 90,3% 0.9027778
 
  (9)
 
1    /* $Id: LoadRequiredModulesTest.java,v 1.1 2008/07/26 07:59:15 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program is distributed in the hope that it will be useful,
13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    * GNU General Public License for more details.
16    */
17    package org.qedeq.kernel.bo.control;
18   
19    import org.qedeq.base.test.QedeqTestCase;
20    import org.qedeq.kernel.bo.context.KernelContext;
21    import org.qedeq.kernel.bo.service.DefaultModuleAddress;
22    import org.qedeq.kernel.bo.test.KernelFacade;
23    import org.qedeq.kernel.common.ModuleAddress;
24    import org.qedeq.kernel.common.SourceFileExceptionList;
25   
26    /**
27    * For testing of loading required QEDEQ modules.
28    *
29    * @version $Revision: 1.1 $
30    * @author Michael Meyling
31    */
 
32    public class LoadRequiredModulesTest extends QedeqTestCase{
33   
 
34  9 toggle protected void setUp() throws Exception {
35  9 super.setUp();
36  9 KernelFacade.startup();
37    }
38   
 
39  9 toggle protected void tearDown() throws Exception {
40  9 KernelFacade.shutdown();
41  9 super.tearDown();
42    }
43   
 
44  0 toggle public LoadRequiredModulesTest() {
45  0 super();
46    }
47   
 
48  9 toggle public LoadRequiredModulesTest(final String name) {
49  9 super(name);
50    }
51   
52    /**
53    * Load following dependencies:
54    * <pre>
55    * 011 -> 012
56    * 011 -> 013 -> 012
57    * </pre>
58    *
59    * @throws Exception
60    */
 
61  1 toggle public void testLoadRequiredModules_01() throws Exception {
62  1 final ModuleAddress address = new DefaultModuleAddress(getFile("loadRequired/LRM011.xml"));
63  1 KernelContext.getInstance().loadRequiredModules(address);
64    }
65   
66    /**
67    * Load following dependencies:
68    * <pre>
69    * 021 -> 021
70    * </pre>
71    *
72    * @throws Exception
73    */
 
74  1 toggle public void testLoadRequiredModules_02() throws Exception {
75  1 try {
76  1 final ModuleAddress address = new DefaultModuleAddress(
77    getFile("loadRequired/LRM021.xml"));
78  1 KernelContext.getInstance().loadRequiredModules(address);
79  0 fail("021 -> 021 cycle");
80    } catch (SourceFileExceptionList e) {
81  1 assertEquals(1, e.size());
82  1 assertEquals(31, e.get(0).getSourceArea().getStartPosition().getLine());
83  1 assertEquals(15, e.get(0).getSourceArea().getStartPosition().getColumn());
84    // TODO mime 20071101: check if exception code and description is ok
85    }
86    }
87   
88    /**
89    * Load following dependencies:
90    * <pre>
91    * 031 -> 032 -> 031
92    * </pre>
93    *
94    * @throws Exception
95    */
 
96  1 toggle public void testLoadRequiredModules_03() throws Exception {
97  1 try {
98  1 final ModuleAddress address = new DefaultModuleAddress(
99    getFile("loadRequired/LRM031.xml"));
100  1 KernelContext.getInstance().loadRequiredModules(address);
101  0 fail("031 -> 032 -> 031 cycle");
102    } catch (SourceFileExceptionList e) {
103  1 assertEquals(1, e.size());
104    // e.printStackTrace();
105  1 assertEquals(31, e.get(0).getSourceArea().getStartPosition().getLine());
106  1 assertEquals(15, e.get(0).getSourceArea().getStartPosition().getColumn());
107    // TODO mime 20071101: check if exception code and description is ok
108    }
109    }
110   
111    /**
112    * Load following dependencies:
113    * <pre>
114    * 041 -> 042 -> 043
115    * 041 -> 043 -> 044
116    * 041 -> 044 -> 042
117    * </pre>
118    *
119    * @throws Exception
120    */
 
121  1 toggle public void testLoadRequiredModules_04() throws Exception {
122  1 try {
123  1 final ModuleAddress address = new DefaultModuleAddress(
124    getFile("loadRequired/LRM041.xml"));
125  1 KernelContext.getInstance().loadRequiredModules(address);
126  0 fail("041 -> 042 -> 043 -> 044 -> 042 cycle\n"
127    + "041 -> 043 -> 044 -> 042 -> 043 cycle\n"
128    + "041 -> 044 -> 042 -> 043 -> 044 cycle");
129    } catch (SourceFileExceptionList e) {
130  1 assertEquals(31, e.get(0).getSourceArea().getStartPosition().getLine());
131  1 assertEquals(15, e.get(0).getSourceArea().getStartPosition().getColumn());
132  1 assertEquals(3, e.size());
133  1 assertEquals(38, e.get(1).getSourceArea().getStartPosition().getLine());
134  1 assertEquals(15, e.get(1).getSourceArea().getStartPosition().getColumn());
135  1 assertEquals(45, e.get(2).getSourceArea().getStartPosition().getLine());
136  1 assertEquals(15, e.get(2).getSourceArea().getStartPosition().getColumn());
137    // TODO mime 20071101: check if exception code and description is ok
138    }
139    }
140   
141    /**
142    * Load following dependencies:
143    * <pre>
144    * 051 -> 052 -> 053 -> 056
145    * 051 -> 052 -> 054 -> 056
146    * 051 -> 052 -> 055 -> 053 -> 056
147    * 051 -> 052 -> 055 -> 057
148    * 051 -> 053 -> 056
149    * 051 -> 054 -> 056
150    * 051 -> 055 -> 057
151    * </pre>
152    *
153    * @throws Exception
154    */
 
155  1 toggle public void testLoadRequiredModules_05() throws Exception {
156  1 final ModuleAddress address = new DefaultModuleAddress(
157    getFile("loadRequired/LRM051.xml"));
158  1 KernelContext.getInstance().loadRequiredModules(address);
159    }
160   
161    /**
162    * Load following dependencies:
163    * <pre>
164    * 061 -> 062 -> 063 -> 066 -> 067
165    * 061 -> 062 -> 064 -> 066 -> 067
166    * 061 -> 062 -> 065 -> 063 -> 066 -> 067
167    * 061 -> 062 -> 065 -> 067
168    * 061 -> 063 -> 066 -> 067
169    * 061 -> 064 -> 066 -> 067
170    * 061 -> 065 -> 067
171    * </pre>
172    *
173    * @throws Exception
174    */
 
175  1 toggle public void testLoadRequiredModules_06() throws Exception {
176  1 final ModuleAddress address = new DefaultModuleAddress(getFile("loadRequired/LRM061.xml"));
177  1 KernelContext.getInstance().loadRequiredModules(address);
178    }
179   
180    /**
181    * Load following dependencies:
182    * <pre>
183    * 071 -> 072 -> 073 -> 076 -> 077
184    * 071 -> 072 -> 073 -> 076 -> 071 c
185    * 071 -> 072 -> 073 -> 075 -> 073 c
186    * 071 -> 072 -> 073 -> 075 -> 077
187    * 071 -> 072 -> 074 -> 076 -> 077
188    * 071 -> 072 -> 074 -> 076 -> 071 c
189    * 071 -> 072 -> 075 -> 073 -> 076 -> 077
190    * 071 -> 072 -> 075 -> 073 -> 075 c
191    * 071 -> 072 -> 075 -> 077
192    * 071 -> 073 -> 076 -> 077
193    * 071 -> 073 -> 076 -> 071 c
194    * 071 -> 073 -> 075 -> 073 c
195    * 071 -> 074 -> 076 -> 077
196    * 071 -> 074 -> 076 -> 071 c
197    * 071 -> 075 -> 073 -> 076 -> 077
198    * 071 -> 075 -> 073 -> 076 -> 071 c
199    * 071 -> 075 -> 073 -> 075 - >073 c
200    * </pre>
201    *
202    * @throws Exception
203    */
 
204  1 toggle public void testLoadRequiredModules_07() throws Exception {
205  1 try {
206  1 final ModuleAddress address = new DefaultModuleAddress(
207    getFile("loadRequired/LRM071.xml"));
208  1 KernelContext.getInstance().loadRequiredModules(address);
209  0 fail("see test method description");
210    } catch (SourceFileExceptionList e) {
211    // e.printStackTrace(System.out);
212  1 assertEquals(31, e.get(0).getSourceArea().getStartPosition().getLine());
213  1 assertEquals(15, e.get(0).getSourceArea().getStartPosition().getColumn());
214  1 assertEquals(4, e.size());
215  1 assertEquals(38, e.get(1).getSourceArea().getStartPosition().getLine());
216  1 assertEquals(15, e.get(1).getSourceArea().getStartPosition().getColumn());
217  1 assertEquals(45, e.get(2).getSourceArea().getStartPosition().getLine());
218  1 assertEquals(15, e.get(2).getSourceArea().getStartPosition().getColumn());
219  1 assertEquals(52, e.get(3).getSourceArea().getStartPosition().getLine());
220  1 assertEquals(15, e.get(3).getSourceArea().getStartPosition().getColumn());
221    // TODO mime 20071105: check if exception code and description is ok
222    }
223    }
224   
225    /**
226    * Load following dependencies:
227    * <pre>
228    * 081 -> 082 -> 083 -> 084 -> 085 -> 086 -> 087 -> 089
229    * </pre>
230    *
231    * @throws Exception
232    */
 
233  1 toggle public void testLoadRequiredModules_08() throws Exception {
234  1 final ModuleAddress address = new DefaultModuleAddress(getFile("loadRequired/LRM081.xml"));
235  1 KernelContext.getInstance().loadRequiredModules(address);
236    }
237   
238    /**
239    * Load following dependencies:
240    * <pre>
241    * 091 -> 092 -> 093 -> 094 -> 095 -> 096 -> 097 -> 099 -> 091
242    * </pre>
243    *
244    * @throws Exception
245    */
 
246  1 toggle public void testLoadRequiredModules_09() throws Exception {
247  1 try {
248  1 final ModuleAddress address = new DefaultModuleAddress(
249    getFile("loadRequired/LRM091.xml"));
250  1 KernelContext.getInstance().loadRequiredModules(address);
251  0 fail("091 -> 092 -> 093 -> 094 -> 095 -> 096 -> 097 -> 098 -> 099 -> 091 cycle\n");
252    } catch (SourceFileExceptionList e) {
253  1 assertEquals(31, e.get(0).getSourceArea().getStartPosition().getLine());
254  1 assertEquals(15, e.get(0).getSourceArea().getStartPosition().getColumn());
255  1 assertEquals(1, e.size());
256    // TODO mime 20071105: check if exception code and description is ok
257    }
258    }
259   
260    }