diff --git a/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/Config.java b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/Config.java index 6613e34e352f3a867f7724d24e687bc89dffacd6..4199f3eab2909ba3a81331aeb8056a78278fd904 100644 --- a/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/Config.java +++ b/testing/register-test-core/src/main/java/org/opengroup/osdu/register/util/Config.java @@ -16,6 +16,10 @@ package org.opengroup.osdu.register.util; +import com.google.common.base.Strings; + +import java.util.Base64; + public class Config { public String HostUrl; public String securePushUrl; @@ -33,12 +37,16 @@ public class Config { if (env.equalsIgnoreCase("LOCAL")) { config.HostUrl = System.getProperty("REGISTER_BASE_URL", System.getenv("REGISTER_BASE_URL")); - config.securePushUrl = "https://localhost:8080/"; + config.securePushUrl= getEnvironmentVariableOrDefaultValue("REGISTER_LOCAL_PUSH_URL","https://localhost:8080/"); config.subscriptionId = System.getProperty("TEST_SUBSCRIPTION_ID", System.getenv("TEST_SUBSCRIPTION_ID")); + config.subscriptionId = Base64.getEncoder().encodeToString(("records-changed"+ config.securePushUrl).getBytes()); config.PushUrl = config.HostUrl; } else if (env.equalsIgnoreCase("DEV")) { + + String custom_push_url = System.getProperty("REGISTER_CUSTOM_PUSH_URL1", System.getenv("REGISTER_CUSTOM_PUSH_URL1")); config.subscriptionId = getEnvironmentVariableOrDefaultValue("SUBSCRIPTION_ID", - "cmVjb3Jkcy1jaGFuZ2VkaHR0cHM6Ly9vcy1yZWdpc3Rlci1kb3Qtb3BlbmRlcy5hcHBzcG90LmNvbS9hcGkvcmVnaXN0ZXIvdjEvdGVzdC9jaGFsbGVuZ2UvMQ=="); + genSubscriptionId(custom_push_url)); + config.HostUrl = System.getProperty("REGISTER_BASE_URL", System.getenv("REGISTER_BASE_URL")); config.securePushUrl = config.HostUrl; config.PushUrl = config.HostUrl; @@ -61,4 +69,9 @@ public class Config { private static String getEnvironmentVariable(String propertyKey) { return System.getProperty(propertyKey, System.getenv(propertyKey)); } + + private static String genSubscriptionId(String custom_push_url) + { + return Base64.getEncoder().encodeToString(("records-changed"+ custom_push_url).getBytes()); + } }