Skip to content

Commit

Permalink
feat: standolaness for every test util
Browse files Browse the repository at this point in the history
  • Loading branch information
arifBurakDemiray committed Sep 22, 2023
1 parent dcb6ce4 commit 3132b8e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion sdk-java/src/test/java/ly/count/sdk/java/internal/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,38 @@
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Stream;
import ly.count.sdk.java.Config;

import static ly.count.sdk.java.internal.SDKStorage.EVENT_QUEUE_FILE_NAME;
import static ly.count.sdk.java.internal.SDKStorage.FILE_NAME_PREFIX;
import static ly.count.sdk.java.internal.SDKStorage.FILE_NAME_SEPARATOR;

public class TestUtils {

private static String DELIMETER = ":::";
static String SERVER_URL = "https://try.count.ly";
static String SERVER_APP_KEY = "COUNTLY_APP_KEY";

private TestUtils() {
}

static Config getBaseConfig() {
File sdkStorageRootDirectory = getSdkStorageRootDirectory();
checkSdkStorageRootDirectoryExist(sdkStorageRootDirectory);
return new Config(SERVER_URL, SERVER_APP_KEY, sdkStorageRootDirectory);
}

static File getSdkStorageRootDirectory() {
// System specific folder structure
String[] sdkStorageRootPath = { System.getProperty("user.home"), "__COUNTLY", "java_test" };
return new File(String.join(File.separator, sdkStorageRootPath));
}

static void checkSdkStorageRootDirectoryExist(File directory) {
if (directory.mkdirs()) {
throw new RuntimeException("Directory creation failed");
}
}

/**
* Get current request queue from target folder
*
Expand Down

0 comments on commit 3132b8e

Please sign in to comment.