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