Skip to content

Commit

Permalink
fix: revert split up
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Jan 15, 2024
1 parent 4b18e56 commit a6c28c4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 29 deletions.
12 changes: 10 additions & 2 deletions app-java/src/main/java/ly/count/java/demo/BackendModeExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ private static void recordDirectRequest() {
}

private static void startSession() {
Map<String, String> metrics = DemoUtils.mapS("_os", "Windows", "_os_version", "10", "_app_version", "1.2");
Map<String, String> location = DemoUtils.mapS("ip_address", "IP_ADDR", "city", "Lahore", "country_code", "PK", "location", "31.5204,74.3587");
Map<String, String> metrics = new ConcurrentHashMap<>();
metrics.put("_os", "Windows");
metrics.put("_os_version", "10");
metrics.put("_app_version", "1.2");

Map<String, String> location = new ConcurrentHashMap<>();
location.put("ip_address", "IP_ADDR");
location.put("city", "Lahore");
location.put("country_code", "PK");
location.put("location", "31.5204,74.3587");

Countly.instance().backendM().sessionBegin(DEVICE_ID, metrics, location, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.util.Map;
import java.util.Scanner;
import java.util.concurrent.ConcurrentHashMap;
import ly.count.sdk.java.Config;
import ly.count.sdk.java.Countly;
import ly.count.sdk.java.internal.Device;
Expand Down Expand Up @@ -49,7 +50,7 @@ static void performLargeRequestQueueSizeTest() {
DemoUtils.printf("Adding %d requests(events) into request Queue%n", batchSize);
for (int i = 1; i < batchSize; ++i) {

Map<String, Object> segment = DemoUtils.map();
Map<String, Object> segment = new ConcurrentHashMap<>();
segment.put("Time Spent", 60);
segment.put("Retry Attempts", 60);

Expand All @@ -59,10 +60,10 @@ static void performLargeRequestQueueSizeTest() {
DemoUtils.printf("Adding %d requests(crash) into request Queue%n", batchSize);
for (int i = 1; i < batchSize; ++i) {

Map<String, Object> segmentation = DemoUtils.map();
Map<String, Object> segmentation = new ConcurrentHashMap<>();
segmentation.put("signup page", "authenticate request");

Map<String, String> crashDetails = DemoUtils.mapS();
Map<String, String> crashDetails = new ConcurrentHashMap<>();
crashDetails.put("_os", "Windows 8");
crashDetails.put("_os_version", "8.202");
crashDetails.put("_logs", "main page");
Expand All @@ -74,7 +75,7 @@ static void performLargeRequestQueueSizeTest() {
for (int i = 1; i < batchSize; ++i) {

// User detail
Map<String, Object> userDetail = DemoUtils.map();
Map<String, Object> userDetail = new ConcurrentHashMap<>();
userDetail.put("name", "Full Name");
userDetail.put("username", "username1");
userDetail.put("email", "[email protected]");
Expand All @@ -93,12 +94,12 @@ static void performLargeRequestQueueSizeTest() {

DemoUtils.printf("Adding %d requests(sessions) into request Queue%n", batchSize);
for (int i = 1; i < batchSize; ++i) {
Map<String, String> metrics = DemoUtils.mapS();
Map<String, String> metrics = new ConcurrentHashMap<>();
metrics.put("_os", "MacOs");
metrics.put("_os_version", "13");
metrics.put("_app_version", "1.3");

Map<String, String> location = DemoUtils.mapS();
Map<String, String> location = new ConcurrentHashMap<>();
location.put("ip_address", "IP_ADDR");
location.put("city", "Lahore");
location.put("country_code", "PK");
Expand All @@ -123,7 +124,7 @@ static void performLargeEventQueueTest() {
DemoUtils.printf("Adding %d events into event Queue against deviceID = %s%n", 1_000_00, "device-id-" + d);
for (int i = 1; i <= noOfEvents; ++i) {

Map<String, Object> segment = DemoUtils.map();
Map<String, Object> segment = new ConcurrentHashMap<>();
segment.put("Time Spent", 60);
segment.put("Retry Attempts", 60);

Expand All @@ -150,7 +151,7 @@ static void recordBulkDataAndSendToServer() throws InterruptedException {
Thread.sleep(secondsToSleep * 1000);
} else {
if (remaining > 0) {
Map<String, Object> segment = DemoUtils.map();
Map<String, Object> segment = new ConcurrentHashMap<>();
segment.put("Time Spent", 60);
segment.put("Retry Attempts", 60);

Expand Down
19 changes: 0 additions & 19 deletions app-java/src/main/java/ly/count/java/demo/DemoUtils.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package ly.count.java.demo;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public final class DemoUtils {

private DemoUtils() {
Expand All @@ -26,20 +23,4 @@ static void println(final String message) {
static void printf(final String message, final Object... args) {
System.out.printf(message, args);
}

static Map<String, Object> map(final Object... args) {
Map<String, Object> map = new ConcurrentHashMap<>();
for (int i = 0; i < args.length; i += 2) {
map.put(args[i].toString(), args[i + 1]);
}
return map;
}

static Map<String, String> mapS(final String... args) {
Map<String, String> map = new ConcurrentHashMap<>();
for (int i = 0; i < args.length; i += 2) {
map.put(args[i], args[i + 1]);
}
return map;
}
}

0 comments on commit a6c28c4

Please sign in to comment.