From 35cf5fd753b81c4738aad569ef19dd7dd4e6532f Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Mon, 19 Feb 2024 10:12:58 +0300 Subject: [PATCH 1/3] feat: add underscore to numerics --- .../count/java/demo/BackendModeExample.java | 4 +- .../demo/BackendModePerformanceTests.java | 4 +- .../ly/count/sdk/java/internal/Device.java | 6 +- .../ly/count/sdk/java/internal/TimeUtils.java | 6 +- .../sdk/java/internal/BackendModeTests.java | 140 +++++++++--------- .../sdk/java/internal/EventImplTests.java | 4 +- .../sdk/java/internal/ModuleViewsTests.java | 10 +- .../sdk/java/internal/SessionImplTests.java | 10 +- .../sdk/java/internal/TimeGeneratorTests.java | 12 +- .../sdk/java/internal/TimeUtilsTests.java | 6 +- .../sdk/java/internal/UserEditorTests.java | 2 +- 11 files changed, 102 insertions(+), 102 deletions(-) diff --git a/app-java/src/main/java/ly/count/java/demo/BackendModeExample.java b/app-java/src/main/java/ly/count/java/demo/BackendModeExample.java index 83aaf4d92..626f1711e 100644 --- a/app-java/src/main/java/ly/count/java/demo/BackendModeExample.java +++ b/app-java/src/main/java/ly/count/java/demo/BackendModeExample.java @@ -37,7 +37,7 @@ private static void recordView() { segmentation.put("segment", "Windows"); segmentation.put("start", "1"); - Countly.instance().backendM().recordView(DEVICE_ID, "SampleView", segmentation, 1646640780130L); + Countly.instance().backendM().recordView(DEVICE_ID, "SampleView", segmentation, 1_646_640_780_130L); } private static void recordEvent() { @@ -298,7 +298,7 @@ public static void main(String[] args) throws Exception { Config config = new Config(COUNTLY_SERVER_URL, COUNTLY_APP_KEY) .setLoggingLevel(Config.LoggingLevel.DEBUG) .enableBackendMode() - .setRequestQueueMaxSize(10000) + .setRequestQueueMaxSize(10_000) .setDeviceIdStrategy(Config.DeviceIdStrategy.UUID) .setRequiresConsent(false) .setEventQueueSizeToSend(1000); diff --git a/app-java/src/main/java/ly/count/java/demo/BackendModePerformanceTests.java b/app-java/src/main/java/ly/count/java/demo/BackendModePerformanceTests.java index 5be824dce..e8f692dda 100644 --- a/app-java/src/main/java/ly/count/java/demo/BackendModePerformanceTests.java +++ b/app-java/src/main/java/ly/count/java/demo/BackendModePerformanceTests.java @@ -40,7 +40,7 @@ private static void initSDK(int eventQueueSize, int requestQueueSize) { static void performLargeRequestQueueSizeTest() { DemoUtils.println("===== Test Started: 'Large request queue size' ====="); - int requestQSize = 1000000; + int requestQSize = 1_000_000; DemoUtils.printf("Before SDK Initialization: Total Memory = %dMb, Available RAM = %dMb %n", Device.dev.getRAMTotal(), Device.dev.getRAMAvailable()); initSDK(1, requestQSize); DemoUtils.printf("After SDK Initialization: Total Memory = %d Mb, Available RAM= %d Mb %n", Device.dev.getRAMTotal(), Device.dev.getRAMAvailable()); @@ -121,7 +121,7 @@ static void performLargeEventQueueTest() { DemoUtils.printf("After SDK Initialization: Total Memory = %d Mb, Available RAM= %d Mb %n", Device.dev.getRAMTotal(), Device.dev.getRAMAvailable()); int noOfDevices = 10; for (int d = 0; d <= noOfDevices; ++d) { - DemoUtils.printf("Adding %d events into event Queue against deviceID = %s%n", 1_000_00, "device-id-" + d); + DemoUtils.printf("Adding %d events into event Queue against deviceID = %s%n", 100_000, "device-id-" + d); for (int i = 1; i <= noOfEvents; ++i) { Map segment = new ConcurrentHashMap<>(); diff --git a/sdk-java/src/main/java/ly/count/sdk/java/internal/Device.java b/sdk-java/src/main/java/ly/count/sdk/java/internal/Device.java index 7746a72a5..baf5279b7 100644 --- a/sdk-java/src/main/java/ly/count/sdk/java/internal/Device.java +++ b/sdk-java/src/main/java/ly/count/sdk/java/internal/Device.java @@ -44,8 +44,8 @@ public void setLog(Log L) { /** * One second in nanoseconds */ - protected static final Double NS_IN_SECOND = 1000000000.0d; - protected static final Double NS_IN_MS = 1000000.0d; + protected static final Double NS_IN_SECOND = 1_000_000_000.0d; + protected static final Double NS_IN_MS = 1_000_000.0d; protected static final Double MS_IN_SECOND = 1000d; protected static final Long BYTES_IN_MB = 1024L * 1024; @@ -74,7 +74,7 @@ public String getOSVersion() { * @return timezone offset in seconds */ public int getTimezoneOffset() { - return TimeZone.getDefault().getOffset(new Date().getTime()) / 60000; + return TimeZone.getDefault().getOffset(new Date().getTime()) / 60_000; } /** diff --git a/sdk-java/src/main/java/ly/count/sdk/java/internal/TimeUtils.java b/sdk-java/src/main/java/ly/count/sdk/java/internal/TimeUtils.java index 842fd7aec..d5d460df5 100644 --- a/sdk-java/src/main/java/ly/count/sdk/java/internal/TimeUtils.java +++ b/sdk-java/src/main/java/ly/count/sdk/java/internal/TimeUtils.java @@ -4,8 +4,8 @@ public class TimeUtils { - protected static final Double NS_IN_SECOND = 1000000000.0d; - protected static final Double NS_IN_MS = 1000000.0d; + protected static final Double NS_IN_SECOND = 1_000_000_000.0d; + protected static final Double NS_IN_MS = 1_000_000.0d; protected static final long MS_IN_SECOND = 1000; private static final UniqueTimeGenerator uniqueTimer = new UniqueTimeGenerator(); @@ -39,7 +39,7 @@ protected static Instant getCurrentInstant(long timestamp) { return new Instant(timestamp, calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.DAY_OF_WEEK) - 1, // Calendar days are 1-based, Countly days are 0-based - calendar.get(Calendar.ZONE_OFFSET) / 60000); //convert it to seconds + calendar.get(Calendar.ZONE_OFFSET) / 60_000); //convert it to seconds } /** diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java index a1f2fa764..aad7ce7ef 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java @@ -80,7 +80,7 @@ public void testMethodRecordView() { segmentation.put("start", "1"); Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", TestUtils.keysValues[0], segmentation, 1646640780130L); + backendMode.recordView("device-id-1", TestUtils.keysValues[0], segmentation, 1_646_640_780_130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1L, events.length()); @@ -100,7 +100,7 @@ public void testMethodRecordView() { Assert.assertEquals("Windows", segments.get("segment")); Assert.assertEquals("1", segments.get("start")); - backendMode.recordView("device-id-2", TestUtils.keysValues[1], null, 1646640780130L); + backendMode.recordView("device-id-2", TestUtils.keysValues[1], null, 1_646_640_780_130L); events = moduleBackendMode.eventQueues.get("device-id-2"); Assert.assertEquals(1L, events.length()); @@ -129,16 +129,16 @@ public void testMethodRecordViewWithInvalidData() { /* Invalid Device ID */ Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("", TestUtils.keysValues[0], segmentation, 1646640780130L); - backendMode.recordView(null, TestUtils.keysValues[1], segmentation, 1646640780130L); + backendMode.recordView("", TestUtils.keysValues[0], segmentation, 1_646_640_780_130L); + backendMode.recordView(null, TestUtils.keysValues[1], segmentation, 1_646_640_780_130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); /* Invalid view name */ Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", "", segmentation, 1646640780130L); - backendMode.recordView("device-id-2", null, segmentation, 1646640780130L); + backendMode.recordView("device-id-1", "", segmentation, 1_646_640_780_130L); + backendMode.recordView("device-id-2", null, segmentation, 1_646_640_780_130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); @@ -157,7 +157,7 @@ public void testMethodRecordEventWithSingleDeviceID() { segmentation.put("key2", "value2"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -190,15 +190,15 @@ public void testMethodRecordEventWithInvalidData() { Assert.assertEquals(0, moduleBackendMode.eventQSize); /* Invalid Device ID */ - backendMode.recordEvent("", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); - backendMode.recordEvent(null, "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent(null, "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); /* Invalid view name */ - backendMode.recordEvent("device-id-1", "", 1, 0.1, 10.0, segmentation, 1646640780130L); - backendMode.recordEvent("device-id-1", null, 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", null, 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); @@ -223,12 +223,12 @@ public void testMethodRecordEventWithMultipleDeviceID() { segmentation1.put("key4", "value4"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); - backendMode.recordEvent("device-id-2", "key-3", 2, 0.2, 20.0, segmentation1, 1646644457826L); + backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-3", 2, 0.2, 20.0, segmentation1, 1_646_640_780_130L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(2, backendMode.getQueueSize()); @@ -290,43 +290,43 @@ public void TestEventThreshHoldWithSingleAndMultiple() { Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(2, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertNull(moduleBackendMode.eventQueues.get("device-id-1")); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(2, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); Assert.assertEquals(3, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(2, moduleBackendMode.eventQueues.get("device-id-2").length()); Assert.assertEquals(3, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(3, backendMode.getQueueSize()); Assert.assertNull(moduleBackendMode.eventQueues.get("device-id-1")); @@ -351,18 +351,18 @@ public void testFunctionalityAddEventsIntoRequestQueueOnSessionUpdate() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); @@ -387,18 +387,18 @@ public void testFunctionalityAddEventsIntoRequestQueueOnSessionEnd() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); @@ -427,7 +427,7 @@ public void testMethodSessionBegin() { location.put("country_code", "PK"); location.put("location", "31.5204,74.3587"); - backendMode.sessionBegin("device-id-1", metrics, location, 1646640780130L); + backendMode.sessionBegin("device-id-1", metrics, location, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -443,7 +443,7 @@ public void testMethodSessionBegin() { Assert.assertEquals("windows", sessionJson.get("os")); Assert.assertEquals("0.1", sessionJson.get("app-version")); Assert.assertEquals("1", request.params.get("begin_session")); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); } /** @@ -456,8 +456,8 @@ public void testMethodSessionBeginWithInvalidData() { metrics.put("os", "windows"); metrics.put("app-version", "0.1"); - backendMode.sessionBegin("", metrics, null, 1646640780130L); - backendMode.sessionBegin(null, metrics, null, 1646640780130L); + backendMode.sessionBegin("", metrics, null, 1_646_640_780_130L); + backendMode.sessionBegin(null, metrics, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -468,7 +468,7 @@ public void testMethodSessionBeginWithInvalidData() { @Test public void testMethodSessionUpdate() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionUpdate("device-id-1", 10.5, 1646640780130L); + backendMode.sessionUpdate("device-id-1", 10.5, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -483,8 +483,8 @@ public void testMethodSessionUpdate() { @Test public void testMethodSessionUpdateWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionUpdate("", 10.5, 1646640780130L); - backendMode.sessionUpdate(null, 10.5, 1646640780130L); + backendMode.sessionUpdate("", 10.5, 1_646_640_780_130L); + backendMode.sessionUpdate(null, 10.5, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -495,14 +495,14 @@ public void testMethodSessionUpdateWithInvalidData() { @Test public void testSessionEnd() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionEnd("device-id-1", 10.5, 1646640780130L); + backendMode.sessionEnd("device-id-1", 10.5, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); Assert.assertEquals("1", request.params.get("end_session")); Assert.assertEquals("10.5", request.params.get("session_duration")); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); } /** @@ -511,8 +511,8 @@ public void testSessionEnd() { @Test public void testMethodSessionEndWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionEnd("", 10.5, 1646640780130L); - backendMode.sessionEnd(null, 20.5, 1646640780130L); + backendMode.sessionEnd("", 10.5, 1_646_640_780_130L); + backendMode.sessionEnd(null, 20.5, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -533,8 +533,8 @@ public void testMethodRecordException() { try { int a = 10 / 0; } catch (Exception e) { - backendMode.recordException("device-id-1", e, segmentation, crashDetails, 1646640780130L); - backendMode.recordException("device-id-2", "Divided By Zero", "stack traces", null, null, 1646640780130L); + backendMode.recordException("device-id-1", e, segmentation, crashDetails, 1_646_640_780_130L); + backendMode.recordException("device-id-2", "Divided By Zero", "stack traces", null, null, 1_646_640_780_130L); Assert.assertEquals(2, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -550,7 +550,7 @@ public void testMethodRecordException() { Assert.assertEquals("Custom Error", crashJson.get("_error")); Assert.assertEquals("Logs", crashJson.get("_logs")); Assert.assertEquals("Operating System", crashJson.get("_os")); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); JSONObject segments = crashJson.getJSONObject("_custom"); Assert.assertEquals("value1", segments.get("key1")); @@ -564,7 +564,7 @@ public void testMethodRecordException() { Assert.assertEquals("Divided By Zero", crashJson.get("_name")); Assert.assertEquals("stack traces", crashJson.get("_error")); - validateRequestTimeFields("device-id-2", 1646640780130L, request); + validateRequestTimeFields("device-id-2", 1_646_640_780_130L, request); segments = crashJson.getJSONObject("_custom"); Assert.assertTrue(segments.isEmpty()); @@ -580,25 +580,25 @@ public void testMethodRecordExceptionWithInvalidData() { Map segmentation = new ConcurrentHashMap<>(); segmentation.put("key1", "value1"); - backendMode.recordException("", null, segmentation, null, 1646640780130L); + backendMode.recordException("", null, segmentation, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException(null, null, segmentation, null, 1646640780130L); + backendMode.recordException(null, null, segmentation, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-1", null, segmentation, null, 1646640780130L); + backendMode.recordException("device-id-1", null, segmentation, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "", "stack traces", null, null, 1646640780130L); + backendMode.recordException("device-id-2", "", "stack traces", null, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "device-id", "", null, null, 1646640780130L); + backendMode.recordException("device-id-2", "device-id", "", null, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", null, "stack traces", null, null, 1646640780130L); + backendMode.recordException("device-id-2", null, "stack traces", null, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "device-id", null, null, null, 1646640780130L); + backendMode.recordException("device-id-2", "device-id", null, null, null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -612,11 +612,11 @@ public void testUserDetailCustomDetailAndOperations() { // User detail Map userDetail = populateUserProperties(true, true, false); - backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, true, true, false); @@ -632,11 +632,11 @@ public void testUserDetailStructureAllDataAtSameLevel() { // User detail Map userDetail = populateUserProperties(true, true, true); - backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, true, true, true); @@ -652,11 +652,11 @@ public void testUserDetailStructureWithOnlyCustomDetail() { Map userDetail = populateUserProperties(false, true, false); - backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, false, true, false); @@ -672,11 +672,11 @@ public void testUserDetailStructureWithOnlyOperationData() { Map userDetail = populateUserProperties(false, false, true); - backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1646640780130L, request); + validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, false, false, true); @@ -690,17 +690,17 @@ public void testMethodRecordUserPropertiesWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); Map userDetail = populateUserProperties(true, false, false); - backendMode.recordUserProperties("", userDetail, 1646640780130L); + backendMode.recordUserProperties("", userDetail, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordUserProperties(null, userDetail, 1646640780130L); + backendMode.recordUserProperties(null, userDetail, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordUserProperties("device-id", null, 1646640780130L); + backendMode.recordUserProperties("device-id", null, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); userDetail.clear(); - backendMode.recordUserProperties("device-id", userDetail, 1646640780130L); + backendMode.recordUserProperties("device-id", userDetail, 1_646_640_780_130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -721,7 +721,7 @@ public void testEventSegmentDataType() { segmentation.put("key7", 10L); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -729,7 +729,7 @@ public void testEventSegmentDataType() { JSONObject event = events.getJSONObject(0); - long expectedTimestamp = 1646640780130L; + long expectedTimestamp = 1_646_640_780_130L; int expectedHour = getHourFromTimeStamp(expectedTimestamp); validateEventFields("key-1", 1, 0.1, 10.0, 1, expectedHour, expectedTimestamp, event); @@ -763,7 +763,7 @@ public void testViewSegmentDataType() { segmentation.put("key7", 10L); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", "view-1", segmentation, 1646640780130L); + backendMode.recordView("device-id-1", "view-1", segmentation, 1_646_640_780_130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -804,7 +804,7 @@ public void testCrashSegmentDataType() { crashDetails.put("K2", "V2"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordException("device-id-1", "key-1", "stacktrace", segmentation, crashDetails, 1646640780130L); + backendMode.recordException("device-id-1", "key-1", "stacktrace", segmentation, crashDetails, 1_646_640_780_130L); Request request = SDKCore.instance.requestQueueMemory.remove(); String crash = request.params.get("crash"); @@ -845,14 +845,14 @@ public void testRecordDirectRequest() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordDirectRequest("device-id-2", requestData, 1647938191782L); + backendMode.recordDirectRequest("device-id-2", requestData, 1_647_938_191_782L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); Assert.assertEquals("value1", request.params.get("data1")); Assert.assertEquals("value3", request.params.get("data3")); Assert.assertEquals("1", request.params.get("dr")); - validateRequestTimeFields("device-id-2", 1647938191782L, request); + validateRequestTimeFields("device-id-2", 1_647_938_191_782L, request); // Direct request without timestamp and device id requestData = new ConcurrentHashMap<>(); @@ -861,7 +861,7 @@ public void testRecordDirectRequest() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordDirectRequest("device-id-2", requestData, 987654321L); + backendMode.recordDirectRequest("device-id-2", requestData, 987_654_321L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); request = SDKCore.instance.requestQueueMemory.remove(); @@ -869,7 +869,7 @@ public void testRecordDirectRequest() { Assert.assertEquals("value4", request.params.get("data4")); Assert.assertEquals("1", request.params.get("dr")); - validateRequestTimeFields("device-id-2", 987654321L, request); + validateRequestTimeFields("device-id-2", 987_654_321L, request); } private Map populateUserProperties(boolean addUserDetail, boolean addCustomDetail, boolean addOperation) { diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java index c8225d820..cc2a7a005 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java @@ -211,7 +211,7 @@ public void validateFromJson_toJson_segmentation() { segmentation.put("quantity", 3); segmentation.put("name", "test"); segmentation.put("null", null); - segmentation.put("checksum", 56476587L); + segmentation.put("checksum", 56_476_587L); segmentation.put("divisor", 0.2f); event.segmentation = segmentation; @@ -220,7 +220,7 @@ public void validateFromJson_toJson_segmentation() { expectedSegmentation.put("price", BigDecimal.valueOf(9.43)); expectedSegmentation.put("quantity", 3); expectedSegmentation.put("name", "test"); - expectedSegmentation.put("checksum", 56476587); + expectedSegmentation.put("checksum", 56_476_587L); expectedSegmentation.put("divisor", BigDecimal.valueOf(0.2)); JSONObject json = new JSONObject(); diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java index 3575f17ef..e9bb7f4ed 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java @@ -260,7 +260,7 @@ public void mixedTestFlow1() throws InterruptedException { Countly.instance().init(TestUtils.getConfigViews()); TestUtils.validateEQSize(0); - Map customSegmentationA = TestUtils.map("money", 238746798234739L, "start", "1", "visit", "1", "name", TestUtils.keysValues[0], "segment", TestUtils.keysValues[1]); + Map customSegmentationA = TestUtils.map("money", 238_746_798_234_739L, "start", "1", "visit", "1", "name", TestUtils.keysValues[0], "segment", TestUtils.keysValues[1]); Map customSegmentationB = TestUtils.map("gone_to", "Wall Sina", "map", TestUtils.map("titan", true, "level", 65)); Countly.instance().views().startView("A", customSegmentationA); @@ -270,7 +270,7 @@ public void mixedTestFlow1() throws InterruptedException { TestUtils.validateEQSize(4); - validateView("A", 0.0, 0, 4, true, true, TestUtils.map("money", 238746798234739L), "idv1", ""); // starting + validateView("A", 0.0, 0, 4, true, true, TestUtils.map("money", 238_746_798_234_739L), "idv1", ""); // starting validateView("AutoStopped", 0.0, 1, 4, false, true, TestUtils.map("gone_to", "Wall Sina"), "idv2", "idv1"); // starting validateView("AutoStopped", 1.0, 2, 4, false, false, null, "idv2", "idv1"); // closing validateView("B", 0.0, 3, 4, false, true, null, "idv3", "idv2"); // starting @@ -376,7 +376,7 @@ public void validateSegmentation2() { validateView("A", 0.0, 0, 2, true, true, null, "idv1", ""); validateView("B", 0.0, 1, 2, false, true, null, "idv2", "idv1"); - Map allSegmentation = TestUtils.map("Copyright", "Countly", "AppExit", true, "DestroyToken", false, "ExitedAt", 1702975890000L); + Map allSegmentation = TestUtils.map("Copyright", "Countly", "AppExit", true, "DestroyToken", false, "ExitedAt", 1_702_975_890_000L); Countly.instance().views().stopAllViews(allSegmentation); validateView("A", 0.0, 2, 4, false, false, allSegmentation, "idv1", "idv1"); @@ -401,9 +401,9 @@ public void validateSegmentation_internalKeys() { Map internalKeysSegmentation = TestUtils.map("start", "YES", "name", TestUtils.keysValues[0], "visit", "YES", "segment", TestUtils.keysValues[1]); Countly.instance().views().startView("A", TestUtils.map(internalKeysSegmentation, "ultimate", "YES")); - Countly.instance().views().stopViewWithName("A", TestUtils.map(internalKeysSegmentation, "end", "Unfortunately", "time", 1234567890L)); + Countly.instance().views().stopViewWithName("A", TestUtils.map(internalKeysSegmentation, "end", "Unfortunately", "time", 1_234_567_890L)); validateView("A", 0.0, 0, 2, true, true, TestUtils.map("ultimate", "YES"), "idv1", ""); - validateView("A", 0.0, 1, 2, false, false, TestUtils.map("end", "Unfortunately", "time", 1234567890), "idv1", ""); + validateView("A", 0.0, 1, 2, false, false, TestUtils.map("end", "Unfortunately", "time", 1_234_567_890L), "idv1", ""); } /** diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/SessionImplTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/SessionImplTests.java index 2f0655eff..859d50c34 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/SessionImplTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/SessionImplTests.java @@ -41,7 +41,7 @@ public void stop() { @Test public void constructor() { Countly.instance().init(TestUtils.getConfigSessions()); - assertEquals(new Long(12345L), createSessionImpl(12345L).getId()); + assertEquals(new Long(12_345L), createSessionImpl(12_345L).getId()); } /** @@ -488,7 +488,7 @@ private void addCrashReport_base(Config config, int rqSize) { @Test public void hashCode_id() { Countly.instance().init(TestUtils.getConfigSessions()); - assertEquals(new Long(12345L).hashCode(), createSessionImpl(12345L).hashCode()); + assertEquals(new Long(12_345L).hashCode(), createSessionImpl(12_345L).hashCode()); } /** @@ -521,7 +521,7 @@ public void equals_test() { @Test public void equals_notInstanceOf() { Countly.instance().init(TestUtils.getConfigSessions()); - Assert.assertFalse(createSessionImpl(12345L).equals(new Object())); + Assert.assertFalse(createSessionImpl(12_345L).equals(new Object())); } /** @@ -632,8 +632,8 @@ public void view_stopStartedAndNext() { private void validateNotEquals(int idOffset, BiFunction> setter) { Countly.instance().init(TestUtils.getConfigSessions()); long ts = TimeUtils.timestampMs(); - SessionImpl session = createSessionImpl(12345L); - SessionImpl session2 = createSessionImpl(12345L + idOffset); + SessionImpl session = createSessionImpl(12_345L); + SessionImpl session2 = createSessionImpl(12_345L + idOffset); setter.apply(session, session).accept(ts); Assert.assertFalse(session.equals(session2)); } diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeGeneratorTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeGeneratorTests.java index 8a1b9aab0..8adf8f3c1 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeGeneratorTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeGeneratorTests.java @@ -10,7 +10,7 @@ public void testAsIs() { long last = simulator.timestamp(); - for (int i = 0; i < 10000; i++) { + for (int i = 0; i < 10_000; i++) { long next = simulator.timestamp(); Assert.assertNotSame(last, next); } @@ -27,7 +27,7 @@ public void testMidTimeChange() { Assert.assertNotSame(last, next); } - simulator.addition = -10000; + simulator.addition = -10_000; for (int i = 0; i < 100; i++) { long next = simulator.timestamp(); @@ -41,7 +41,7 @@ public void testMidTimeChange() { Assert.assertNotSame(last, next); } - simulator.addition = 10000; + simulator.addition = 10_000; for (int i = 0; i < 100; i++) { long next = simulator.timestamp(); @@ -55,9 +55,9 @@ public void testMidTimeRandomChange() { long last = simulator.timestamp(); - for (int i = 0; i < 100000; i++) { + for (int i = 0; i < 100_000; i++) { if (i % 30 == 0) { - simulator.addition = Math.round(Math.random() * 10000 - 5000); + simulator.addition = Math.round(Math.random() * 10_000 - 5000); } long next = simulator.timestamp(); Assert.assertNotSame(last, next); @@ -65,7 +65,7 @@ public void testMidTimeRandomChange() { simulator.addition = 0; - for (int i = 0; i < 100000; i++) { + for (int i = 0; i < 100_000; i++) { if (i % 30 == 0) { simulator.addition += Math.round(Math.random() * 1000 - 500); } diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeUtilsTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeUtilsTests.java index 55576f266..b2dc38407 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeUtilsTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/TimeUtilsTests.java @@ -45,7 +45,7 @@ public void uniqueTimestamp() { */ @Test public void nsToMs() { - Assert.assertEquals(1, TimeUtils.nsToMs(1000000)); + Assert.assertEquals(1, TimeUtils.nsToMs(1_000_000)); } /** @@ -54,7 +54,7 @@ public void nsToMs() { */ @Test public void nsToSec() { - Assert.assertEquals(1, TimeUtils.nsToSec(1000000000)); + Assert.assertEquals(1, TimeUtils.nsToSec(1_000_000_000)); } /** @@ -72,6 +72,6 @@ public void secToMs() { */ @Test public void secToNs() { - Assert.assertEquals(1000000000, TimeUtils.secToNs(1)); + Assert.assertEquals(1_000_000_000, TimeUtils.secToNs(1)); } } diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/UserEditorTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/UserEditorTests.java index 6a4aed96d..af01cc86b 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/UserEditorTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/UserEditorTests.java @@ -624,7 +624,7 @@ public void set_notAString() { .set(PredefinedUserPropertyKeys.USERNAME, new TestUtils.AtomicString("TestUsername")) .set(PredefinedUserPropertyKeys.EMAIL, new TestUtils.AtomicString("test@test.ly")) .set(PredefinedUserPropertyKeys.ORGANIZATION, new TestUtils.AtomicString("Magical Org")) - .set(PredefinedUserPropertyKeys.PHONE, 123456789) + .set(PredefinedUserPropertyKeys.PHONE, 123_456_789) .set(PredefinedUserPropertyKeys.PICTURE, new TestUtils.AtomicString("Not a picture")) .set(PredefinedUserPropertyKeys.PICTURE_PATH, new TestUtils.AtomicString("Not a picture path")) .set(PredefinedUserPropertyKeys.BIRTH_YEAR, new TestUtils.AtomicString("Not a birthyear")) From cccaf605439a7c0ae39a3ec2949338611245dab2 Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray <57103426+arifBurakDemiray@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:16:27 +0300 Subject: [PATCH 2/3] revert: BackendModeTests.java --- .../sdk/java/internal/BackendModeTests.java | 142 +++++++++--------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java index aad7ce7ef..678a5682b 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/BackendModeTests.java @@ -80,7 +80,7 @@ public void testMethodRecordView() { segmentation.put("start", "1"); Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", TestUtils.keysValues[0], segmentation, 1_646_640_780_130L); + backendMode.recordView("device-id-1", TestUtils.keysValues[0], segmentation, 1646640780130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1L, events.length()); @@ -100,7 +100,7 @@ public void testMethodRecordView() { Assert.assertEquals("Windows", segments.get("segment")); Assert.assertEquals("1", segments.get("start")); - backendMode.recordView("device-id-2", TestUtils.keysValues[1], null, 1_646_640_780_130L); + backendMode.recordView("device-id-2", TestUtils.keysValues[1], null, 1646640780130L); events = moduleBackendMode.eventQueues.get("device-id-2"); Assert.assertEquals(1L, events.length()); @@ -129,16 +129,16 @@ public void testMethodRecordViewWithInvalidData() { /* Invalid Device ID */ Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("", TestUtils.keysValues[0], segmentation, 1_646_640_780_130L); - backendMode.recordView(null, TestUtils.keysValues[1], segmentation, 1_646_640_780_130L); + backendMode.recordView("", TestUtils.keysValues[0], segmentation, 1646640780130L); + backendMode.recordView(null, TestUtils.keysValues[1], segmentation, 1646640780130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); /* Invalid view name */ Assert.assertEquals(0L, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", "", segmentation, 1_646_640_780_130L); - backendMode.recordView("device-id-2", null, segmentation, 1_646_640_780_130L); + backendMode.recordView("device-id-1", "", segmentation, 1646640780130L); + backendMode.recordView("device-id-2", null, segmentation, 1646640780130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); @@ -157,7 +157,7 @@ public void testMethodRecordEventWithSingleDeviceID() { segmentation.put("key2", "value2"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -190,15 +190,15 @@ public void testMethodRecordEventWithInvalidData() { Assert.assertEquals(0, moduleBackendMode.eventQSize); /* Invalid Device ID */ - backendMode.recordEvent("", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); - backendMode.recordEvent(null, "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent(null, "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); /* Invalid view name */ - backendMode.recordEvent("device-id-1", "", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); - backendMode.recordEvent("device-id-1", null, 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-1", null, 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertTrue(moduleBackendMode.eventQueues.isEmpty()); Assert.assertEquals(0L, moduleBackendMode.eventQSize); @@ -223,12 +223,12 @@ public void testMethodRecordEventWithMultipleDeviceID() { segmentation1.put("key4", "value4"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); - backendMode.recordEvent("device-id-2", "key-3", 2, 0.2, 20.0, segmentation1, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); + backendMode.recordEvent("device-id-2", "key-3", 2, 0.2, 20.0, segmentation1, 1646644457826L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(2, backendMode.getQueueSize()); @@ -290,43 +290,43 @@ public void TestEventThreshHoldWithSingleAndMultiple() { Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(2, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertNull(moduleBackendMode.eventQueues.get("device-id-1")); Assert.assertEquals(1, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(2, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-2", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); Assert.assertEquals(3, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(2, moduleBackendMode.eventQueues.get("device-id-2").length()); Assert.assertEquals(3, backendMode.getQueueSize()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(3, backendMode.getQueueSize()); Assert.assertNull(moduleBackendMode.eventQueues.get("device-id-1")); @@ -351,18 +351,18 @@ public void testFunctionalityAddEventsIntoRequestQueueOnSessionUpdate() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); @@ -387,18 +387,18 @@ public void testFunctionalityAddEventsIntoRequestQueueOnSessionEnd() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(1, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); - backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-2", "key-3", 1, 0.1, 10.0, segmentation, 1646640780130L); Assert.assertEquals(2, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-2").length()); - backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1_646_644_457_826L); + backendMode.recordEvent("device-id-2", "key-4", 2, 0.2, 20.0, segmentation1, 1646644457826L); Assert.assertEquals(3, moduleBackendMode.eventQSize); Assert.assertEquals(0, SDKCore.instance.requestQueueMemory.size()); Assert.assertEquals(1, moduleBackendMode.eventQueues.get("device-id-1").length()); @@ -427,7 +427,7 @@ public void testMethodSessionBegin() { location.put("country_code", "PK"); location.put("location", "31.5204,74.3587"); - backendMode.sessionBegin("device-id-1", metrics, location, 1_646_640_780_130L); + backendMode.sessionBegin("device-id-1", metrics, location, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -443,7 +443,7 @@ public void testMethodSessionBegin() { Assert.assertEquals("windows", sessionJson.get("os")); Assert.assertEquals("0.1", sessionJson.get("app-version")); Assert.assertEquals("1", request.params.get("begin_session")); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); } /** @@ -456,8 +456,8 @@ public void testMethodSessionBeginWithInvalidData() { metrics.put("os", "windows"); metrics.put("app-version", "0.1"); - backendMode.sessionBegin("", metrics, null, 1_646_640_780_130L); - backendMode.sessionBegin(null, metrics, null, 1_646_640_780_130L); + backendMode.sessionBegin("", metrics, null, 1646640780130L); + backendMode.sessionBegin(null, metrics, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -468,7 +468,7 @@ public void testMethodSessionBeginWithInvalidData() { @Test public void testMethodSessionUpdate() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionUpdate("device-id-1", 10.5, 1_646_640_780_130L); + backendMode.sessionUpdate("device-id-1", 10.5, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -483,8 +483,8 @@ public void testMethodSessionUpdate() { @Test public void testMethodSessionUpdateWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionUpdate("", 10.5, 1_646_640_780_130L); - backendMode.sessionUpdate(null, 10.5, 1_646_640_780_130L); + backendMode.sessionUpdate("", 10.5, 1646640780130L); + backendMode.sessionUpdate(null, 10.5, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -495,14 +495,14 @@ public void testMethodSessionUpdateWithInvalidData() { @Test public void testSessionEnd() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionEnd("device-id-1", 10.5, 1_646_640_780_130L); + backendMode.sessionEnd("device-id-1", 10.5, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); Assert.assertEquals("1", request.params.get("end_session")); Assert.assertEquals("10.5", request.params.get("session_duration")); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); } /** @@ -511,8 +511,8 @@ public void testSessionEnd() { @Test public void testMethodSessionEndWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); - backendMode.sessionEnd("", 10.5, 1_646_640_780_130L); - backendMode.sessionEnd(null, 20.5, 1_646_640_780_130L); + backendMode.sessionEnd("", 10.5, 1646640780130L); + backendMode.sessionEnd(null, 20.5, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -533,8 +533,8 @@ public void testMethodRecordException() { try { int a = 10 / 0; } catch (Exception e) { - backendMode.recordException("device-id-1", e, segmentation, crashDetails, 1_646_640_780_130L); - backendMode.recordException("device-id-2", "Divided By Zero", "stack traces", null, null, 1_646_640_780_130L); + backendMode.recordException("device-id-1", e, segmentation, crashDetails, 1646640780130L); + backendMode.recordException("device-id-2", "Divided By Zero", "stack traces", null, null, 1646640780130L); Assert.assertEquals(2, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); @@ -550,7 +550,7 @@ public void testMethodRecordException() { Assert.assertEquals("Custom Error", crashJson.get("_error")); Assert.assertEquals("Logs", crashJson.get("_logs")); Assert.assertEquals("Operating System", crashJson.get("_os")); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); JSONObject segments = crashJson.getJSONObject("_custom"); Assert.assertEquals("value1", segments.get("key1")); @@ -564,7 +564,7 @@ public void testMethodRecordException() { Assert.assertEquals("Divided By Zero", crashJson.get("_name")); Assert.assertEquals("stack traces", crashJson.get("_error")); - validateRequestTimeFields("device-id-2", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-2", 1646640780130L, request); segments = crashJson.getJSONObject("_custom"); Assert.assertTrue(segments.isEmpty()); @@ -580,25 +580,25 @@ public void testMethodRecordExceptionWithInvalidData() { Map segmentation = new ConcurrentHashMap<>(); segmentation.put("key1", "value1"); - backendMode.recordException("", null, segmentation, null, 1_646_640_780_130L); + backendMode.recordException("", null, segmentation, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException(null, null, segmentation, null, 1_646_640_780_130L); + backendMode.recordException(null, null, segmentation, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-1", null, segmentation, null, 1_646_640_780_130L); + backendMode.recordException("device-id-1", null, segmentation, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "", "stack traces", null, null, 1_646_640_780_130L); + backendMode.recordException("device-id-2", "", "stack traces", null, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "device-id", "", null, null, 1_646_640_780_130L); + backendMode.recordException("device-id-2", "device-id", "", null, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", null, "stack traces", null, null, 1_646_640_780_130L); + backendMode.recordException("device-id-2", null, "stack traces", null, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordException("device-id-2", "device-id", null, null, null, 1_646_640_780_130L); + backendMode.recordException("device-id-2", "device-id", null, null, null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -612,11 +612,11 @@ public void testUserDetailCustomDetailAndOperations() { // User detail Map userDetail = populateUserProperties(true, true, false); - backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, true, true, false); @@ -632,11 +632,11 @@ public void testUserDetailStructureAllDataAtSameLevel() { // User detail Map userDetail = populateUserProperties(true, true, true); - backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, true, true, true); @@ -652,11 +652,11 @@ public void testUserDetailStructureWithOnlyCustomDetail() { Map userDetail = populateUserProperties(false, true, false); - backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, false, true, false); @@ -672,11 +672,11 @@ public void testUserDetailStructureWithOnlyOperationData() { Map userDetail = populateUserProperties(false, false, true); - backendMode.recordUserProperties("device-id-1", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id-1", userDetail, 1646640780130L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); - validateRequestTimeFields("device-id-1", 1_646_640_780_130L, request); + validateRequestTimeFields("device-id-1", 1646640780130L, request); String userDetails = request.params.get("user_details"); validateUserProperties(userDetails, false, false, true); @@ -690,17 +690,17 @@ public void testMethodRecordUserPropertiesWithInvalidData() { ModuleBackendMode.BackendMode backendMode = moduleBackendMode.new BackendMode(); Map userDetail = populateUserProperties(true, false, false); - backendMode.recordUserProperties("", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("", userDetail, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordUserProperties(null, userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties(null, userDetail, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordUserProperties("device-id", null, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id", null, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); userDetail.clear(); - backendMode.recordUserProperties("device-id", userDetail, 1_646_640_780_130L); + backendMode.recordUserProperties("device-id", userDetail, 1646640780130L); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); } @@ -721,7 +721,7 @@ public void testEventSegmentDataType() { segmentation.put("key7", 10L); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1_646_640_780_130L); + backendMode.recordEvent("device-id-1", "key-1", 1, 0.1, 10.0, segmentation, 1646640780130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -729,7 +729,7 @@ public void testEventSegmentDataType() { JSONObject event = events.getJSONObject(0); - long expectedTimestamp = 1_646_640_780_130L; + long expectedTimestamp = 1646640780130L; int expectedHour = getHourFromTimeStamp(expectedTimestamp); validateEventFields("key-1", 1, 0.1, 10.0, 1, expectedHour, expectedTimestamp, event); @@ -763,7 +763,7 @@ public void testViewSegmentDataType() { segmentation.put("key7", 10L); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordView("device-id-1", "view-1", segmentation, 1_646_640_780_130L); + backendMode.recordView("device-id-1", "view-1", segmentation, 1646640780130L); JSONArray events = moduleBackendMode.eventQueues.get("device-id-1"); Assert.assertEquals(1, events.length()); @@ -804,7 +804,7 @@ public void testCrashSegmentDataType() { crashDetails.put("K2", "V2"); Assert.assertEquals(0, moduleBackendMode.eventQSize); - backendMode.recordException("device-id-1", "key-1", "stacktrace", segmentation, crashDetails, 1_646_640_780_130L); + backendMode.recordException("device-id-1", "key-1", "stacktrace", segmentation, crashDetails, 1646640780130L); Request request = SDKCore.instance.requestQueueMemory.remove(); String crash = request.params.get("crash"); @@ -845,14 +845,14 @@ public void testRecordDirectRequest() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordDirectRequest("device-id-2", requestData, 1_647_938_191_782L); + backendMode.recordDirectRequest("device-id-2", requestData, 1647938191782L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); Request request = SDKCore.instance.requestQueueMemory.remove(); Assert.assertEquals("value1", request.params.get("data1")); Assert.assertEquals("value3", request.params.get("data3")); Assert.assertEquals("1", request.params.get("dr")); - validateRequestTimeFields("device-id-2", 1_647_938_191_782L, request); + validateRequestTimeFields("device-id-2", 1647938191782L, request); // Direct request without timestamp and device id requestData = new ConcurrentHashMap<>(); @@ -861,7 +861,7 @@ public void testRecordDirectRequest() { Assert.assertEquals(0, moduleBackendMode.eventQSize); Assert.assertTrue(SDKCore.instance.requestQueueMemory.isEmpty()); - backendMode.recordDirectRequest("device-id-2", requestData, 987_654_321L); + backendMode.recordDirectRequest("device-id-2", requestData, 987654321L); Assert.assertEquals(1, SDKCore.instance.requestQueueMemory.size()); request = SDKCore.instance.requestQueueMemory.remove(); @@ -869,7 +869,7 @@ public void testRecordDirectRequest() { Assert.assertEquals("value4", request.params.get("data4")); Assert.assertEquals("1", request.params.get("dr")); - validateRequestTimeFields("device-id-2", 987_654_321L, request); + validateRequestTimeFields("device-id-2", 987654321L, request); } private Map populateUserProperties(boolean addUserDetail, boolean addCustomDetail, boolean addOperation) { @@ -954,4 +954,4 @@ private int getHourFromTimeStamp(long timeStamp) { return calendar.get(Calendar.HOUR_OF_DAY); } -} \ No newline at end of file +} From c626abcf3524ef7468cb8dfe5514fb4b7287f20d Mon Sep 17 00:00:00 2001 From: Arif Burak Demiray Date: Mon, 19 Feb 2024 10:23:23 +0300 Subject: [PATCH 3/3] fix: tests --- .../test/java/ly/count/sdk/java/internal/EventImplTests.java | 2 +- .../test/java/ly/count/sdk/java/internal/ModuleViewsTests.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java index cc2a7a005..70df02df5 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/EventImplTests.java @@ -220,7 +220,7 @@ public void validateFromJson_toJson_segmentation() { expectedSegmentation.put("price", BigDecimal.valueOf(9.43)); expectedSegmentation.put("quantity", 3); expectedSegmentation.put("name", "test"); - expectedSegmentation.put("checksum", 56_476_587L); + expectedSegmentation.put("checksum", 56_476_587); expectedSegmentation.put("divisor", BigDecimal.valueOf(0.2)); JSONObject json = new JSONObject(); diff --git a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java index e9bb7f4ed..2c25479da 100644 --- a/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java +++ b/sdk-java/src/test/java/ly/count/sdk/java/internal/ModuleViewsTests.java @@ -403,7 +403,7 @@ public void validateSegmentation_internalKeys() { Countly.instance().views().startView("A", TestUtils.map(internalKeysSegmentation, "ultimate", "YES")); Countly.instance().views().stopViewWithName("A", TestUtils.map(internalKeysSegmentation, "end", "Unfortunately", "time", 1_234_567_890L)); validateView("A", 0.0, 0, 2, true, true, TestUtils.map("ultimate", "YES"), "idv1", ""); - validateView("A", 0.0, 1, 2, false, false, TestUtils.map("end", "Unfortunately", "time", 1_234_567_890L), "idv1", ""); + validateView("A", 0.0, 1, 2, false, false, TestUtils.map("end", "Unfortunately", "time", 1_234_567_890), "idv1", ""); } /**