Skip to content

Commit df05975

Browse files
committed
Removed test method.
1 parent 914c599 commit df05975

File tree

1 file changed

+4
-69
lines changed

1 file changed

+4
-69
lines changed

src/main/java/no/hvl/dowhile/core/OperationManager.java

+4-69
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
import no.hvl.dowhile.utility.TrackTools;
1313

1414
import java.io.File;
15-
import java.util.*;
15+
import java.util.ArrayList;
16+
import java.util.Date;
17+
import java.util.List;
18+
import java.util.Set;
1619

1720
/**
1821
* Handling communication between the components in the application.
@@ -133,7 +136,6 @@ public void updateCurrentOperation(int year, int month, int day, int hour, int m
133136
operation.setStartTime(year, month, day, hour, minute);
134137
window.updateOperationInfo(operation);
135138
fileManager.updateOperationFile(operation);
136-
importMassTestingFiles();
137139
}
138140

139141
/**
@@ -455,71 +457,4 @@ public void setFileManager(FileManager fileManager) {
455457
public List<GpxFile> getQueue() {
456458
return queue;
457459
}
458-
459-
/**
460-
* This method is used for testing import of loads of files.
461-
* No user interaction is required to import the files.
462-
* The files you want to import need to be in a folder named "MassTesting" in the C://TrackGrabber folder.
463-
*/
464-
public void importMassTestingFiles() {
465-
long startTime = System.currentTimeMillis();
466-
int filesImported = 0;
467-
File appFolder = fileManager.getAppFolder();
468-
if (appFolder == null || appFolder.listFiles() == null) {
469-
return;
470-
}
471-
File massTestingFolder = new File(appFolder, "MassTesting");
472-
File[] trackFiles = massTestingFolder.listFiles();
473-
if (trackFiles == null) {
474-
return;
475-
}
476-
Random random = new Random();
477-
for (File trackFile : trackFiles) {
478-
if (trackFile.getName().endsWith(".gpx")) {
479-
System.err.println("Importing " + trackFile.getName());
480-
GPX gpx = TrackTools.getGpxFromFile(trackFile);
481-
if (gpx == null) {
482-
System.err.println("Failed to parse gpx.");
483-
484-
} else if (TrackTools.hasWaypoints(gpx)) {
485-
System.err.println("File is a waypoint file. Ignoring.");
486-
} else if (!TrackTools.fileHasTrack(gpx)) {
487-
System.err.println("File doesn't have track.");
488-
} else if (fileManager.alreadyImportedTrack(gpx) != null) {
489-
System.err.println("Already imported.");
490-
} else {
491-
fileManager.saveRawGpxFileInFolders(gpx, trackFile.getName());
492-
System.err.println("Saved raw file!");
493-
if (TrackTools.trackIsAnArea(gpx)) {
494-
fileManager.saveAreaGpxFileInFolders(gpx, trackFile.getName());
495-
System.err.println("Saved area file!");
496-
} else {
497-
if (!TrackTools.trackCreatedBeforeStartTime(gpx, operation.getStartTime())) {
498-
String crewType = config.getTeamTypes().get(random.nextInt(config.getTeamNames().size())).getName();
499-
TrackInfo trackInfo = new TrackInfo(
500-
crewType, random.nextInt(40),
501-
random.nextInt(40),
502-
"[" + random.nextInt(40) + "]",
503-
TrackTools.getDistanceFromTrack(gpx), random.nextInt(40),
504-
"MassTesting"
505-
);
506-
String filename = config.generateFilename(trackInfo);
507-
Track track = TrackTools.getTrackFromGPXFile(gpx);
508-
track.setName(filename);
509-
if (!trackInfo.getComment().isEmpty()) {
510-
track.setDescription(trackInfo.getComment());
511-
}
512-
fileManager.saveProcessedGpxFileInFolders(gpx, trackInfo, filename);
513-
filesImported++;
514-
System.err.println("Saved processed!");
515-
} else {
516-
System.err.println("Track in file \"" + trackFile.getName() + "\" was stopped before operation start time. Ignoring.");
517-
}
518-
}
519-
}
520-
}
521-
}
522-
long stopTime = System.currentTimeMillis();
523-
System.err.println("Successfully imported " + filesImported + " files in " + (stopTime - startTime) / 1000 + " seconds.");
524-
}
525460
}

0 commit comments

Comments
 (0)