Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] Add warnings to all SDK example apps that would check if propper credentials have been set or it still has the defaults. #230

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public class BackendModeExample {
final static String DEVICE_ID = "device-id";
final static String COUNTLY_APP_KEY = "COUNTLY_APP_KEY";
final static String COUNTLY_SERVER_URL = "https://xxx.server.ly/";
final static String COUNTLY_SERVER_URL = "https://your.server.ly";
final static String COUNTLY_APP_KEY = "YOUR_APP_KEY";

private static void recordUserDetailAndProperties() {
Map<String, Object> userDetail = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -288,6 +288,11 @@ static void recordDataWithLegacyCalls() {

public static void main(String[] args) throws Exception {

if (COUNTLY_SERVER_URL.equals("https://your.server.ly") || COUNTLY_APP_KEY.equals("YOUR_APP_KEY")) {
DemoUtils.println("Please provide correct COUNTLY_SERVER_URL and COUNTLY_APP_KEY");
return;
}

Scanner scanner = new Scanner(System.in);

Config config = new Config(COUNTLY_SERVER_URL, COUNTLY_APP_KEY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

public final class BackendModePerformanceTests {
final static String DEVICE_ID = "device-id";
final static String COUNTLY_APP_KEY = "COUNTLY_APP_KEY";
final static String COUNTLY_SERVER_URL = "https://xxx.server.ly/";
final static String COUNTLY_SERVER_URL = "https://your.server.ly";
final static String COUNTLY_APP_KEY = "YOUR_APP_KEY";

private BackendModePerformanceTests() {
}
Expand Down Expand Up @@ -170,6 +170,12 @@ static void recordBulkDataAndSendToServer() throws InterruptedException {
public static void main(String[] args) throws Exception {
boolean running = true;
long startTime = 0;

if (COUNTLY_SERVER_URL.equals("https://your.server.ly") || COUNTLY_APP_KEY.equals("YOUR_APP_KEY")) {
DemoUtils.println("Please provide correct COUNTLY_SERVER_URL and COUNTLY_APP_KEY");
return;
}

try (Scanner scanner = new Scanner(System.in)) {
while (running) {

Expand Down
9 changes: 7 additions & 2 deletions app-java/src/main/java/ly/count/java/demo/Example.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,13 @@ public static void main(String[] args) throws Exception {

Scanner scanner = new Scanner(System.in);

String COUNTLY_SERVER_URL = "https://xxx.server.ly/";
String COUNTLY_APP_KEY = "COUNTLY_APP_KEY";
String COUNTLY_SERVER_URL = "https://your.server.ly";
String COUNTLY_APP_KEY = "YOUR_APP_KEY";

if (COUNTLY_SERVER_URL.equals("https://your.server.ly") || COUNTLY_APP_KEY.equals("YOUR_APP_KEY")) {
DemoUtils.println("Please provide correct COUNTLY_SERVER_URL and COUNTLY_APP_KEY");
return;
}

Map<String, String> metricOverride = new ConcurrentHashMap<>();
metricOverride.put("aa", "11");
Expand Down