From 21668e21a48039581db4f81fe5d9cb06b6e0a3fb Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 11:21:56 +0200 Subject: [PATCH 1/4] Update for next development version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2f00a2e..9aba342 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.utplsql utplsql-java-api - 3.1.15 + 3.1.16-SNAPSHOT utPLSQL Java API Java API for running Unit Tests with utPLSQL v3+. From ce5624c8b875e0d504a726c79ca59fc80d80a6e2 Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 13:18:05 +0200 Subject: [PATCH 2/4] Added actual version --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ea3be46..b1dde27 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,13 @@ This is a collection of classes, that makes it easy to access the [utPLSQL v3](h This is a Maven Library project, you can add on your Java project as a dependency. +*Notice: You no longer need to configure an additional repository. The library is available in Maven Central since version 3.1.15.* + ```xml org.utplsql utplsql-java-api - 3.1.10 + 3.1.15 ``` From 47db0136aeb61cffc27d06d0cfe9c343645d7f2f Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 17:09:35 +0200 Subject: [PATCH 3/4] Re-added EnvironmentVariableUtil. Updated version in read me. --- README.md | 2 +- .../utplsql/api/EnvironmentVariableUtil.java | 53 +++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/utplsql/api/EnvironmentVariableUtil.java diff --git a/README.md b/README.md index b1dde27..3f11520 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This is a Maven Library project, you can add on your Java project as a dependenc org.utplsql utplsql-java-api - 3.1.15 + 3.1.16 ``` diff --git a/src/main/java/org/utplsql/api/EnvironmentVariableUtil.java b/src/main/java/org/utplsql/api/EnvironmentVariableUtil.java new file mode 100644 index 0000000..90ca49f --- /dev/null +++ b/src/main/java/org/utplsql/api/EnvironmentVariableUtil.java @@ -0,0 +1,53 @@ +package org.utplsql.api; + +import javax.annotation.Nullable; + +/** + * This class provides an easy way to get environmental variables. + * This is mainly to improve testability but also to standardize the way how utPLSQL API and CLI read from + * environment. + *

+ * Variables are obtained from the following scopes in that order (chain breaks as soon as a value is obtained): + *

    + *
  • Properties (System.getProperty())
  • + *
  • Environment (System.getEnv())
  • + *
  • Default value
  • + *
+ *

+ * An empty string is treated the same as null. + * + * @author pesse + */ +public class EnvironmentVariableUtil { + + private EnvironmentVariableUtil() { + } + + /** + * Returns the value for a given key from environment (see class description) + * + * @param key Key of environment or property value + * @return Environment value or null + */ + public static String getEnvValue(String key) { + return getEnvValue(key, null); + } + + /** + * Returns the value for a given key from environment or a default value (see class description) + * + * @param key Key of environment or property value + * @param defaultValue Default value if nothing found + * @return Environment value or defaultValue + */ + public static String getEnvValue(String key, @Nullable String defaultValue) { + + String val = System.getProperty(key); + if (val == null || val.isEmpty()) val = System.getenv(key); + if (val == null || val.isEmpty()) val = defaultValue; + + return val; + } + + +} From 2240fee00e1091b8eaf0bc589e862ba7fe7825bf Mon Sep 17 00:00:00 2001 From: Simon Martinelli Date: Tue, 11 Jul 2023 17:10:47 +0200 Subject: [PATCH 4/4] Update versions for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9aba342..98103bf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.utplsql utplsql-java-api - 3.1.16-SNAPSHOT + 3.1.16 utPLSQL Java API Java API for running Unit Tests with utPLSQL v3+.