|
6 | 6 |
|
7 | 7 | public class Main { |
8 | 8 | public static void main(String[] args) throws IOException { |
9 | | - String file = "C:\\Projects\\TestSmells_ExisitngTools\\samples\\org.xbmc.kore\\app\\src\\test\\java\\org\\xbmc\\kore\\provider\\mediaprovider\\TestValues.java"; |
10 | | - TestFileDetector testFileDetector; |
| 9 | + final String rootDirectory = "G:\\Android\\Apps"; |
11 | 10 |
|
12 | 11 | //recursively identify all 'java' files in the specified directory |
13 | | - System.out.println("Started - Identify all 'java' files"); |
| 12 | + Util.writeOperationLogEntry("Identify all 'java' files", Util.OperationStatus.Started); |
14 | 13 | FileWalker fw = new FileWalker(); |
15 | | - //List<FileEntity> files = fw.getJavaFiles("C:\\Projects\\TestSmells_ExisitngTools\\samples",true); |
16 | | - List<FileEntity> files = fw.getJavaTestFiles("C:\\Projects\\TestSmells_ExisitngTools\\samples\\org.xbmc.kore\\app\\src\\androidTest\\java\\org\\xbmc\\kore\\testhelpers",false); |
17 | | - System.out.println("Ended - Identify all 'java' files"); |
| 14 | + List<FileEntity> files = fw.getJavaFiles(rootDirectory, true); |
| 15 | + Util.writeOperationLogEntry("Identify all 'java' files", Util.OperationStatus.Completed); |
18 | 16 |
|
19 | 17 |
|
20 | 18 | //foreach of the identified 'java' files, obtain details about the methods that they contain |
21 | | - System.out.println("Started - Obtain method details"); |
22 | | - for (FileEntity fileEntity: files) { |
23 | | - testFileDetector = new TestFileDetector(); |
24 | | - fileEntity.setMethods(testFileDetector.parseFile(fileEntity.getFilePath())); |
| 19 | + Util.writeOperationLogEntry("Obtain method details", Util.OperationStatus.Started); |
| 20 | + TestFileDetector testFileDetector; |
| 21 | + for (FileEntity fileEntity : files) { |
| 22 | + try { |
| 23 | + testFileDetector = new TestFileDetector(); |
| 24 | + fileEntity.setMethods(testFileDetector.parseFile(fileEntity.getFilePath())); |
| 25 | + } catch (Exception e) { |
| 26 | + Util.writeException(e, "File: " + fileEntity.getFilePath()); |
| 27 | + } |
25 | 28 | } |
26 | | - System.out.println("Ended - Obtain method details"); |
| 29 | + Util.writeOperationLogEntry("Obtain method details", Util.OperationStatus.Completed); |
27 | 30 |
|
28 | 31 |
|
29 | 32 | //output the results into CSV files |
30 | | - System.out.println("Started - Save results to CSV"); |
| 33 | + Util.writeOperationLogEntry("Save results to CSV", Util.OperationStatus.Started); |
31 | 34 | ResultsWriter resultsWriter = new ResultsWriter(files); |
32 | 35 | resultsWriter.outputToCSV(true); |
33 | | - System.out.println("Ended - Save results to CSV"); |
| 36 | + Util.writeOperationLogEntry("Save results to CSV", Util.OperationStatus.Completed); |
34 | 37 |
|
35 | 38 |
|
36 | 39 | } |
|
0 commit comments