From 5621d060c23f051c19ef995f5fb053d0d5c17182 Mon Sep 17 00:00:00 2001 From: ayushaga14 Date: Tue, 5 Mar 2024 15:24:32 +0530 Subject: [PATCH 1/2] refactor files --- .../AccountHTTPCallParserAktoPolicyInfo.java | 0 .../test_editor/strategy/InsertDataUtil.java | 17 ++++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) rename apps/{api-runtime => dashboard}/src/main/java/com/akto/utils/AccountHTTPCallParserAktoPolicyInfo.java (100%) diff --git a/apps/api-runtime/src/main/java/com/akto/utils/AccountHTTPCallParserAktoPolicyInfo.java b/apps/dashboard/src/main/java/com/akto/utils/AccountHTTPCallParserAktoPolicyInfo.java similarity index 100% rename from apps/api-runtime/src/main/java/com/akto/utils/AccountHTTPCallParserAktoPolicyInfo.java rename to apps/dashboard/src/main/java/com/akto/utils/AccountHTTPCallParserAktoPolicyInfo.java diff --git a/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java b/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java index b649e95e74..57acd66592 100644 --- a/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java +++ b/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java @@ -11,12 +11,11 @@ import com.akto.dto.HttpResponseParams; import com.akto.dto.type.SingleTypeInfo; import com.akto.parsers.HttpCallParser; -import com.akto.utils.AccountHTTPCallParserAktoPolicyInfo; import com.akto.utils.DataInsertionUtil; public class InsertDataUtil { - public static Map accountHTTPParserMap = new ConcurrentHashMap<>(); + public static Map accountHTTPParserMap = new ConcurrentHashMap<>(); public static void insertDataInApiCollection(int apiCollectionId, String topic, List messages, List errors) throws Exception { @@ -36,15 +35,15 @@ public static void insertDataInApiCollection(int apiCollectionId, String topic, Context.accountId.set(accountId); SingleTypeInfo.fetchCustomDataTypes(accountId); - AccountHTTPCallParserAktoPolicyInfo info = accountHTTPParserMap.get(accountId); - if (info == null) { // account created after docker run - info = new AccountHTTPCallParserAktoPolicyInfo(); - HttpCallParser callParser = new HttpCallParser("userIdentifier", 1, 1, 1, false); - info.setHttpCallParser(callParser); - accountHTTPParserMap.put(accountId, info); + HttpCallParser httpCallParser = accountHTTPParserMap.get(accountId); + if (httpCallParser == null) { // account created after docker run + //info = new AccountHTTPCallParserAktoPolicyInfo(); + httpCallParser = new HttpCallParser("userIdentifier", 1, 1, 1, false); + //info.setHttpCallParser(callParser); + accountHTTPParserMap.put(accountId, httpCallParser); } - DataInsertionUtil.processTraffic(info.getHttpCallParser(), responses, apiCollectionId); + DataInsertionUtil.processTraffic(httpCallParser, responses, apiCollectionId); } } From 1448aed56b3ba44318c9091c2e6cc7d85160faac Mon Sep 17 00:00:00 2001 From: ayushaga14 Date: Tue, 5 Mar 2024 15:31:29 +0530 Subject: [PATCH 2/2] refactor files --- .../main/java/com/akto/test_editor/strategy/InsertDataUtil.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java b/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java index 57acd66592..16cf5ec000 100644 --- a/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java +++ b/apps/testing/src/main/java/com/akto/test_editor/strategy/InsertDataUtil.java @@ -37,9 +37,7 @@ public static void insertDataInApiCollection(int apiCollectionId, String topic, SingleTypeInfo.fetchCustomDataTypes(accountId); HttpCallParser httpCallParser = accountHTTPParserMap.get(accountId); if (httpCallParser == null) { // account created after docker run - //info = new AccountHTTPCallParserAktoPolicyInfo(); httpCallParser = new HttpCallParser("userIdentifier", 1, 1, 1, false); - //info.setHttpCallParser(callParser); accountHTTPParserMap.put(accountId, httpCallParser); }