summaryrefslogtreecommitdiffstats
path: root/policy-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy-utils/src')
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java24
-rw-r--r--policy-utils/src/test/resources/interpolation.properties26
2 files changed, 43 insertions, 7 deletions
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
index 006d709c..4b4b9d64 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/PropertyUtilTest.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -40,12 +40,28 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PropertyUtilTest {
+ /*
+ * Note: to generate the encrypted values, invoke CryptoUtils passing both the value
+ * to be encrypted and the crypto key.
+ *
+ * The INTERPOLATION_CRYPTO_KEY is a 16 or 32 character string, base-64 encoded.
+ *
+ * For "INTERPOLATION_ENC_HELLOWORLD", the encrypted value was generated via:
+ * java org.onap.policy.common.utils.security.CryptoUtils enc HelloWorld MTIzNDU2Nzg5MDEyMzQ1Ng==
+ *
+ * The generated value should also be placed into the following properties within
+ * the file, interpolation.properties:
+ * interpolation.enc
+ * interpolation.enc2
+ * interpolation.envenc
+ */
private static final String INTERPOLATION_PROPERTIES = "src/test/resources/interpolation.properties";
private static final String INTERPOLATION_CRYPTO_KEY = "MTIzNDU2Nzg5MDEyMzQ1Ng==";
private static final String INTERPOLATION_PLAINTEXT = "HelloWorld";
private static final String INTERPOLATION_ENVD_DEFAULT_VALUE = "default";
- private static final String INTERPOLATION_ENC_HELLOWORLD = "enc:hcI2XVX+cxPz/6rlbebkWpCFF6WPbBtT7iJRr2VHUkA=";
+ private static final String INTERPOLATION_ENC_HELLOWORLD =
+ "enc:MjGhDZTTIx1ihB7KvxLnOJcvb0WN/CSgpw7sY1hDnvL1VHa8wGRzOX3X";
private static final String INTERPOLATION_ENC_HELLOWORLD_VAR = "${" + INTERPOLATION_ENC_HELLOWORLD + "}";
private static final String INTERPOLATION_NO = "interpolation.no";
diff --git a/policy-utils/src/test/resources/interpolation.properties b/policy-utils/src/test/resources/interpolation.properties
index 2145fb61..78ec546b 100644
--- a/policy-utils/src/test/resources/interpolation.properties
+++ b/policy-utils/src/test/resources/interpolation.properties
@@ -1,3 +1,23 @@
+#
+# ============LICENSE_START=======================================================
+# ONAP
+# ================================================================================
+# Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+#
+
interpolation.no=no
interpolation.env=${env:HOME}
interpolation.const=${const:org.onap.policy.drools.utils.logging.LoggerUtil.ROOT_LOGGER}
@@ -6,6 +26,6 @@ interpolation.envd=${envd:HOME}
interpolation.envd.default=${envd:BLAH:default}
interpolation.envd.none=${envd:BLAH}
interpolation.envd.nodefault=${envd:BLAH:}
-interpolation.enc=${enc:hcI2XVX+cxPz/6rlbebkWpCFF6WPbBtT7iJRr2VHUkA=}
-interpolation.enc2=enc:hcI2XVX+cxPz/6rlbebkWpCFF6WPbBtT7iJRr2VHUkA=
-interpolation.envenc=${envd:HELLOWORLD:enc:hcI2XVX+cxPz/6rlbebkWpCFF6WPbBtT7iJRr2VHUkA=} \ No newline at end of file
+interpolation.enc=${enc:MjGhDZTTIx1ihB7KvxLnOJcvb0WN/CSgpw7sY1hDnvL1VHa8wGRzOX3X}
+interpolation.enc2=enc:MjGhDZTTIx1ihB7KvxLnOJcvb0WN/CSgpw7sY1hDnvL1VHa8wGRzOX3X
+interpolation.envenc=${envd:HELLOWORLD:enc:MjGhDZTTIx1ihB7KvxLnOJcvb0WN/CSgpw7sY1hDnvL1VHa8wGRzOX3X}