1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
2 | //
|
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
4 | // you may not use this file except in compliance with the License.
|
---|
5 | // You may obtain a copy of the License at
|
---|
6 | //
|
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
8 | //
|
---|
9 | // Unless required by applicable law or agreed to in writing, software
|
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
12 | // See the License for the specific language governing permissions and
|
---|
13 | // limitations under the License.
|
---|
14 |
|
---|
15 | package de.ugoe.cs.autoquest.plugin.uml;
|
---|
16 |
|
---|
17 | import java.io.File;
|
---|
18 | import java.util.Collection;
|
---|
19 | import java.util.Iterator;
|
---|
20 | import java.util.LinkedList;
|
---|
21 | import java.util.List;
|
---|
22 | import java.util.Random;
|
---|
23 | import java.util.logging.Level;
|
---|
24 |
|
---|
25 | import static org.junit.Assert.*;
|
---|
26 |
|
---|
27 | import org.apache.commons.lang.SerializationUtils;
|
---|
28 | import org.eclipse.uml2.uml.Interaction;
|
---|
29 | import org.eclipse.uml2.uml.Model;
|
---|
30 | import org.eclipse.uml2.uml.StateMachine;
|
---|
31 | import org.eclipse.uml2.uml.UMLPackage;
|
---|
32 | import org.junit.After;
|
---|
33 | import org.junit.BeforeClass;
|
---|
34 | import org.junit.Test;
|
---|
35 |
|
---|
36 | import de.fraunhofer.fokus.testing.ModelUtils;
|
---|
37 | import de.ugoe.cs.autoquest.eventcore.Event;
|
---|
38 | import de.ugoe.cs.autoquest.plugin.http.HTTPLogParser;
|
---|
39 | import de.ugoe.cs.autoquest.plugin.http.SOAPUtils;
|
---|
40 | import de.ugoe.cs.autoquest.plugin.http.eventcore.SOAPEventType;
|
---|
41 | import de.ugoe.cs.autoquest.testgeneration.RandomWalkGenerator;
|
---|
42 | import de.ugoe.cs.autoquest.usageprofiles.FirstOrderMarkovModel;
|
---|
43 | import de.ugoe.cs.autoquest.usageprofiles.IStochasticProcess;
|
---|
44 | import de.ugoe.cs.util.console.TextConsole;
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * <p>
|
---|
48 | * Tests for AutoQUESTs UMLUtils
|
---|
49 | * </p>
|
---|
50 | *
|
---|
51 | * @author Steffen Herbold
|
---|
52 | */
|
---|
53 | public class UMLUtilsTest {
|
---|
54 |
|
---|
55 | private final static String OUTPUT_DIR = "target/tmp/test-outputs/";
|
---|
56 |
|
---|
57 | @BeforeClass
|
---|
58 | public static void setUpBeforeClass() throws Exception {
|
---|
59 | new TextConsole(Level.INFO);
|
---|
60 | }
|
---|
61 |
|
---|
62 | @After
|
---|
63 | public void tearDown() throws Exception {
|
---|
64 | deleteFiles(new File(OUTPUT_DIR));
|
---|
65 | }
|
---|
66 |
|
---|
67 | @Test(expected = java.lang.RuntimeException.class)
|
---|
68 | public void testCreateUMLTransitionSequence_1() throws Exception {
|
---|
69 | // parse log file
|
---|
70 | HTTPLogParser parser =
|
---|
71 | new HTTPLogParser(new File(ClassLoader.getSystemResource("ita_v2_servicenamemap.txt")
|
---|
72 | .getFile()));
|
---|
73 | parser.parseFile(new File(ClassLoader.getSystemResource("ita_usagejournal_v2_2.log")
|
---|
74 | .getFile()));
|
---|
75 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
76 |
|
---|
77 | Model model =
|
---|
78 | ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream("ita_model_v2.uml"));
|
---|
79 |
|
---|
80 | StateMachine stateMachine =
|
---|
81 | (StateMachine) model.getPackagedElement("StateMachineTransportService", true,
|
---|
82 | UMLPackage.Literals.STATE_MACHINE, true);
|
---|
83 |
|
---|
84 |
|
---|
85 | Collection<List<Event>> umlSequences = new LinkedList<>();
|
---|
86 |
|
---|
87 | // remove everything but transport from sequences
|
---|
88 | for (List<Event> httpSequence : httpSequences) {
|
---|
89 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
90 | Event event = eventIter.next();
|
---|
91 | if (!(event.getType() instanceof SOAPEventType)) {
|
---|
92 | eventIter.remove();
|
---|
93 | }
|
---|
94 | else {
|
---|
95 | SOAPEventType eventType = (SOAPEventType) event.getType();
|
---|
96 | if (!"TransportService".equals(eventType.getServiceName())) {
|
---|
97 | eventIter.remove();
|
---|
98 | }
|
---|
99 | }
|
---|
100 | }
|
---|
101 | umlSequences.add(UMLUtils.createUMLTransitionSequence(httpSequence, stateMachine));
|
---|
102 | }
|
---|
103 | }
|
---|
104 |
|
---|
105 | @Test
|
---|
106 | public void testConvertStateMachineToUsageProfile_1() throws Exception {
|
---|
107 | HTTPLogParser parser =
|
---|
108 | new HTTPLogParser(new File(ClassLoader.getSystemResource("ita_v2_servicenamemap.txt")
|
---|
109 | .getFile()));
|
---|
110 | parser.parseFile(new File(ClassLoader.getSystemResource("ita_usagejournal_v2_2.log")
|
---|
111 | .getFile()));
|
---|
112 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
113 |
|
---|
114 | Model model =
|
---|
115 | ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream("ita_model_v2.uml"));
|
---|
116 |
|
---|
117 | // remove everything but transport from sequences
|
---|
118 | for (List<Event> httpSequence : httpSequences) {
|
---|
119 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
120 | Event event = eventIter.next();
|
---|
121 | if (!(event.getType() instanceof SOAPEventType)) {
|
---|
122 | eventIter.remove();
|
---|
123 | }
|
---|
124 | else {
|
---|
125 | SOAPEventType eventType = (SOAPEventType) event.getType();
|
---|
126 | if (!"TransportService".equals(eventType.getServiceName())) {
|
---|
127 | eventIter.remove();
|
---|
128 | }
|
---|
129 | }
|
---|
130 | }
|
---|
131 | }
|
---|
132 |
|
---|
133 | StateMachine stateMachine =
|
---|
134 | (StateMachine) model.getPackagedElement("StateMachineTransportService", true,
|
---|
135 | UMLPackage.Literals.STATE_MACHINE, true);
|
---|
136 |
|
---|
137 | UMLUtils.convertStateMachineToUsageProfile(httpSequences, stateMachine);
|
---|
138 |
|
---|
139 | ModelUtils.writeModelToFile(model, OUTPUT_DIR + "ita_v2_result.uml");
|
---|
140 | }
|
---|
141 |
|
---|
142 | @Test
|
---|
143 | public void testCreateInteractionFromEventSequence_1() throws Exception {
|
---|
144 | // parse log file
|
---|
145 | HTTPLogParser parser =
|
---|
146 | new HTTPLogParser(new File(ClassLoader
|
---|
147 | .getSystemResource("testCreateInteractionFromEventSequence_1_properties.txt")
|
---|
148 | .getFile()));
|
---|
149 | parser
|
---|
150 | .parseFile(new File(ClassLoader
|
---|
151 | .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log")
|
---|
152 | .getFile()));
|
---|
153 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
154 |
|
---|
155 | Model model =
|
---|
156 | ModelUtils.loadModel(ClassLoader
|
---|
157 | .getSystemResourceAsStream("testCreateInteractionFromEventSequence_1_model.uml"));
|
---|
158 |
|
---|
159 | for (List<Event> httpSequence : httpSequences) {
|
---|
160 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
161 | Event event = eventIter.next();
|
---|
162 | if (!(event.getType() instanceof SOAPEventType)) {
|
---|
163 | eventIter.remove();
|
---|
164 | }
|
---|
165 | }
|
---|
166 |
|
---|
167 | UMLUtils.createInteractionFromEventSequence(httpSequence, model, "testSequence", null);
|
---|
168 | }
|
---|
169 |
|
---|
170 | ModelUtils.writeModelToFile(model, OUTPUT_DIR +
|
---|
171 | "testCreateInteractionFromEventSequence_1_result.uml");
|
---|
172 | }
|
---|
173 |
|
---|
174 | @Test
|
---|
175 | public void testCreateInteractionFromEventSequence_2() throws Exception {
|
---|
176 | // parse log file
|
---|
177 | HTTPLogParser parser =
|
---|
178 | new HTTPLogParser(new File(ClassLoader
|
---|
179 | .getSystemResource("testCreateInteractionFromEventSequence_2_properties.txt")
|
---|
180 | .getFile()));
|
---|
181 | parser
|
---|
182 | .parseFile(new File(ClassLoader
|
---|
183 | .getSystemResource("testCreateInteractionFromEventSequence_2_usagedata.log")
|
---|
184 | .getFile()));
|
---|
185 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
186 |
|
---|
187 | Model model =
|
---|
188 | ModelUtils.loadModel(ClassLoader
|
---|
189 | .getSystemResourceAsStream("testCreateInteractionFromEventSequence_2_model.uml"));
|
---|
190 |
|
---|
191 | for (List<Event> httpSequence : httpSequences) {
|
---|
192 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
193 | Event event = eventIter.next();
|
---|
194 | if (!(event.getType() instanceof SOAPEventType)) {
|
---|
195 | eventIter.remove();
|
---|
196 | }
|
---|
197 | }
|
---|
198 |
|
---|
199 | UMLUtils.createInteractionFromEventSequence(httpSequence, model, "testSequence", null);
|
---|
200 | }
|
---|
201 |
|
---|
202 | ModelUtils.writeModelToFile(model, OUTPUT_DIR +
|
---|
203 | "testCreateInteractionFromEventSequence_1_result.uml");
|
---|
204 | }
|
---|
205 |
|
---|
206 | @Test
|
---|
207 | public void testCalculateUsageScore_1() throws Exception {
|
---|
208 | // parse log file
|
---|
209 | HTTPLogParser parser =
|
---|
210 | new HTTPLogParser(new File(ClassLoader
|
---|
211 | .getSystemResource("testCalculateUsageScore_1_properties.txt").getFile()));
|
---|
212 | parser.parseFile(new File(ClassLoader
|
---|
213 | .getSystemResource("testCalculateUsageScore_1_usagedata.log").getFile()));
|
---|
214 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
215 |
|
---|
216 | Model model =
|
---|
217 | ModelUtils.loadModel(ClassLoader
|
---|
218 | .getSystemResourceAsStream("testCalculateUsageScore_1_model.uml"));
|
---|
219 |
|
---|
220 | Collection<List<Event>> simpleSOAPSequences = new LinkedList<>();
|
---|
221 | for (List<Event> httpSequence : httpSequences) {
|
---|
222 | simpleSOAPSequences.add(SOAPUtils.convertToSimpleSOAPEvent(httpSequence, true));
|
---|
223 | }
|
---|
224 |
|
---|
225 | FirstOrderMarkovModel usageProfile = new FirstOrderMarkovModel(new Random(1));
|
---|
226 | usageProfile.train(simpleSOAPSequences);
|
---|
227 |
|
---|
228 | Collection<List<Event>> genSeqs =
|
---|
229 | (new RandomWalkGenerator(10, 1, 100, true, 500)).generateTestSuite(usageProfile);
|
---|
230 |
|
---|
231 | int i = 1;
|
---|
232 | int[] lengths = new int[genSeqs.size()];
|
---|
233 | for (List<Event> seq : genSeqs) {
|
---|
234 | UMLUtils.createInteractionFromEventSequence(seq, model, "seq_" + i, null);
|
---|
235 | lengths[i - 1] = seq.size();
|
---|
236 | i++;
|
---|
237 | }
|
---|
238 | for (int j = 0; j < genSeqs.size(); j++) {
|
---|
239 | Interaction interaction =
|
---|
240 | (Interaction) model.getPackagedElement("seq_" + j, true,
|
---|
241 | UMLPackage.Literals.INTERACTION, true);
|
---|
242 | double usageScore = UMLUtils.calculateUsageScore(interaction, usageProfile);
|
---|
243 | System.out.format("usage score %02d: %.2f \t %d\n", j + 1, usageScore, lengths[j]);
|
---|
244 | }
|
---|
245 | }
|
---|
246 |
|
---|
247 | @Test
|
---|
248 | public void testCreateScheduling_1() throws Exception {
|
---|
249 | Model model =
|
---|
250 | ModelUtils.loadModel(ClassLoader
|
---|
251 | .getSystemResourceAsStream("testCreateScheduling_1_testsuite.uml"));
|
---|
252 |
|
---|
253 | IStochasticProcess usageProfile =
|
---|
254 | (IStochasticProcess) SerializationUtils.deserialize(ClassLoader
|
---|
255 | .getSystemResourceAsStream("testCreateScheduling_1_usageprofile.dat"));
|
---|
256 |
|
---|
257 | UMLUtils.createScheduling(model, usageProfile, null);
|
---|
258 |
|
---|
259 | ModelUtils.writeModelToFile(model, OUTPUT_DIR + "testCreateScheduling_1_result.uml");
|
---|
260 | }
|
---|
261 |
|
---|
262 | @Test
|
---|
263 | public void testValidateModelWithLog_1() throws Exception {
|
---|
264 | HTTPLogParser parser =
|
---|
265 | new HTTPLogParser(new File(ClassLoader
|
---|
266 | .getSystemResource("testCreateInteractionFromEventSequence_1_properties.txt")
|
---|
267 | .getFile()));
|
---|
268 | parser
|
---|
269 | .parseFile(new File(ClassLoader
|
---|
270 | .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log")
|
---|
271 | .getFile()));
|
---|
272 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
273 |
|
---|
274 | for (List<Event> httpSequence : httpSequences) {
|
---|
275 | SOAPUtils.removeNonSOAPEvents(httpSequence);
|
---|
276 | }
|
---|
277 |
|
---|
278 | Model model =
|
---|
279 | ModelUtils.loadModel(ClassLoader
|
---|
280 | .getSystemResourceAsStream("testCreateInteractionFromEventSequence_1_model.uml"));
|
---|
281 |
|
---|
282 | int violations = UMLUtils.validateModelWithLog(httpSequences, model, null);
|
---|
283 | if (violations == 0) {
|
---|
284 | System.out.println("No problems found.");
|
---|
285 | }
|
---|
286 | else {
|
---|
287 | System.out.println(violations + " violations found.");
|
---|
288 | }
|
---|
289 | }
|
---|
290 |
|
---|
291 | @Test
|
---|
292 | public void testValidateModelWithLog_2() throws Exception {
|
---|
293 | HTTPLogParser parser =
|
---|
294 | new HTTPLogParser(new File(ClassLoader
|
---|
295 | .getSystemResource("testCreateInteractionFromEventSequence_2_properties.txt")
|
---|
296 | .getFile()));
|
---|
297 | parser
|
---|
298 | .parseFile(new File(ClassLoader
|
---|
299 | .getSystemResource("testCreateInteractionFromEventSequence_2_usagedata.log")
|
---|
300 | .getFile()));
|
---|
301 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
302 |
|
---|
303 | for (List<Event> httpSequence : httpSequences) {
|
---|
304 | SOAPUtils.removeNonSOAPEvents(httpSequence);
|
---|
305 | }
|
---|
306 |
|
---|
307 | Model model =
|
---|
308 | ModelUtils.loadModel(ClassLoader
|
---|
309 | .getSystemResourceAsStream("testCreateInteractionFromEventSequence_2_model.uml"));
|
---|
310 |
|
---|
311 | int violations = UMLUtils.validateModelWithLog(httpSequences, model, null);
|
---|
312 | if (violations == 0) {
|
---|
313 | System.out.println("No problems found.");
|
---|
314 | }
|
---|
315 | else {
|
---|
316 | System.out.println(violations + " violations found.");
|
---|
317 | }
|
---|
318 | }
|
---|
319 |
|
---|
320 | @Test
|
---|
321 | public void testValidateModelWithLog_HL7_RLUS_v3() throws Exception {
|
---|
322 | HTTPLogParser parser =
|
---|
323 | new HTTPLogParser(new File(ClassLoader.getSystemResource("hl7_servicenamemap.txt")
|
---|
324 | .getFile()));
|
---|
325 | parser
|
---|
326 | .parseFile(new File(ClassLoader
|
---|
327 | .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log")
|
---|
328 | .getFile()));
|
---|
329 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
330 |
|
---|
331 | for (List<Event> httpSequence : httpSequences) {
|
---|
332 | SOAPUtils.removeNonSOAPEvents(httpSequence);
|
---|
333 | }
|
---|
334 |
|
---|
335 | Model model =
|
---|
336 | ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream("hl7model_v3.uml"));
|
---|
337 |
|
---|
338 | int violations = UMLUtils.validateModelWithLog(httpSequences, model, "RLUSTestSuite_1");
|
---|
339 | if (violations == 0) {
|
---|
340 | System.out.println("No problems found.");
|
---|
341 | }
|
---|
342 | else {
|
---|
343 | System.out.println(violations + " violations found.");
|
---|
344 | }
|
---|
345 |
|
---|
346 | // remove everything but rlusService from sequences
|
---|
347 | for (List<Event> httpSequence : httpSequences) {
|
---|
348 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
349 | Event event = eventIter.next();
|
---|
350 | SOAPEventType eventType = (SOAPEventType) event.getType();
|
---|
351 | if (!"rlusService".equals(eventType.getServiceName()) ) {
|
---|
352 | eventIter.remove();
|
---|
353 | }
|
---|
354 | }
|
---|
355 |
|
---|
356 | UMLUtils.createInteractionFromEventSequence(httpSequence, model, "rlustest1",
|
---|
357 | "RLUSTestSuite_1");
|
---|
358 | UMLUtils.createInteractionFromEventSequence(SOAPUtils.convertToSimpleSOAPEvent(httpSequence, true), model, "rlustest2",
|
---|
359 | "RLUSTestSuite_1");
|
---|
360 | }
|
---|
361 |
|
---|
362 | ModelUtils.writeModelToFile(model, OUTPUT_DIR + "hl7_v3_result.uml");
|
---|
363 | }
|
---|
364 |
|
---|
365 | @Test
|
---|
366 | public void testValidateModelWithLog_HL7_IXS_v3() throws Exception {
|
---|
367 | HTTPLogParser parser =
|
---|
368 | new HTTPLogParser(new File(ClassLoader.getSystemResource("hl7_ixs_servicenamemap.txt")
|
---|
369 | .getFile()));
|
---|
370 | parser
|
---|
371 | .parseFile(new File(ClassLoader
|
---|
372 | .getSystemResource("testCreateInteractionFromEventSequence_1_usagedata.log")
|
---|
373 | .getFile()));
|
---|
374 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
375 |
|
---|
376 | for (List<Event> httpSequence : httpSequences) {
|
---|
377 | SOAPUtils.removeNonSOAPEvents(httpSequence);
|
---|
378 | }
|
---|
379 |
|
---|
380 | Model model =
|
---|
381 | ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream("hl7model_v3.uml"));
|
---|
382 |
|
---|
383 | int violations = UMLUtils.validateModelWithLog(httpSequences, model, "IXSTestSuite_1");
|
---|
384 | if (violations == 0) {
|
---|
385 | System.out.println("No problems found.");
|
---|
386 | }
|
---|
387 | else {
|
---|
388 | System.out.println(violations + " violations found.");
|
---|
389 | }
|
---|
390 |
|
---|
391 | // remove everything but rlusService from sequences
|
---|
392 | for (List<Event> httpSequence : httpSequences) {
|
---|
393 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
394 | Event event = eventIter.next();
|
---|
395 | SOAPEventType eventType = (SOAPEventType) event.getType();
|
---|
396 | if (!"ixsService".equals(eventType.getServiceName())) {
|
---|
397 | eventIter.remove();
|
---|
398 | }
|
---|
399 | }
|
---|
400 |
|
---|
401 | UMLUtils.createInteractionFromEventSequence(httpSequence, model, "foo",
|
---|
402 | "IXSTestSuite_1");
|
---|
403 | }
|
---|
404 |
|
---|
405 | ModelUtils.writeModelToFile(model, OUTPUT_DIR + "hl7_v3_result.uml");
|
---|
406 | }
|
---|
407 |
|
---|
408 | @Test
|
---|
409 | public void testValidateModelWithLog_ITA_v2() throws Exception {
|
---|
410 | HTTPLogParser parser =
|
---|
411 | new HTTPLogParser(new File(ClassLoader.getSystemResource("ita_v2_servicenamemap.txt")
|
---|
412 | .getFile()));
|
---|
413 | parser.parseFile(new File(ClassLoader.getSystemResource("ita_usagejournal_v2_2.log")
|
---|
414 | .getFile()));
|
---|
415 | Collection<List<Event>> httpSequences = parser.getSequences();
|
---|
416 |
|
---|
417 | for (List<Event> httpSequence : httpSequences) {
|
---|
418 | SOAPUtils.removeNonSOAPEvents(httpSequence);
|
---|
419 | }
|
---|
420 |
|
---|
421 | Model model =
|
---|
422 | ModelUtils.loadModel(ClassLoader.getSystemResourceAsStream("ita_model_v2.uml"));
|
---|
423 |
|
---|
424 | int violations = UMLUtils.validateModelWithLog(httpSequences, model, null);
|
---|
425 | if (violations == 0) {
|
---|
426 | System.out.println("No problems found.");
|
---|
427 | }
|
---|
428 | else {
|
---|
429 | System.out.println(violations + " violations found.");
|
---|
430 | }
|
---|
431 |
|
---|
432 | // remove everything but transport from sequences
|
---|
433 | for (List<Event> httpSequence : httpSequences) {
|
---|
434 | for (Iterator<Event> eventIter = httpSequence.iterator(); eventIter.hasNext();) {
|
---|
435 | Event event = eventIter.next();
|
---|
436 | SOAPEventType eventType = (SOAPEventType) event.getType();
|
---|
437 | if (!"TransportService".equals(eventType.getServiceName())) {
|
---|
438 | eventIter.remove();
|
---|
439 | }
|
---|
440 | }
|
---|
441 |
|
---|
442 | UMLUtils.createInteractionFromEventSequence(httpSequence, model, "foo",
|
---|
443 | "LogisticsTestSuite");
|
---|
444 | }
|
---|
445 |
|
---|
446 | ModelUtils.writeModelToFile(model, OUTPUT_DIR + "ita_v2_result.uml");
|
---|
447 |
|
---|
448 | }
|
---|
449 |
|
---|
450 | private void deleteFiles(File file) {
|
---|
451 | if (file.exists()) {
|
---|
452 | if (file.isDirectory()) {
|
---|
453 | for (File child : file.listFiles()) {
|
---|
454 | deleteFiles(child);
|
---|
455 | }
|
---|
456 | }
|
---|
457 |
|
---|
458 | try {
|
---|
459 | file.delete();
|
---|
460 | }
|
---|
461 | catch (Exception e) {
|
---|
462 | // ignore and delete as much as possible
|
---|
463 | }
|
---|
464 | }
|
---|
465 | }
|
---|
466 |
|
---|
467 | }
|
---|