refactor: use a directory to store performance related files
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 1 Jul 2023 12:10:29 +0000 (14:10 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 1 Jul 2023 12:10:29 +0000 (14:10 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.gitignore
src/utils/Configuration.ts
src/utils/Constants.ts

index 5bf56abf9cd3fff2ba601c1f2bec88dc500351e4..197aeb7648e6ad942a115adaa61955834341209e 100644 (file)
@@ -117,6 +117,7 @@ package-lock.json
 .eslintcache
 temp/
 *.tar.gz
+performance/
 performanceRecords.json
 performanceRecords.json.lock
 *.db
index b54f3900988477d6e0ef77113323fc6c1bd8092a..3e3adbc2e56b1324405632a24f1623dbbee5ace3 100644 (file)
@@ -476,11 +476,11 @@ export class Configuration {
     switch (storageType) {
       case StorageType.JSON_FILE:
         return Configuration.buildPerformanceUriFilePath(
-          Constants.DEFAULT_PERFORMANCE_RECORDS_FILENAME
+          `${Constants.DEFAULT_PERFORMANCE_DIRECTORY}/${Constants.DEFAULT_PERFORMANCE_RECORDS_FILENAME}`
         );
       case StorageType.SQLITE:
         return Configuration.buildPerformanceUriFilePath(
-          `${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`
+          `${Constants.DEFAULT_PERFORMANCE_DIRECTORY}/${Constants.DEFAULT_PERFORMANCE_RECORDS_DB_NAME}.db`
         );
       default:
         throw new Error(`Performance storage URI is mandatory with storage type '${storageType}'`);
index 30327b6a578bdd0efac7448f0d4645af7d257963..c4ce0ff8c48e30b8faefd22a118c1718ec74505a 100644 (file)
@@ -36,6 +36,7 @@ export class Constants {
 
   static readonly DEFAULT_FLUCTUATION_PERCENT = 5;
 
+  static readonly DEFAULT_PERFORMANCE_DIRECTORY = 'performance';
   static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json';
   static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator';
   static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records';