Delete keystores from policy-api 50/119550/1
authorJim Hahn <jrh3@att.com>
Fri, 19 Mar 2021 15:38:39 +0000 (11:38 -0400)
committerJim Hahn <jrh3@att.com>
Fri, 19 Mar 2021 15:42:00 +0000 (11:42 -0400)
The Keystore is no longer needed in the tarball, as it is supplied
externally by the CSITs and Helm charts.  Deleted that file.
Also modified the junits to use utils-test to generates keystores at
runtime, thus deleted the junit keystore file, too.

Issue-ID: POLICY-3143
Change-Id: Ib3e2001f2dc41a528d1be2e81091a278cc31dff8
Signed-off-by: Jim Hahn <jrh3@att.com>
main/src/test/java/org/onap/policy/api/main/rest/TestApiRestServer.java
main/src/test/resources/ssl/policy-keystore [deleted file]
packages/policy-api-tarball/src/main/resources/etc/ssl/policy-keystore [deleted file]

index c706d2c..aac37f1 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- *  Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ *  Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
  *  Modifications Copyright (C) 2019-2020 Nordix Foundation.
  *  Modifications Copyright (C) 2020 Bell Canada.
  * ================================================================================
@@ -67,6 +67,7 @@ import org.onap.policy.common.utils.coder.StandardYamlCoder;
 import org.onap.policy.common.utils.network.NetworkUtil;
 import org.onap.policy.common.utils.resources.ResourceUtils;
 import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.common.utils.security.SelfSignedKeyStore;
 import org.onap.policy.models.base.PfModelException;
 import org.onap.policy.models.errors.concepts.ErrorResponse;
 import org.onap.policy.models.provider.PolicyModelsProviderParameters;
@@ -121,8 +122,6 @@ public class TestApiRestServer {
 
     private static final String POLICIES = "policies";
 
-    private static final String KEYSTORE = System.getProperty("user.dir") + "/src/test/resources/ssl/policy-keystore";
-
     // @formatter:off
     private static final String[] TOSCA_POLICY_RESOURCE_NAMES = {"policies/vCPE.policy.monitoring.input.tosca.json",
         "policies/vCPE.policy.monitoring.input.tosca.yaml", "policies/vDNS.policy.monitoring.input.tosca.json",
@@ -180,9 +179,10 @@ public class TestApiRestServer {
      *
      * @throws PfModelException the PfModel parsing exception
      * @throws IOException on I/O exceptions
+     * @throws InterruptedException if interrupted
      */
     @BeforeClass
-    public static void setupParameters() throws PfModelException, IOException {
+    public static void setupParameters() throws PfModelException, IOException, InterruptedException {
         providerParams = new PolicyModelsProviderParameters();
         // H2, use "org.mariadb.jdbc.Driver" and "jdbc:mariadb://localhost:3306/policy" for locally installed MariaDB
         providerParams.setDatabaseDriver("org.h2.Driver");
@@ -201,8 +201,8 @@ public class TestApiRestServer {
 
         final String[] apiConfigParameters = new String[2];
         final Properties systemProps = System.getProperties();
-        systemProps.put("javax.net.ssl.keyStore", KEYSTORE);
-        systemProps.put("javax.net.ssl.keyStorePassword", "Pol1cy_0nap");
+        systemProps.put("javax.net.ssl.keyStore", new SelfSignedKeyStore().getKeystoreName());
+        systemProps.put("javax.net.ssl.keyStorePassword", SelfSignedKeyStore.KEYSTORE_PASSWORD);
         System.setProperties(systemProps);
         new CommonTestData().makeParameters("src/test/resources/parameters/ApiConfigParameters_Https.json",
                 "src/test/resources/parameters/ApiConfigParameters_HttpsXXX.json", apiPort);
diff --git a/main/src/test/resources/ssl/policy-keystore b/main/src/test/resources/ssl/policy-keystore
deleted file mode 100644 (file)
index b95e010..0000000
Binary files a/main/src/test/resources/ssl/policy-keystore and /dev/null differ
diff --git a/packages/policy-api-tarball/src/main/resources/etc/ssl/policy-keystore b/packages/policy-api-tarball/src/main/resources/etc/ssl/policy-keystore
deleted file mode 100644 (file)
index b95e010..0000000
Binary files a/packages/policy-api-tarball/src/main/resources/etc/ssl/policy-keystore and /dev/null differ