/** * Gets a property from system, environment or an external map. This method supports also passing an alternative * name. * The reason for supporting multiple names, is to support multiple keys for the same property (e.g. adding a new and * deprecating the old). * The lookup order is system[name] > env[name] > map[name] > system[alternativeName] > env[alternativeName] > * map[alternativeName] > defaultValue. * * @param name * The name of the property. * @param alternativeName * An alternate name to use. * @param map * The external map. * @param defaultValue * The value that should be used if property is not found. */ public static String getStringProperty(String name, String alternativeName, Map<String, String> map, String defaultValue) { return getStringProperty(name, map, getStringProperty(alternativeName, map, defaultValue)); }
/** * Gets a property from system, environment or an external map. This method supports also passing an alternative * name. * The reason for supporting multiple names, is to support multiple keys for the same property (e.g. adding a new and * deprecating the old). * The lookup order is system[name] > env[name] > map[name] > system[alternativeName] > env[alternativeName] > * map[alternativeName] > defaultValue. * * @param name * The name of the property. * @param alternativeName * An alternate name to use. * @param map * The external map. * @param defaultValue * The value that should be used if property is not found. */ public static String getStringProperty(String name, String alternativeName, Map<String, String> map, String defaultValue) { return getStringProperty(name, map, getStringProperty(alternativeName, map, defaultValue)); }
String namespace = getBooleanProperty(NAMESPACE_USE_CURRENT, map, false) ? new ConfigBuilder().build().getNamespace() : getStringProperty(NAMESPACE_TO_USE, map, null); namespace = getStringProperty(NAMESPACE_PREFIX, map, "itest") + "-" + sessionId; shouldDestroyNamespace = true; .withNamespace(namespace) .withMasterUrl( new URL(getStringProperty(MASTER_URL, KUBERNETES_MASTER, map, FALLBACK_CLIENT_CONFIG.getMasterUrl()))) .withEnvironmentInitEnabled(getBooleanProperty(ENVIRONMENT_INIT_ENABLED, map, true)) .withLogCopyEnabled(getBooleanProperty(LOGS_COPY, map, false)) .withLogPath(getStringProperty(LOGS_PATH, map, null)) .withScriptEnvironmentVariables(parseMap(map.get(ENVIRONMENT_SCRIPT_ENV))) .withEnvironmentSetupScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_SETUP_SCRIPT_URL, map, null))) .withEnvironmentTeardownScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_TEARDOWN_SCRIPT_URL, map, null))) .withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null))
String namespace = getBooleanProperty(NAMESPACE_USE_CURRENT, map, false) ? new ConfigBuilder().build().getNamespace() : getStringProperty(NAMESPACE_TO_USE, map, null); namespace = getStringProperty(NAMESPACE_PREFIX, map, "itest") + "-" + sessionId; shouldDestroyNamespace = true; .withNamespace(namespace) .withMasterUrl( new URL(getStringProperty(MASTER_URL, KUBERNETES_MASTER, map, FALLBACK_CLIENT_CONFIG.getMasterUrl()))) .withEnvironmentInitEnabled(getBooleanProperty(ENVIRONMENT_INIT_ENABLED, map, true)) .withLogCopyEnabled(getBooleanProperty(LOGS_COPY, map, false)) .withLogPath(getStringProperty(LOGS_PATH, map, null)) .withScriptEnvironmentVariables(parseMap(map.get(ENVIRONMENT_SCRIPT_ENV))) .withEnvironmentSetupScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_SETUP_SCRIPT_URL, map, null))) .withEnvironmentTeardownScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_TEARDOWN_SCRIPT_URL, map, null))) .withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null))
String namespace = getBooleanProperty(NAMESPACE_USE_CURRENT, map, false) ? new ConfigBuilder().build().getNamespace() : getStringProperty(NAMESPACE_TO_USE, map, null); namespace = getStringProperty(NAMESPACE_PREFIX, map, "itest") + "-" + sessionId; shouldDestroyNamespace = true; .withNamespace(namespace) .withMasterUrl( new URL(getStringProperty(MASTER_URL, KUBERNETES_MASTER, map, FALLBACK_CLIENT_CONFIG.getMasterUrl()))) .withScriptEnvironmentVariables(parseMap(map.get(ENVIRONMENT_SCRIPT_ENV))) .withEnvironmentInitEnabled(getBooleanProperty(ENVIRONMENT_INIT_ENABLED, map, true)) .withLogCopyEnabled(getBooleanProperty(LOGS_COPY, map, false)) .withLogPath(getStringProperty(LOGS_PATH, map, null)) .withEnvironmentSetupScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_SETUP_SCRIPT_URL, map, null))) .withEnvironmentTeardownScriptUrl( asUrlOrResource(getStringProperty(ENVIRONMENT_TEARDOWN_SCRIPT_URL, map, null))) .withEnvironmentConfigUrl(getKubernetesConfigurationUrl(map)) .withEnvironmentDependencies( asURL(Strings.splitAndTrimAsList(getStringProperty(ENVIRONMENT_DEPENDENCIES, map, ""), "\\s*,\\s*"))) .withNamespaceLazyCreateEnabled( getBooleanProperty(NAMESPACE_LAZY_CREATE_ENABLED, map, DEFAULT_NAMESPACE_LAZY_CREATE_ENABLED)) .withWaitPollInterval(getLongProperty(WAIT_POLL_INTERVAL, map, DEFAULT_WAIT_POLL_INTERVAL)) .withWaitForServiceList( Strings.splitAndTrimAsList(getStringProperty(WAIT_FOR_SERVICE_LIST, map, ""), "\\s*,\\s*")) .withAnsiLoggerEnabled(getBooleanProperty(ANSI_LOGGER_ENABLED, map, true)) .withKubernetesDomain(getStringProperty(DOMAIN, KUBERNETES_DOMAIN, map, null))