1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.bo.service.latex; |
17 |
|
|
18 |
|
import java.io.File; |
19 |
|
import java.io.IOException; |
20 |
|
import java.io.InputStream; |
21 |
|
import java.util.HashMap; |
22 |
|
import java.util.Map; |
23 |
|
|
24 |
|
import org.qedeq.base.io.IoUtility; |
25 |
|
import org.qedeq.base.io.Parameters; |
26 |
|
import org.qedeq.base.io.UrlUtility; |
27 |
|
import org.qedeq.base.trace.Trace; |
28 |
|
import org.qedeq.kernel.bo.common.QedeqBo; |
29 |
|
import org.qedeq.kernel.bo.job.InternalServiceJobImpl; |
30 |
|
import org.qedeq.kernel.bo.job.InternalModuleServiceCallImpl; |
31 |
|
import org.qedeq.kernel.bo.logic.common.LogicalCheckException; |
32 |
|
import org.qedeq.kernel.bo.module.InternalModuleServiceCall; |
33 |
|
import org.qedeq.kernel.bo.module.KernelQedeqBo; |
34 |
|
import org.qedeq.kernel.bo.service.internal.ModuleArbiterImpl; |
35 |
|
import org.qedeq.kernel.bo.test.DummyPlugin; |
36 |
|
import org.qedeq.kernel.bo.test.QedeqBoTestCase; |
37 |
|
import org.qedeq.kernel.se.common.DefaultModuleAddress; |
38 |
|
import org.qedeq.kernel.se.common.ModuleAddress; |
39 |
|
import org.qedeq.kernel.se.common.ModuleDataException; |
40 |
|
import org.qedeq.kernel.se.common.SourceFileException; |
41 |
|
import org.qedeq.kernel.se.common.SourceFileExceptionList; |
42 |
|
import org.qedeq.kernel.se.visitor.InterruptException; |
43 |
|
import org.xml.sax.SAXParseException; |
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
@author |
49 |
|
|
|
|
| 93% |
Uncovered Elements: 18 (256) |
Complexity: 32 |
Complexity Density: 0.14 |
|
50 |
|
public class GenerateLatexTest extends QedeqBoTestCase { |
51 |
|
|
52 |
|
|
53 |
|
private static final Class CLASS = GenerateLatexTest.class; |
54 |
|
private InternalModuleServiceCall call; |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
56 |
20
|
protected void tearDown() throws Exception {... |
57 |
20
|
endServiceCall(call); |
58 |
20
|
super.tearDown(); |
59 |
|
} |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
@throws |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1
PASS
|
|
66 |
2
|
public void testGeneration() throws Exception {... |
67 |
|
|
68 |
|
|
69 |
2
|
generate(getDocDir(), "math/qedeq_logic_v1.xml", getGenDir(), false, false); |
70 |
2
|
generate(getDocDir(), "math/qedeq_set_theory_v1.xml", getGenDir(), false, false); |
71 |
2
|
generate(getDocDir(), "math/qedeq_formal_logic_v1.xml", getGenDir(), false, false); |
72 |
2
|
generate(getDocDir(), "sample/qedeq_sample1.xml", getGenDir(), false, false); |
73 |
2
|
generate(getDocDir(), "sample/qedeq_sample2.xml", getGenDir(), false, false); |
74 |
2
|
generate(getDocDir(), "sample/qedeq_sample3.xml", getGenDir(), false, false); |
75 |
2
|
generate(getDocDir(), "project/qedeq_basic_concept.xml", getGenDir(), false, false); |
76 |
2
|
generate(getDocDir(), "project/qedeq_logic_language.xml", getGenDir(), true, false); |
77 |
2
|
generate(getDocDir(), "project/qedeq_development_concept.xml", getGenDir(), true, false); |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
} |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
@throws |
87 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
88 |
2
|
public void testGeneration2() throws Exception {... |
89 |
|
|
90 |
2
|
generate(getIndir(), "proof/proof_001.xml", getOutdir(), true, false); |
91 |
2
|
generate(getIndir(), "proof/proof_002.xml", getOutdir(), true, true); |
92 |
2
|
generate(getIndir(), "proof/proof_003.xml", getOutdir(), true, false); |
93 |
|
|
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
@throws |
100 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (44) |
Complexity: 2 |
Complexity Density: 0.05 |
1
PASS
|
|
101 |
2
|
public void testNegativeGeneration2() throws Exception {... |
102 |
|
|
103 |
2
|
try { |
104 |
2
|
generate(getIndir(), "proof/proof_002.xml", getOutdir(), true, false); |
105 |
|
} catch (SourceFileExceptionList list) { |
106 |
2
|
SourceFileExceptionList ex = list; |
107 |
2
|
assertEquals(8, ex.size()); |
108 |
2
|
SourceFileException e0 = ex.get(0); |
109 |
2
|
assertTrue(e0.getCause() instanceof ModuleDataException); |
110 |
2
|
assertEquals(6100017, e0.getErrorCode()); |
111 |
2
|
assertEquals(550, e0.getSourceArea().getStartPosition().getRow()); |
112 |
2
|
assertEquals(24, e0.getSourceArea().getStartPosition().getColumn()); |
113 |
2
|
SourceFileException e1 = ex.get(1); |
114 |
2
|
assertTrue(e1.getCause() instanceof ModuleDataException); |
115 |
2
|
assertEquals(610007, e1.getErrorCode()); |
116 |
2
|
assertEquals(572, e1.getSourceArea().getStartPosition().getRow()); |
117 |
2
|
assertEquals(24, e1.getSourceArea().getStartPosition().getColumn()); |
118 |
2
|
SourceFileException e2 = ex.get(2); |
119 |
2
|
assertTrue(e2.getCause() instanceof ModuleDataException); |
120 |
2
|
assertEquals(610007, e2.getErrorCode()); |
121 |
2
|
assertEquals(714, e2.getSourceArea().getStartPosition().getRow()); |
122 |
2
|
assertEquals(23, e2.getSourceArea().getStartPosition().getColumn()); |
123 |
2
|
SourceFileException e3 = ex.get(3); |
124 |
2
|
assertTrue(e3.getCause() instanceof ModuleDataException); |
125 |
2
|
assertEquals(610007, e3.getErrorCode()); |
126 |
2
|
assertEquals(1020, e3.getSourceArea().getStartPosition().getRow()); |
127 |
2
|
assertEquals(24, e3.getSourceArea().getStartPosition().getColumn()); |
128 |
2
|
SourceFileException e4 = ex.get(4); |
129 |
2
|
assertTrue(e4.getCause() instanceof ModuleDataException); |
130 |
2
|
assertEquals(610007, e4.getErrorCode()); |
131 |
2
|
assertEquals(1080, e4.getSourceArea().getStartPosition().getRow()); |
132 |
2
|
assertEquals(34, e4.getSourceArea().getStartPosition().getColumn()); |
133 |
2
|
SourceFileException e5 = ex.get(5); |
134 |
2
|
assertTrue(e5.getCause() instanceof ModuleDataException); |
135 |
2
|
assertEquals(610011, e5.getErrorCode()); |
136 |
2
|
assertEquals(1734, e5.getSourceArea().getStartPosition().getRow()); |
137 |
2
|
assertEquals(34, e5.getSourceArea().getStartPosition().getColumn()); |
138 |
2
|
SourceFileException e6 = ex.get(6); |
139 |
2
|
assertTrue(e5.getCause() instanceof ModuleDataException); |
140 |
2
|
assertEquals(610011, e6.getErrorCode()); |
141 |
2
|
assertEquals(1843, e6.getSourceArea().getStartPosition().getRow()); |
142 |
2
|
assertEquals(23, e6.getSourceArea().getStartPosition().getColumn()); |
143 |
2
|
SourceFileException e7 = ex.get(7); |
144 |
2
|
assertTrue(e7.getCause() instanceof ModuleDataException); |
145 |
2
|
assertEquals(610011, e7.getErrorCode()); |
146 |
2
|
assertEquals(1843, e7.getSourceArea().getStartPosition().getRow()); |
147 |
2
|
assertEquals(37, e7.getSourceArea().getStartPosition().getColumn()); |
148 |
|
|
149 |
|
|
150 |
|
} |
151 |
|
} |
152 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1
PASS
|
|
153 |
2
|
public void testNegative02() throws Exception {... |
154 |
2
|
try { |
155 |
2
|
generate(getIndir(), "qedeq_error_sample_12.xml", "de", new File(getOutdir(), "null"), false); |
156 |
0
|
fail("IllegalModuleDataException expected"); |
157 |
|
} catch (SourceFileExceptionList list) { |
158 |
2
|
SourceFileExceptionList ex = list; |
159 |
2
|
assertEquals(1, ex.size()); |
160 |
2
|
SourceFileException e = ex.get(0); |
161 |
2
|
assertTrue(e.getCause() instanceof ModuleDataException); |
162 |
2
|
assertEquals(10002, e.getErrorCode()); |
163 |
2
|
assertEquals(221, e.getSourceArea().getStartPosition().getRow()); |
164 |
2
|
assertEquals(9, e.getSourceArea().getStartPosition().getColumn()); |
165 |
|
} |
166 |
|
} |
167 |
|
|
|
|
| 91.7% |
Uncovered Elements: 1 (12) |
Complexity: 2 |
Complexity Density: 0.17 |
1
PASS
|
|
168 |
2
|
public void testNegative03() throws Exception {... |
169 |
2
|
try { |
170 |
2
|
generate(getIndir(), "qedeq_error_sample_13.xml", "en", new File(getOutdir(), "null"), false); |
171 |
0
|
fail("IllegalModuleDataException expected"); |
172 |
|
} catch (SourceFileExceptionList list) { |
173 |
2
|
SourceFileExceptionList ex = list; |
174 |
2
|
assertEquals(1, ex.size()); |
175 |
2
|
SourceFileException e = ex.get(0); |
176 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
177 |
2
|
assertEquals(9001, e.getErrorCode()); |
178 |
2
|
assertEquals(315, e.getSourceArea().getStartPosition().getRow()); |
179 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
180 |
2
|
assertEquals(315, e.getSourceArea().getEndPosition().getRow()); |
181 |
2
|
assertEquals(30, e.getSourceArea().getEndPosition().getColumn()); |
182 |
|
} |
183 |
|
} |
184 |
|
|
|
|
| 98.1% |
Uncovered Elements: 1 (54) |
Complexity: 2 |
Complexity Density: 0.04 |
1
PASS
|
|
185 |
2
|
public void testNegative04() throws Exception {... |
186 |
2
|
try { |
187 |
2
|
generate(getIndir(), "qedeq_error_sample_14.xml", "en", new File(getOutdir(), "null"), false); |
188 |
0
|
fail("IllegalModuleDataException expected"); |
189 |
|
} catch (SourceFileExceptionList list) { |
190 |
2
|
SourceFileExceptionList ex = list; |
191 |
2
|
assertEquals(7, ex.size()); |
192 |
2
|
SourceFileException e = ex.get(0); |
193 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
194 |
2
|
assertEquals(9001, e.getErrorCode()); |
195 |
2
|
assertEquals(13, e.getSourceArea().getStartPosition().getRow()); |
196 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
197 |
2
|
assertEquals(13, e.getSourceArea().getEndPosition().getRow()); |
198 |
2
|
assertEquals(13, e.getSourceArea().getEndPosition().getColumn()); |
199 |
2
|
e = ex.get(1); |
200 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
201 |
2
|
assertEquals(9001, e.getErrorCode()); |
202 |
2
|
assertEquals(16, e.getSourceArea().getStartPosition().getRow()); |
203 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
204 |
2
|
assertEquals(16, e.getSourceArea().getEndPosition().getRow()); |
205 |
2
|
assertEquals(16, e.getSourceArea().getEndPosition().getColumn()); |
206 |
2
|
e = ex.get(2); |
207 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
208 |
2
|
assertEquals(9001, e.getErrorCode()); |
209 |
2
|
assertEquals(19, e.getSourceArea().getStartPosition().getRow()); |
210 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
211 |
2
|
assertEquals(19, e.getSourceArea().getEndPosition().getRow()); |
212 |
2
|
assertEquals(15, e.getSourceArea().getEndPosition().getColumn()); |
213 |
2
|
e = ex.get(3); |
214 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
215 |
2
|
assertEquals(9001, e.getErrorCode()); |
216 |
2
|
assertEquals(22, e.getSourceArea().getStartPosition().getRow()); |
217 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
218 |
2
|
assertEquals(22, e.getSourceArea().getEndPosition().getRow()); |
219 |
2
|
assertEquals(15, e.getSourceArea().getEndPosition().getColumn()); |
220 |
2
|
e = ex.get(4); |
221 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
222 |
2
|
assertEquals(9001, e.getErrorCode()); |
223 |
2
|
assertEquals(26, e.getSourceArea().getStartPosition().getRow()); |
224 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
225 |
2
|
assertEquals(26, e.getSourceArea().getEndPosition().getRow()); |
226 |
2
|
assertEquals(23, e.getSourceArea().getEndPosition().getColumn()); |
227 |
2
|
e = ex.get(5); |
228 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
229 |
2
|
assertEquals(9001, e.getErrorCode()); |
230 |
2
|
assertEquals(69, e.getSourceArea().getStartPosition().getRow()); |
231 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
232 |
2
|
assertEquals(69, e.getSourceArea().getEndPosition().getRow()); |
233 |
2
|
assertEquals(55, e.getSourceArea().getEndPosition().getColumn()); |
234 |
2
|
e = ex.get(6); |
235 |
2
|
assertTrue(e.getCause() instanceof SAXParseException); |
236 |
2
|
assertEquals(9001, e.getErrorCode()); |
237 |
2
|
assertEquals(98, e.getSourceArea().getStartPosition().getRow()); |
238 |
2
|
assertEquals(1, e.getSourceArea().getStartPosition().getColumn()); |
239 |
2
|
assertEquals(98, e.getSourceArea().getEndPosition().getRow()); |
240 |
2
|
assertEquals(47, e.getSourceArea().getEndPosition().getColumn()); |
241 |
|
} |
242 |
|
} |
243 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1
PASS
|
|
244 |
2
|
public void testNegative05() throws Exception {... |
245 |
2
|
try { |
246 |
2
|
generate(getIndir(), "qedeq_error_sample_15.xml", "en", new File(getOutdir(), "null"), false); |
247 |
0
|
fail("IllegalModuleDataException expected"); |
248 |
|
} catch (SourceFileExceptionList list) { |
249 |
2
|
SourceFileExceptionList ex = list; |
250 |
2
|
assertEquals(1, ex.size()); |
251 |
2
|
SourceFileException e = ex.get(0); |
252 |
2
|
assertTrue(e.getCause() instanceof LogicalCheckException); |
253 |
2
|
assertEquals(30550, e.getErrorCode()); |
254 |
2
|
assertEquals(168, e.getSourceArea().getStartPosition().getRow()); |
255 |
2
|
assertEquals(15, e.getSourceArea().getStartPosition().getColumn()); |
256 |
|
} |
257 |
|
} |
258 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1
PASS
|
|
259 |
2
|
public void testNegative06() throws Exception {... |
260 |
2
|
try { |
261 |
2
|
generate(getIndir(), "qedeq_error_sample_16.xml", "en", new File(getOutdir(), "null"), false); |
262 |
0
|
fail("IllegalModuleDataException expected"); |
263 |
|
} catch (SourceFileExceptionList list) { |
264 |
2
|
SourceFileExceptionList ex = list; |
265 |
2
|
assertEquals(1, ex.size()); |
266 |
2
|
SourceFileException e = ex.get(0); |
267 |
2
|
assertTrue(e.getCause() instanceof LogicalCheckException); |
268 |
2
|
assertEquals(30590, e.getErrorCode()); |
269 |
2
|
assertEquals(288, e.getSourceArea().getStartPosition().getRow()); |
270 |
2
|
assertEquals(30, e.getSourceArea().getStartPosition().getColumn()); |
271 |
|
} |
272 |
|
} |
273 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1
PASS
|
|
274 |
2
|
public void testNegative07() throws Exception {... |
275 |
2
|
try { |
276 |
2
|
generate(getIndir(), "qedeq_error_sample_17.xml", "en", new File(getOutdir(), "null"), false); |
277 |
0
|
fail("IllegalModuleDataException expected"); |
278 |
|
} catch (SourceFileExceptionList list) { |
279 |
2
|
SourceFileExceptionList ex = list; |
280 |
2
|
assertEquals(1, ex.size()); |
281 |
2
|
SourceFileException e = ex.get(0); |
282 |
2
|
assertTrue(e.getCause() instanceof LogicalCheckException); |
283 |
2
|
assertEquals(30780, e.getErrorCode()); |
284 |
2
|
assertEquals(298, e.getSourceArea().getStartPosition().getRow()); |
285 |
2
|
assertEquals(17, e.getSourceArea().getStartPosition().getColumn()); |
286 |
|
} |
287 |
|
} |
288 |
|
|
|
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
1
PASS
|
|
289 |
2
|
public void testNegative08() throws Exception {... |
290 |
2
|
try { |
291 |
2
|
generate(getIndir(), "qedeq_error_sample_18.xml", "en", new File(getOutdir(), "null"), false); |
292 |
0
|
fail("SourceFileExceptionList expected"); |
293 |
|
} catch (SourceFileExceptionList list) { |
294 |
2
|
SourceFileExceptionList ex = list; |
295 |
2
|
assertEquals(1, ex.size()); |
296 |
2
|
SourceFileException e = ex.get(0); |
297 |
2
|
assertTrue(e.getCause() instanceof ModuleDataException); |
298 |
2
|
assertEquals(1001, e.getErrorCode()); |
299 |
2
|
assertEquals(308, e.getSourceArea().getStartPosition().getRow()); |
300 |
2
|
assertEquals(15, e.getSourceArea().getStartPosition().getColumn()); |
301 |
|
} |
302 |
|
} |
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
@param |
309 |
|
@param |
310 |
|
@param |
311 |
|
@param |
312 |
|
@param |
313 |
|
@throws |
314 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
315 |
13
|
public void generate(final File dir, final String xml, final File destinationDirectory,... |
316 |
|
final boolean onlyEn, final boolean ignoreWarnings) throws Exception { |
317 |
13
|
generate(dir, xml, "en", destinationDirectory, ignoreWarnings); |
318 |
12
|
if (!onlyEn) { |
319 |
7
|
generate(dir, xml, "de", destinationDirectory, ignoreWarnings); |
320 |
|
} |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
@param |
327 |
|
@param |
328 |
|
@param |
329 |
|
@param |
330 |
|
@param |
331 |
|
|
|
|
| 85.7% |
Uncovered Elements: 6 (42) |
Complexity: 8 |
Complexity Density: 0.27 |
|
332 |
54
|
public void generate(final File dir, final String xml, final String language,... |
333 |
|
final File destinationDirectory, final boolean ignoreWarnings) throws IOException, |
334 |
|
SourceFileExceptionList, InterruptException { |
335 |
54
|
final File xmlFile = new File(dir, xml); |
336 |
54
|
final ModuleAddress address = getServices().getModuleAddress( |
337 |
|
UrlUtility.toUrl(xmlFile)); |
338 |
54
|
final KernelQedeqBo prop = (KernelQedeqBo) getServices().loadModule( |
339 |
|
address); |
340 |
54
|
if (prop.hasErrors()) { |
341 |
6
|
throw prop.getErrors(); |
342 |
|
} |
343 |
48
|
getServices().loadRequiredModules(prop.getModuleAddress()); |
344 |
48
|
if (prop.hasErrors()) { |
345 |
0
|
throw prop.getErrors(); |
346 |
|
} |
347 |
48
|
getServices().checkWellFormedness(prop.getModuleAddress()); |
348 |
48
|
if (prop.hasErrors()) { |
349 |
6
|
throw prop.getErrors(); |
350 |
|
} |
351 |
42
|
call = createServiceCall("generate LaTeX", prop); |
352 |
42
|
QedeqBoDuplicateLanguageChecker.check(call); |
353 |
40
|
endServiceCall(call); |
354 |
40
|
if (prop.hasErrors()) { |
355 |
0
|
throw prop.getErrors(); |
356 |
|
} |
357 |
|
|
358 |
40
|
final String web = "http://www.qedeq.org/" |
359 |
|
+ getInternalServices().getKernelVersionDirectory() + "/doc/" + xml; |
360 |
40
|
final ModuleAddress webAddress = new DefaultModuleAddress(web); |
361 |
40
|
getInternalServices().getLocalFilePath(webAddress); |
362 |
40
|
IoUtility.copyFile(xmlFile, getInternalServices().getLocalFilePath(webAddress)); |
363 |
|
|
364 |
40
|
getServices().checkWellFormedness(webAddress); |
365 |
40
|
final QedeqBo webBo = getServices().getQedeqBo(webAddress); |
366 |
40
|
final File texFile = new File(destinationDirectory, xml.substring(0, xml.lastIndexOf('.')) |
367 |
|
+ "_" + language + ".tex"); |
368 |
40
|
generate((KernelQedeqBo) webBo, texFile, language, "1"); |
369 |
|
|
370 |
|
|
371 |
|
|
372 |
40
|
final File xmlCopy = new File(destinationDirectory, xml); |
373 |
40
|
IoUtility.copyFile(xmlFile, xmlCopy); |
374 |
40
|
if (webBo.hasErrors()) { |
375 |
0
|
throw webBo.getErrors(); |
376 |
|
} |
377 |
40
|
if (!ignoreWarnings && webBo.hasWarnings()) { |
378 |
2
|
throw webBo.getWarnings(); |
379 |
|
} |
380 |
|
} |
381 |
|
|
382 |
|
|
383 |
|
|
384 |
|
|
385 |
|
@param |
386 |
|
@param |
387 |
|
@param |
388 |
|
@param |
389 |
|
@return |
390 |
|
@throws |
391 |
|
|
|
|
| 76.2% |
Uncovered Elements: 5 (21) |
Complexity: 3 |
Complexity Density: 0.16 |
|
392 |
40
|
public String generate(final KernelQedeqBo prop, final File to, final String language,... |
393 |
|
final String level) throws SourceFileExceptionList { |
394 |
40
|
final String method = "generate(String, String, String, String)"; |
395 |
40
|
try { |
396 |
40
|
Trace.begin(CLASS, method); |
397 |
40
|
Trace.param(CLASS, method, "prop", prop); |
398 |
40
|
Trace.param(CLASS, method, "to", to); |
399 |
40
|
Trace.param(CLASS, method, "language", language); |
400 |
40
|
Trace.param(CLASS, method, "level", level); |
401 |
40
|
final Map parameters = new HashMap(); |
402 |
40
|
parameters.put("info", "true"); |
403 |
40
|
final Parameters configParameters = new Parameters(parameters); |
404 |
40
|
final InputStream latex =(new Qedeq2LatexExecutor(new Qedeq2LatexPlugin(), prop, configParameters)) |
405 |
|
.createLatex(new InternalModuleServiceCallImpl(DummyPlugin.getInstance(), prop, configParameters, Parameters.EMPTY, |
406 |
|
new InternalServiceJobImpl(new ModuleArbiterImpl(), "generate LaTeX"), null), language, "1"); |
407 |
40
|
if (to != null) { |
408 |
40
|
IoUtility.saveFile(latex, to); |
409 |
40
|
return to.getCanonicalPath(); |
410 |
|
} |
411 |
0
|
latex.close(); |
412 |
0
|
return prop.getName(); |
413 |
|
} catch (IOException e) { |
414 |
0
|
Trace.trace(CLASS, method, e); |
415 |
0
|
throw new RuntimeException(e); |
416 |
|
} finally { |
417 |
40
|
Trace.end(CLASS, method); |
418 |
|
} |
419 |
|
} |
420 |
|
|
421 |
|
} |