Fix the ssl config 85/112685/3
authorsebdet <sebastien.determe@intl.att.com>
Tue, 15 Sep 2020 09:53:27 +0000 (11:53 +0200)
committersebdet <sebastien.determe@intl.att.com>
Tue, 15 Sep 2020 14:19:11 +0000 (16:19 +0200)
Fix SSL config so that clamp can access external files from the application.properties spring definition

Issue-ID: CLAMP-884
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: Ic4483d56c86f52249b09b386cdbe505f2f2f2a66
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
33 files changed:
src/main/java/org/onap/clamp/clds/Application.java
src/main/java/org/onap/clamp/clds/config/CamelConfiguration.java
src/main/java/org/onap/clamp/clds/config/SslConfig.java
src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
src/main/java/org/onap/clamp/clds/util/ClampVersioning.java
src/main/java/org/onap/clamp/clds/util/CryptoUtils.java
src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java [deleted file]
src/main/java/org/onap/clamp/clds/util/ResourceFileUtils.java [new file with mode: 0644]
src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
src/main/java/org/onap/clamp/util/PassDecoder.java
src/main/resources/application.properties
src/test/java/org/onap/clamp/clds/client/CdsServicesTest.java
src/test/java/org/onap/clamp/clds/config/sdc/SdcSingleControllerConfigurationTest.java
src/test/java/org/onap/clamp/clds/it/config/CldsReferencePropertiesItCase.java
src/test/java/org/onap/clamp/clds/sdc/controller/installer/BlueprintParserTest.java
src/test/java/org/onap/clamp/clds/sdc/controller/installer/CsarHandlerTest.java
src/test/java/org/onap/clamp/clds/tosca/ToscaYamlToJsonConvertorTestItCase.java
src/test/java/org/onap/clamp/clds/tosca/update/ArrayFieldTest.java
src/test/java/org/onap/clamp/clds/tosca/update/ConstraintTest.java
src/test/java/org/onap/clamp/clds/tosca/update/JsonTemplateManagerTest.java
src/test/java/org/onap/clamp/clds/tosca/update/ToscaConverterWithDictionarySupportItCase.java
src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementPropertyTest.java
src/test/java/org/onap/clamp/clds/tosca/update/ToscaElementTest.java
src/test/java/org/onap/clamp/clds/util/JsonUtilsTest.java
src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
src/test/java/org/onap/clamp/loop/PolicyComponentTest.java
src/test/java/org/onap/clamp/loop/PolicyModelServiceItCase.java
src/test/java/org/onap/clamp/loop/deploy/BlueprintInputParametersTest.java
src/test/java/org/onap/clamp/policy/microservice/MicroServicePayloadTest.java
src/test/java/org/onap/clamp/policy/microservice/OperationalPolicyPayloadTest.java
src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
src/test/resources/https/https-test.properties

index 8423299..c2a1ab9 100644 (file)
@@ -39,14 +39,13 @@ import java.util.Enumeration;
 
 import org.apache.catalina.connector.Connector;
 import org.onap.clamp.clds.util.ClampVersioning;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.util.PassDecoder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
 import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
 import org.springframework.boot.builder.SpringApplicationBuilder;
@@ -111,7 +110,7 @@ public class Application extends SpringBootServletInitializer {
      */
     @Bean
     public ServletRegistrationBean camelServletRegistrationBean() throws IOException {
-        eelfLogger.info(ResourceFileUtil.getResourceAsString("boot-message.txt") + "(v"
+        eelfLogger.info(ResourceFileUtils.getResourceAsString("boot-message.txt") + "(v"
                 + ClampVersioning.getCldsVersionFromProps() + ")" + System.getProperty("line.separator")
                 + getSslExpirationDate());
         ServletRegistrationBean registration = new ServletRegistrationBean(new ClampServlet(), "/restservices/clds/*");
@@ -161,7 +160,7 @@ public class Application extends SpringBootServletInitializer {
                 String password = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"),
                         env.getProperty("clamp.config.keyFile"));
                 String keyStore = env.getProperty("server.ssl.key-store");
-                InputStream is = ResourceFileUtil.getResourceAsStream(keyStore.replaceAll("classpath:", ""));
+                InputStream is = ResourceFileUtils.getResourceAsStream(keyStore.replaceAll("classpath:", ""));
                 keystore.load(is, password.toCharArray());
 
                 Enumeration<String> aliases = keystore.aliases();
index 949ff1e..7bf45e4 100644 (file)
@@ -48,6 +48,7 @@ import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
 import org.onap.clamp.clds.util.ClampVersioning;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.util.PassDecoder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
@@ -65,7 +66,7 @@ public class CamelConfiguration extends RouteBuilder {
     private void configureDefaultSslProperties() throws IOException {
         if (env.getProperty("server.ssl.trust-store") != null) {
             URL storeResource = Thread.currentThread().getContextClassLoader()
-                .getResource(env.getProperty("server.ssl.trust-store").replaceAll("classpath:", ""));
+                .getResource(env.getProperty("server.ssl.trust-store").replaceFirst("classpath:", ""));
             System.setProperty("javax.net.ssl.trustStore", storeResource.getPath());
             String keyFile = env.getProperty("clamp.config.keyFile");
             String trustStorePass = PassDecoder.decode(env.getProperty("server.ssl.trust-store-password"),
@@ -74,7 +75,7 @@ public class CamelConfiguration extends RouteBuilder {
             System.setProperty("javax.net.ssl.trustStoreType", "jks");
             System.setProperty("ssl.TrustManagerFactory.algorithm", "PKIX");
             storeResource = Thread.currentThread().getContextClassLoader()
-                .getResource(env.getProperty("server.ssl.key-store").replaceAll("classpath:", ""));
+                .getResource(env.getProperty("server.ssl.key-store").replaceFirst("classpath:", ""));
             System.setProperty("javax.net.ssl.keyStore", storeResource.getPath());
 
             String keyStorePass = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"),
@@ -91,8 +92,7 @@ public class CamelConfiguration extends RouteBuilder {
             String keyFile = env.getProperty("clamp.config.keyFile");
             String password = PassDecoder.decode(env.getProperty("server.ssl.trust-store-password"), keyFile);
             truststore.load(
-                Thread.currentThread().getContextClassLoader()
-                    .getResourceAsStream(env.getProperty("server.ssl.trust-store").replaceAll("classpath:", "")),
+                    ResourceFileUtils.getResourceAsStream(env.getProperty("server.ssl.trust-store")),
                     password.toCharArray());
 
             TrustManagerFactory trustFactory = TrustManagerFactory.getInstance("PKIX");
index 7c7433e..16af446 100644 (file)
@@ -30,7 +30,7 @@ import java.security.KeyStoreException;
 import java.security.NoSuchAlgorithmException;
 import java.security.cert.CertificateException;
 
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.util.PassDecoder;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.web.ServerProperties;
@@ -52,45 +52,42 @@ public class SslConfig {
 
     @Bean
     WebServerFactoryCustomizer<TomcatServletWebServerFactory> tomcatCustomizer(ServerProperties serverProperties,
-            ResourceLoader resourceLoader) {
+                                                                               ResourceLoader resourceLoader) {
         return (tomcat) -> tomcat.setSslStoreProvider(new SslStoreProvider() {
             @Override
-            public KeyStore getKeyStore() throws KeyStoreException, 
+            public KeyStore getKeyStore() throws KeyStoreException,
                     NoSuchAlgorithmException, CertificateException, IOException {
                 KeyStore keystore = KeyStore.getInstance(env.getProperty("server.ssl.key-store-type"));
-                String password = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"), 
-                    env.getProperty("clamp.config.keyFile"));
-                String keyStore = env.getProperty("server.ssl.key-store");
-                InputStream is = ResourceFileUtil.getResourceAsStream(keyStore.replaceAll("classpath:", ""));
-                keystore.load(is, password.toCharArray());
+                String password = PassDecoder.decode(env.getProperty("server.ssl.key-store-password"),
+                        env.getProperty("clamp.config.keyFile"));
+                keystore.load(ResourceFileUtils.getResourceAsStream(env.getProperty("server.ssl.key-store")),
+                        password.toCharArray());
                 return keystore;
             }
 
             @Override
-            public KeyStore getTrustStore() throws KeyStoreException, 
+            public KeyStore getTrustStore() throws KeyStoreException,
                     NoSuchAlgorithmException, CertificateException, IOException {
-                    KeyStore truststore = KeyStore.getInstance("JKS");
-                    String password = PassDecoder.decode(env.getProperty("server.ssl.trust-store-password"), 
-                            env.getProperty("clamp.config.keyFile"));
-                    truststore.load(
-                        Thread.currentThread().getContextClassLoader()
-                            .getResourceAsStream(env.getProperty("server.ssl.trust-store")
-                                .replaceAll("classpath:", "")),
-                            password.toCharArray());
-                    return truststore;
+                KeyStore truststore = KeyStore.getInstance("JKS");
+                String password = PassDecoder.decode(env.getProperty("server.ssl.trust-store-password"),
+                        env.getProperty("clamp.config.keyFile"));
+                truststore.load(
+                        ResourceFileUtils.getResourceAsStream(env.getProperty("server.ssl.trust-store")),
+                        password.toCharArray());
+                return truststore;
             }
         });
     }
 
     @Bean
     WebServerFactoryCustomizer<TomcatServletWebServerFactory> tomcatSslCustomizer(ServerProperties serverProperties,
-            ResourceLoader resourceLoader) {
+                                                                                  ResourceLoader resourceLoader) {
         return (tomcat) -> tomcat.setSsl(new Ssl() {
             @Override
             public String getKeyPassword() {
-                    String password = PassDecoder.decode(env.getProperty("server.ssl.key-password"), 
-                            env.getProperty("clamp.config.keyFile"));
-                    return password;
+                String password = PassDecoder.decode(env.getProperty("server.ssl.key-password"),
+                        env.getProperty("clamp.config.keyFile"));
+                return password;
             }
         });
     }
index 3bbb8a0..f68990a 100644 (file)
@@ -46,7 +46,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import org.onap.aaf.cadi.config.Config;
 import org.onap.aaf.cadi.filter.CadiFilter;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.ApplicationContext;
@@ -102,6 +102,9 @@ public class ClampCadiFilter extends CadiFilter {
     @Value("${clamp.config.cadi.cadiX509Issuers:#{null}}")
     private String cadiX509Issuers;
 
+    @Value("${clamp.config.caCerts:#{null}}")
+    private String caCertsPath;
+
     private void checkIfNullProperty(String key, String value) {
         /*
          * When value is null, so not defined in application.properties set nothing in
@@ -153,7 +156,7 @@ public class ClampCadiFilter extends CadiFilter {
                                 URLDecoder.decode(certHeader, StandardCharsets.UTF_8.toString()).getBytes()));
                 X509Certificate caCert = (X509Certificate) certificateFactory
                         .generateCertificate(new ByteArrayInputStream(
-                                ResourceFileUtil.getResourceAsString("clds/aaf/ssl/ca-certs.pem").getBytes()));
+                                ResourceFileUtils.getResourceAsString(this.caCertsPath).getBytes()));
 
                 X509Certificate[] certifArray = ((X509Certificate[]) request
                         .getAttribute("javax.servlet.request.X509Certificate"));
index fd7a9a0..ec0162c 100644 (file)
@@ -51,7 +51,7 @@ public class ClampVersioning {
     public static String getCldsVersionFromProps() {
         String cldsVersion = "";
         Properties props = new Properties();
-        try (InputStream resourceStream = ResourceFileUtil.getResourceAsStream(RESOURCE_NAME)) {
+        try (InputStream resourceStream = ResourceFileUtils.getResourceAsStream(RESOURCE_NAME)) {
             props.load(resourceStream);
             cldsVersion = props.getProperty(CLDS_VERSION_PROPERTY);
         } catch (Exception ex) {
index 7d37cca..1ddf3a9 100644 (file)
@@ -157,7 +157,7 @@ public final class CryptoUtils {
             if (encryptionKey != null && encryptionKey.trim().length() > 0) {
                 return getSecretKeySpec(encryptionKey);
             } else {
-                props.load(ResourceFileUtil.getResourceAsStream(propertiesFileName));
+                props.load(ResourceFileUtils.getResourceAsStream(propertiesFileName));
                 return getSecretKeySpec(props.getProperty(KEY_PARAM));
             }
         } catch (IOException | DecoderException e) {
diff --git a/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java b/src/main/java/org/onap/clamp/clds/util/ResourceFileUtil.java
deleted file mode 100644 (file)
index 5deee46..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017 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============================================
- * ===================================================================
- * 
- */
-
-package org.onap.clamp.clds.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Scanner;
-
-/**
- * Utility methods supporting resources accesses.
- */
-public final class ResourceFileUtil {
-
-    /**
-     * Private constructor to avoid creating instances of util class.
-     */
-    private ResourceFileUtil() {
-    }
-
-    /**
-     * Return resource as a Stream.
-     *
-     * @return resource - resource as stream
-     */
-    public static InputStream getResourceAsStream(String name) {
-        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
-        if (is == null) {
-            throw new IllegalArgumentException("Unable to find resource: " + name);
-        }
-        return is;
-    }
-
-    /**
-     * Return resource as a String.
-     */
-    public static String getResourceAsString(String name) throws IOException {
-        try (InputStream is = getResourceAsStream(name)) {
-            try (Scanner scanner = new Scanner(is)) {
-                Scanner delimitedScanner = scanner.useDelimiter("\\A");
-                return delimitedScanner.hasNext() ? delimitedScanner.next() : "";
-            }
-        }
-    }
-}
diff --git a/src/main/java/org/onap/clamp/clds/util/ResourceFileUtils.java b/src/main/java/org/onap/clamp/clds/util/ResourceFileUtils.java
new file mode 100644 (file)
index 0000000..f858ed2
--- /dev/null
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017 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============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Scanner;
+
+/**
+ * Utility methods supporting resources accesses.
+ */
+public final class ResourceFileUtils {
+
+    /**
+     * getResourceAsStram supports the "file:" prefix as they use URL.
+     * So here we want to eliminate classpath: prefix, so that this class can get
+     * files from jar resource or file system.
+     */
+
+    private static final String CLASSPATH_PREFIX = "classpath:";
+
+    /**
+     * Private constructor to avoid creating instances of util class.
+     */
+    private ResourceFileUtils() {
+    }
+
+    /**
+     * Method to access a file from the jar resource folder or file system.
+     * Give the prefix "classpath:" so that it accesses the jar resource folder (default case)
+     * or the prefix "file:" so that it accesses the file system.
+     *
+     * @param fileName The path of the resource (no prefix it will be a classpath access,
+     *                 "classpath:/myfilename" or "file:/myfilename")
+     * @return The file as inputStream
+     */
+    public static InputStream getResourceAsStream(String fileName) {
+        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(
+                fileName.startsWith(CLASSPATH_PREFIX) ? fileName.replaceFirst(CLASSPATH_PREFIX, "") : fileName);
+        if (is == null) {
+            throw new IllegalArgumentException("Unable to find resource: " + fileName);
+        }
+        return is;
+    }
+
+    /**
+     * Method to access a resource file as a string.
+     * Give the prefix "classpath:" so that it accesses the jar resource folder (default case)
+     * or the prefix "file:" so that it accesses the file system.
+     *
+     * @param fileName The path of the resource (no prefix it will be a classpath access,
+     *                 "classpath:/myfilename" or "file:/myfilename")
+     * @return The file as String
+     * @throws IOException In case of failure to find the file.
+     */
+    public static String getResourceAsString(String fileName) throws IOException {
+        try (InputStream is = getResourceAsStream(fileName)) {
+            return streamToString(is);
+        }
+    }
+
+    private static String streamToString(InputStream inputStream) {
+        try (Scanner scanner = new Scanner(inputStream)) {
+            Scanner delimitedScanner = scanner.useDelimiter("\\A");
+            return delimitedScanner.hasNext() ? delimitedScanner.next() : "";
+        }
+    }
+}
\ No newline at end of file
index c0e1c01..0381f0a 100644 (file)
@@ -36,7 +36,7 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.service.Service;
 
 public class OperationalPolicyRepresentationBuilder {
@@ -74,7 +74,7 @@ public class OperationalPolicyRepresentationBuilder {
         JsonObject jsonSchema = null;
         try {
             jsonSchema = JsonUtils.GSON.fromJson(
-                    ResourceFileUtil
+                    ResourceFileUtils
                             .getResourceAsString("clds/json-schema/operational_policies/operational_policy.json"),
                     JsonObject.class);
             jsonSchema.get(PROPERTIES).getAsJsonObject()
index 029f55d..5d261c0 100644 (file)
@@ -31,7 +31,7 @@ import java.io.IOException;
 import java.io.InputStream;
 
 import org.onap.aaf.cadi.Symm;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 /**
  * PassDecoder for decrypting the truststore and keystore password.
@@ -44,12 +44,12 @@ public class PassDecoder {
 
     /**
      * Decode the password.
-     * 
+     *
      * @param encryptedPass The encrypted password
-     * @param keyFile       The key file name in String
+     * @param keyFileName       The key file name in String
      */
-    public static String decode(String encryptedPass, String keyFile) {
-        if (null == keyFile) {
+    public static String decode(String encryptedPass, String keyFileName) {
+        if (null == keyFileName) {
             logger.debug("Key file is not defined, thus password will not be decrypted");
             return encryptedPass;
         }
@@ -58,16 +58,7 @@ public class PassDecoder {
             return null;
         }
         try {
-            InputStream is;
-            if (keyFile.contains("classpath:")) {
-                is = ResourceFileUtil.getResourceAsStream(keyFile.replaceAll("classpath:", ""));
-            } else {
-                File key = new File(keyFile);
-                is = new FileInputStream(key);
-            }
-            Symm symm = Symm.obtain(is);
-
-            return symm.depass(encryptedPass);
+            return Symm.obtain(ResourceFileUtils.getResourceAsStream(keyFileName)).depass(encryptedPass);
         } catch (IOException e) {
             logger.error("Exception occurred during the key decryption", e);
             return null;
index c5bab26..4ab551e 100644 (file)
@@ -63,6 +63,7 @@ server.ssl.key-alias=clamp@clamp.onap.org
 # The key file used to decode the key store and trust store password
 # If not defined, the key store and trust store password will not be decrypted
 clamp.config.keyFile=classpath:/clds/aaf/org.onap.clamp.keyfile
+clamp.config.caCerts=classpath:/clds/aaf/ssl/ca-certs.pem
 
 ## Config part for Client certificates
 server.ssl.client-auth=want
index 9fdc727..3d189cf 100644 (file)
@@ -26,29 +26,29 @@ import com.google.gson.JsonObject;
 import java.io.IOException;
 import org.junit.Test;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.skyscreamer.jsonassert.JSONAssert;
 
 public class CdsServicesTest {
 
     @Test
     public void testParseCdsListTypeProperties() throws IOException {
-        String cdsResponse = ResourceFileUtil
+        String cdsResponse = ResourceFileUtils
                 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-workflow.json");
         CdsServices services = new CdsServices();
         JsonObject output = services.parseCdsResponse(cdsResponse);
-        JSONAssert.assertEquals(ResourceFileUtil
+        JSONAssert.assertEquals(ResourceFileUtils
                 .getResourceAsString("example/cds-response/vFW-CDS-resource-assignment-wf-expected-result.json"),
                         JsonUtils.GSON.toJson(output), true);
     }
 
     @Test
     public void testParseCdsResponse() throws IOException {
-        String cdsResponse = ResourceFileUtil
+        String cdsResponse = ResourceFileUtils
                 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-workflow.json");
         CdsServices services = new CdsServices();
         JsonObject output = services.parseCdsResponse(cdsResponse);
-        JSONAssert.assertEquals(ResourceFileUtil
+        JSONAssert.assertEquals(ResourceFileUtils
                 .getResourceAsString("example/cds-response/vFW-CDS-modify-config-wf-expected-result.json"),
                         JsonUtils.GSON.toJson(output), true);
     }
index d27690b..06df124 100644 (file)
@@ -36,7 +36,7 @@ import java.nio.charset.StandardCharsets;
 import org.junit.Test;
 import org.onap.clamp.clds.exception.sdc.controller.SdcParametersException;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 /**
  * This class tests the SDC Controller config.
@@ -51,7 +51,7 @@ public class SdcSingleControllerConfigurationTest {
     public static SdcSingleControllerConfiguration loadControllerConfiguration(String fileName,
         String sdcControllerName) {
 
-        InputStreamReader streamReader = new InputStreamReader(ResourceFileUtil.getResourceAsStream(fileName),
+        InputStreamReader streamReader = new InputStreamReader(ResourceFileUtils.getResourceAsStream(fileName),
             StandardCharsets.UTF_8);
         JsonObject jsonNode = JsonUtils.GSON.fromJson(streamReader, JsonObject.class);
 
index d985a5d..c4c0c34 100644 (file)
@@ -29,7 +29,7 @@ import java.io.IOException;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.clamp.clds.config.ClampProperties;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
@@ -59,7 +59,7 @@ public class CldsReferencePropertiesItCase {
      */
     @Test
     public void testGetFileContent() throws IOException {
-        String users = ResourceFileUtil.getResourceAsString("clds/clds-users.json");
+        String users = ResourceFileUtils.getResourceAsString("clds/clds-users.json");
         assertEquals(users, refProp.getFileContent("files.cldsUsers"));
         // Test composite key
         assertEquals(users, refProp.getFileContent("files", "cldsUsers"));
index cd7337a..a768526 100644 (file)
@@ -43,7 +43,7 @@ import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.onap.clamp.clds.exception.sdc.controller.BlueprintParserException;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.yaml.snakeyaml.Yaml;
 
 public class BlueprintParserTest {
@@ -70,25 +70,25 @@ public class BlueprintParserTest {
      */
     @BeforeClass
     public static void loadBlueprints() throws IOException {
-        microServiceTheWholeBlueprintValid = ResourceFileUtil
+        microServiceTheWholeBlueprintValid = ResourceFileUtils
                 .getResourceAsString("clds/blueprint-with-microservice-chain.yaml");
 
-        newMicroServiceBlueprint = ResourceFileUtil.getResourceAsString("clds/new-microservice.yaml");
+        newMicroServiceBlueprint = ResourceFileUtils.getResourceAsString("clds/new-microservice.yaml");
 
-        String microServiceBlueprintInvalid = ResourceFileUtil
+        String microServiceBlueprintInvalid = ResourceFileUtils
                 .getResourceAsString("clds/single-microservice-fragment-invalid.yaml");
         jsonObjectBlueprintInvalid = yamlToJson(microServiceBlueprintInvalid);
-        String microServiceBlueprintWithoutName = ResourceFileUtil
+        String microServiceBlueprintWithoutName = ResourceFileUtils
                 .getResourceAsString("clds/single-microservice-fragment-without-name.yaml");
         jsonObjectBlueprintWithoutName = yamlToJson(microServiceBlueprintWithoutName);
-        String microServiceBlueprintWithoutProperties = ResourceFileUtil
+        String microServiceBlueprintWithoutProperties = ResourceFileUtils
                 .getResourceAsString("clds/single-microservice-fragment-without-properties.yaml");
         jsonObjectBlueprintWithoutProperties = yamlToJson(microServiceBlueprintWithoutProperties);
-        String microServiceBlueprintValidWithVersion = ResourceFileUtil
+        String microServiceBlueprintValidWithVersion = ResourceFileUtils
                 .getResourceAsString("clds/single-microservice-fragment-valid-with-version.yaml");
         jsonObjectBlueprintValidWithVersion = yamlToJson(microServiceBlueprintValidWithVersion);
 
-        String microServiceBlueprintWithoutRelationships = ResourceFileUtil
+        String microServiceBlueprintWithoutRelationships = ResourceFileUtils
                 .getResourceAsString("clds/single-microservice-fragment-without-relationships.yaml");
         jsonObjectBlueprintWithoutRelationships = yamlToJson(microServiceBlueprintWithoutRelationships);
 
index e008874..f04e3fa 100644 (file)
@@ -42,7 +42,7 @@ import org.junit.Test;
 import org.mockito.Mockito;
 import org.onap.clamp.clds.exception.sdc.controller.CsarHandlerException;
 import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.sdc.api.notification.IArtifactInfo;
 import org.onap.sdc.api.notification.INotificationData;
 import org.onap.sdc.api.notification.IResourceInstance;
@@ -112,14 +112,14 @@ public class CsarHandlerTest {
     private IDistributionClientDownloadResult buildFakeSdcResut() throws IOException {
         IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
         Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
-            IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
+            IOUtils.toByteArray(ResourceFileUtils.getResourceAsStream("example/sdc/service-Simsfoimap0112.csar")));
         return resultArtifact;
     }
 
     private IDistributionClientDownloadResult buildFakeSdcResultWithoutPolicyModel() throws IOException {
         IDistributionClientDownloadResult resultArtifact = Mockito.mock(IDistributionClientDownloadResult.class);
         Mockito.when(resultArtifact.getArtifactPayload()).thenReturn(
-            IOUtils.toByteArray(ResourceFileUtil.getResourceAsStream("example/sdc/service-without-policy.csar")));
+            IOUtils.toByteArray(ResourceFileUtils.getResourceAsStream("example/sdc/service-without-policy.csar")));
         return resultArtifact;
     }
 
index b26f3ed..e735476 100644 (file)
@@ -33,7 +33,7 @@ import javax.transaction.Transactional;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.clamp.clds.Application;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.tosca.Dictionary;
 import org.onap.clamp.tosca.DictionaryElement;
 import org.onap.clamp.tosca.DictionaryService;
@@ -61,14 +61,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
      */
     @Test
     public final void testParseToscaYaml() throws IOException {
-        String toscaModelYaml = ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml");
+        String toscaModelYaml = ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml");
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
             convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.cdap.tca.hi.lo.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json.json"),
+            ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json.json"),
             parsedJsonSchema, true);
     }
 
@@ -82,14 +82,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
     @Test
     public final void testParseToscaYamlWithConstraints() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca-with-constraints.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca-with-constraints.yaml");
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
             convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
+            ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-constraints.json"),
             parsedJsonSchema, true);
     }
 
@@ -103,14 +103,14 @@ public class ToscaYamlToJsonConvertorTestItCase {
     @Test
     public final void testParseToscaYamlWithTypes() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca-with-datatypes.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca-with-datatypes.yaml");
         ToscaYamlToJsonConvertor convertor = new ToscaYamlToJsonConvertor();
 
         String parsedJsonSchema =
             convertor.parseToscaYaml(toscaModelYaml, "onap.policies.monitoring.example.app");
         assertNotNull(parsedJsonSchema);
         JSONAssert.assertEquals(
-            ResourceFileUtil.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
+            ResourceFileUtils.getResourceAsString("tosca/policy-yaml-to-json-with-datatypes.json"),
             parsedJsonSchema, true);
     }
 
@@ -126,7 +126,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
     public final void testMetadataClampPossibleValues() throws IOException {
         setupDictionary();
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
 
         JsonObject jsonObject = toscaYamlToJsonConvertor.validateAndConvertToJson(toscaModelYaml);
         assertNotNull(jsonObject);
@@ -141,7 +141,7 @@ public class ToscaYamlToJsonConvertorTestItCase {
         assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", policyModelType);
         assertEquals("tca", acronym);
         JSONAssert.assertEquals(
-            ResourceFileUtil
+            ResourceFileUtils
                 .getResourceAsString("tosca/tosca_metadata_clamp_possible_values_json_schema.json"),
             parsedJsonSchema, true);
 
index 421bd6a..8a81445 100644 (file)
@@ -31,7 +31,7 @@ import org.onap.clamp.clds.tosca.update.elements.ArrayField;
 import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
 import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 public class ArrayFieldTest extends TestCase {
 
@@ -41,10 +41,10 @@ public class ArrayFieldTest extends TestCase {
      * @throws IOException in case of failure
      */
     public void testDeploy() throws IOException {
-        JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(ResourceFileUtil.getResourceAsString(
-                "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),ResourceFileUtil.getResourceAsString(
+        JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(ResourceFileUtils.getResourceAsString(
+                "tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"), ResourceFileUtils.getResourceAsString(
                 "clds/tosca-converter/default-tosca-types.yaml"),
-                ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
         ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor");
         ArrayField arrayParser = new ArrayField((ArrayList<Object>) toscaElementProperty.getItems().get("default"));
index 5215cbd..f147f40 100644 (file)
@@ -31,14 +31,14 @@ import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
 import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 public class ConstraintTest extends TestCase {
 
     JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
-            ResourceFileUtil.getResourceAsString("tosca/new-converter/constraints.yaml"),
-            ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-            ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+            ResourceFileUtils.getResourceAsString("tosca/new-converter/constraints.yaml"),
+            ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+            ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
 
     ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Operation");
 
index 0a0710c..b9fcf51 100644 (file)
@@ -31,7 +31,7 @@ import junit.framework.TestCase;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateField;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 public class JsonTemplateManagerTest extends TestCase {
 
@@ -44,11 +44,11 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testLaunchTranslationTca() throws IOException, UnknownComponentException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+                        ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
                                 + ".policies.monitoring.cdap.tca.hi.lo.app/versions/1.0.0&#63;"
-                                + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+                                + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
                         "clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         String componentName = "onap.policies.monitoring.cdap.tca.hi.lo.app";
         jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
     }
@@ -62,11 +62,11 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testLaunchTranslationFrequencyLimiter() throws IOException, UnknownComponentException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+                        ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
                                 + ".policies.controlloop.guard.common.FrequencyLimiter/versions/1.0.0&#63;"
-                                + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+                                + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
                         "clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         String componentName = "onap.policies.controlloop.guard.common.FrequencyLimiter";
         jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
     }
@@ -80,11 +80,11 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testLaunchTranslationApex() throws IOException, UnknownComponentException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+                        ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
                                 + ".policies.controlloop.operational.common.Apex/versions/1.0.0&#63;"
-                                + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+                                + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
                         "clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         String componentName = "onap.policies.controlloop.operational.common.Apex";
         jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
     }
@@ -98,11 +98,11 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testLaunchTranslationDrools() throws IOException, UnknownComponentException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+                        ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
                                 + ".policies.controlloop.operational.common.Drools/versions/1.0.0&#63;"
-                                + "connectionTimeToLive=5000/.file"), ResourceFileUtil.getResourceAsString(
+                                + "connectionTimeToLive=5000/.file"), ResourceFileUtils.getResourceAsString(
                         "clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         String componentName = "onap.policies.controlloop.operational.common.Drools";
         jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
     }
@@ -117,9 +117,9 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testLaunchTranslation() throws IOException, UnknownComponentException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         String componentName = "onap.policies.controlloop.operational.common.Drools";
         jsonTemplateManager.getJsonSchemaForPolicyType(componentName, null, null);
     }
@@ -132,9 +132,9 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testAddTemplate() throws IOException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         int count = jsonTemplateManager.getJsonSchemaTemplates().size();
         List<JsonTemplateField>
                 jsonTemplateFields =
@@ -154,9 +154,9 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testRemoveTemplate() throws IOException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         int count = jsonTemplateManager.getJsonSchemaTemplates().size();
         jsonTemplateManager.removeTemplate("string");
         assertNotSame(count, jsonTemplateManager.getJsonSchemaTemplates().size());
@@ -170,9 +170,9 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testUpdateTemplate() throws IOException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         int count = jsonTemplateManager.getJsonSchemaTemplates().get("integer").getJsonTemplateFields().size();
         jsonTemplateManager.updateTemplate("integer", new JsonTemplateField("type"), false);
         assertNotSame(count,
@@ -187,9 +187,9 @@ public class JsonTemplateManagerTest extends TestCase {
     public void testHasTemplate() throws IOException {
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         boolean has = true;
         List<JsonTemplateField> jsonTemplateFieldsString =
                 new ArrayList<>(Arrays.asList(new JsonTemplateField("type"), new JsonTemplateField("description"),
index f777421..b5b0247 100644 (file)
@@ -33,7 +33,7 @@ import org.onap.clamp.clds.tosca.update.execution.ToscaMetadataExecutor;
 import org.onap.clamp.clds.tosca.update.parser.metadata.ToscaMetadataParserWithDictionarySupport;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.service.Service;
 import org.onap.clamp.tosca.Dictionary;
 import org.onap.clamp.tosca.DictionaryElement;
@@ -110,16 +110,16 @@ public class ToscaConverterWithDictionarySupportItCase {
 
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil
+                        ResourceFileUtils
                                 .getResourceAsString("tosca/new-converter/tosca_metadata_clamp_possible_values.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
 
         JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
                 "onap.policies.monitoring.cdap.tca.hi.lo.app", toscaMetadataParserWithDictionarySupport, null);
 
         JSONAssert.assertEquals(
-                ResourceFileUtil
+                ResourceFileUtils
                         .getResourceAsString("tosca/new-converter/tca-with-metadata.json"),
                 JsonUtils.GSON.toJson(jsonSchema), true);
     }
@@ -127,21 +127,21 @@ public class ToscaConverterWithDictionarySupportItCase {
     @Test
     @Transactional
     public final void testMetadataClampPossibleValueWithExecutor() throws IOException, UnknownComponentException {
-        Service service = new Service(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
-                ResourceFileUtil.getResourceAsString("tosca/resource-details-cds.json"));
+        Service service = new Service(ResourceFileUtils.getResourceAsString("tosca/service-details.json"),
+                ResourceFileUtils.getResourceAsString("tosca/resource-details-cds.json"));
         JsonTemplateManager jsonTemplateManager =
                 new JsonTemplateManager(
-                        ResourceFileUtil.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
+                        ResourceFileUtils.getResourceAsString("http-cache/example/policy/api/v1/policytypes/onap"
                                 + ".policies.controlloop.operational.common.Apex/versions/1.0"
                                 + ".0&#63;connectionTimeToLive=5000/.file"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
 
         JsonObject jsonSchema = jsonTemplateManager.getJsonSchemaForPolicyType(
                 "onap.policies.controlloop.operational.common.Apex", toscaMetadataParserWithDictionarySupport, service);
 
         JSONAssert.assertEquals(
-                ResourceFileUtil
+                ResourceFileUtils
                         .getResourceAsString("tosca/new-converter/tosca_apex_with_metadata.json"),
                 JsonUtils.GSON.toJson(jsonSchema), true);
     }
index 967f330..52f8444 100644 (file)
@@ -32,7 +32,7 @@ import org.onap.clamp.clds.tosca.update.elements.ToscaElement;
 import org.onap.clamp.clds.tosca.update.elements.ToscaElementProperty;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplate;
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 
 public class ToscaElementPropertyTest extends TestCase {
     public ToscaElementPropertyTest() throws IOException {
@@ -45,9 +45,9 @@ public class ToscaElementPropertyTest extends TestCase {
      */
     public void testParseArray() throws IOException {
         JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
-                ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),
-                ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPoliciesEXTENTED.yaml"),
+                ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");
         ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("actor");
         JsonArray toTest =
@@ -62,9 +62,9 @@ public class ToscaElementPropertyTest extends TestCase {
      */
     public void testAddConstraintsAsJson() throws IOException {
         JsonTemplateManager jsonTemplateManager = new JsonTemplateManager(
-                ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
-                ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
-                ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));
+                ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),
+                ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),
+                ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));
         ToscaElement toscaElement =
                 jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.operation.Failure");
         ToscaElementProperty toscaElementProperty = toscaElement.getProperties().get("category");
index 5f7de28..ba8454b 100644 (file)
@@ -29,7 +29,7 @@ import java.util.Arrays;
 import junit.framework.TestCase;\r
 import org.onap.clamp.clds.tosca.update.elements.ToscaElement;\r
 import org.onap.clamp.clds.tosca.update.templates.JsonTemplateManager;\r
-import org.onap.clamp.clds.util.ResourceFileUtil;\r
+import org.onap.clamp.clds.util.ResourceFileUtils;\r
 \r
 public class ToscaElementTest extends TestCase {\r
 \r
@@ -42,9 +42,9 @@ public class ToscaElementTest extends TestCase {
         ArrayList<String> reference = new ArrayList<>(Arrays.asList("actor", "operation", "target", "payload"));\r
         JsonTemplateManager jsonTemplateManager =\r
                 new JsonTemplateManager(\r
-                        ResourceFileUtil.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),\r
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),\r
-                        ResourceFileUtil.getResourceAsString("clds/tosca-converter/templates.json"));\r
+                        ResourceFileUtils.getResourceAsString("tosca/new-converter/sampleOperationalPolicies.yaml"),\r
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/default-tosca-types.yaml"),\r
+                        ResourceFileUtils.getResourceAsString("clds/tosca-converter/templates.json"));\r
         ToscaElement toscaElement = jsonTemplateManager.getToscaElements().get("onap.datatype.controlloop.Actor");\r
         assertEquals(reference, toscaElement.propertiesNames());\r
     }\r
index 926ed66..bc2ec21 100644 (file)
@@ -72,6 +72,6 @@ public class JsonUtilsTest {
 
     @Test(expected = IllegalArgumentException.class)
     public void shouldThrowExceptionFileNotExists() throws IOException {
-        ResourceFileUtil.getResourceAsString("example/notExist.json");
+        ResourceFileUtils.getResourceAsString("example/notExist.json");
     }
 }
index 1c33d5e..86bc8c0 100644 (file)
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import javax.transaction.Transactional;
+
 import org.apache.commons.lang3.RandomStringUtils;
 import org.json.JSONException;
 import org.junit.Assert;
@@ -49,7 +50,7 @@ import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerExceptio
 import org.onap.clamp.clds.sdc.controller.installer.BlueprintArtifact;
 import org.onap.clamp.clds.sdc.controller.installer.CsarHandler;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.cds.CdsDataInstaller;
 import org.onap.clamp.loop.service.ServicesRepository;
 import org.onap.clamp.loop.template.LoopTemplate;
@@ -74,7 +75,7 @@ import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(classes = Application.class)
-@ActiveProfiles({"clamp-default","clamp-default-user","clamp-sdc-controller","legacy-operational-policy"})
+@ActiveProfiles({"clamp-default", "clamp-default-user", "clamp-sdc-controller", "legacy-operational-policy"})
 public class CsarInstallerItCase {
 
     private static final String CSAR_ARTIFACT_NAME_CDS = "example/sdc/service_Vloadbalancerms_cds.csar";
@@ -106,7 +107,7 @@ public class CsarInstallerItCase {
         Mockito.when(resource.getResourceInvariantUUID()).thenReturn(invariantResourceUuid);
         BlueprintArtifact blueprintArtifact = Mockito.mock(BlueprintArtifact.class);
         Mockito.when(blueprintArtifact.getDcaeBlueprint())
-                .thenReturn(ResourceFileUtil.getResourceAsString(blueprintFilePath));
+                .thenReturn(ResourceFileUtils.getResourceAsString(blueprintFilePath));
         Mockito.when(blueprintArtifact.getBlueprintArtifactName()).thenReturn(artifactName);
         Mockito.when(blueprintArtifact.getBlueprintInvariantServiceUuid()).thenReturn(invariantServiceUuid);
         Mockito.when(blueprintArtifact.getResourceAttached()).thenReturn(resource);
@@ -159,7 +160,7 @@ public class CsarInstallerItCase {
 
         // Mockito.when(csarHandler.getSdcCsarHelper()).thenReturn(csarHelper);
         Mockito.when(csarHandler.getPolicyModelYaml())
-                .thenReturn(Optional.ofNullable(ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml")));
+                .thenReturn(Optional.ofNullable(ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml")));
         return csarHandler;
     }
 
@@ -182,9 +183,10 @@ public class CsarInstallerItCase {
 
         CsarHandler csarHandler = new CsarHandler(notificationData, "", "");
         csarHandler
-                .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).getFile());
+                .setFilePath(Thread.currentThread().getContextClassLoader().getResource(CSAR_ARTIFACT_NAME_CDS).
+                        getFile());
         Assert.assertEquals(csarHandler.getPolicyModelYaml(), Optional
-                .ofNullable(ResourceFileUtil.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
+                .ofNullable(ResourceFileUtils.getResourceAsString("example/sdc/expected-result/policy-data.yaml")));
     }
 
     @Test
@@ -235,11 +237,11 @@ public class CsarInstallerItCase {
                 "1.0", RESOURCE_INSTANCE_NAME_RESOURCE1, "tca.yaml")).get();
         assertThat(loopTemplate.getLoopElementModelsUsed()).hasSize(1);
         assertThat(loopTemplate.getModelService().getServiceUuid()).isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0");
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService()), true);
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/service-details.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getServiceDetails()), true);
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/resource-details.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/resource-details.json"),
                 JsonUtils.GSON_JPA_MODEL.toJson(loopTemplate.getModelService().getResourceDetails()), true);
         assertThat(((LoopTemplateLoopElementModel) (loopTemplate.getLoopElementModelsUsed().toArray()[0]))
                 .getLoopElementModel().getName()).isNotEmpty();
index 6827bf5..1d6940f 100644 (file)
@@ -35,7 +35,7 @@ import java.io.IOException;
 import java.util.Random;
 import org.junit.Test;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.log.LogType;
 import org.onap.clamp.loop.log.LoopLog;
 import org.onap.clamp.loop.service.Service;
@@ -111,7 +111,7 @@ public class LoopToJsonTest {
         Loop loopTest = getLoop("ControlLoopTest", "yamlcontent", "{\"testname\":\"testvalue\"}",
                 "123456789", "https://dcaetest.org", "UUID-blueprint");
         OperationalPolicy opPolicy = this.getOperationalPolicy(
-                ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
+                ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), "GuardOpPolicyTest");
         loopTest.addOperationalPolicy(opPolicy);
         MicroServicePolicy microServicePolicy = getMicroServicePolicy("configPolicyTest", "",
                 "{\"configtype\":\"json\"}", "tosca_definitions_version: tosca_simple_yaml_1_0_0",
@@ -156,7 +156,7 @@ public class LoopToJsonTest {
                 "123456789", "https://dcaetest.org", "UUID-blueprint");
 
         JsonObject jsonModel = new GsonBuilder().create()
-                .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
+                .fromJson(ResourceFileUtils.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
         Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
                 jsonModel.get("resourceDetails").getAsJsonObject(), "1.0");
         loopTest2.setModelService(service);
index 0213593..6a646e3 100644 (file)
@@ -32,7 +32,7 @@ import org.apache.camel.Message;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.onap.clamp.clds.config.LegacyOperationalPolicyController;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.components.external.ExternalComponentState;
 import org.onap.clamp.loop.components.external.PolicyComponent;
 import org.onap.clamp.loop.template.LoopTemplate;
@@ -290,7 +290,7 @@ public class PolicyComponentTest {
         loopTest.setLoopTemplate(loopTemplate);
 
         String payload = PolicyComponent.createPoliciesPayloadPdpGroup(loopTest, "POST");
-        String expectedRes = ResourceFileUtil.getResourceAsString("tosca/pdp-group-policy-payload.json");
+        String expectedRes = ResourceFileUtils.getResourceAsString("tosca/pdp-group-policy-payload.json");
 
         assertThat(payload).isEqualTo(expectedRes);
     }
index b16aa55..6f6cad8 100644 (file)
@@ -37,7 +37,7 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.clamp.clds.Application;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.template.PolicyModel;
 import org.onap.clamp.loop.template.PolicyModelId;
 import org.onap.clamp.loop.template.PolicyModelsRepository;
@@ -125,7 +125,7 @@ public class PolicyModelServiceItCase {
     @Transactional
     public void shouldCreatePolicyModelFromTosca() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca_with_metadata.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
         PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
 
         assertThat(policyModelsService.getAllPolicyModels()).contains(policyModel);
@@ -143,10 +143,10 @@ public class PolicyModelServiceItCase {
     @Transactional
     public void shouldUpdatePolicyModel() throws IOException {
         String toscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca_with_metadata.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca_with_metadata.yaml");
         PolicyModel policyModel = policyModelsService.createNewPolicyModelFromTosca(toscaModelYaml);
         String newToscaModelYaml =
-            ResourceFileUtil.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
+            ResourceFileUtils.getResourceAsString("tosca/tosca_metadata_clamp_possible_values.yaml");
 
         PolicyModel updatedPolicyModel = policyModelsService.updatePolicyModelTosca(
             policyModel.getPolicyModelType(), policyModel.getVersion(), newToscaModelYaml);
index 2b3b482..8a5b587 100644 (file)
@@ -33,7 +33,7 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.Loop;
 import org.onap.clamp.loop.template.LoopElementModel;
 import org.onap.clamp.loop.template.LoopTemplate;
@@ -56,7 +56,7 @@ public class BlueprintInputParametersTest {
         Mockito.when(umService1.getName()).thenReturn("testName1");
 
         LoopElementModel loopElement = Mockito.mock(LoopElementModel.class);
-        String blueprint1 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
+        String blueprint1 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
         Mockito.when(loopElement.getBlueprint()).thenReturn(blueprint1);
         Mockito.when(umService1.getLoopElementModel()).thenReturn(loopElement);
 
@@ -64,7 +64,7 @@ public class BlueprintInputParametersTest {
         Mockito.when(umService2.getName()).thenReturn("testName2");
 
         LoopElementModel loopElement2 = Mockito.mock(LoopElementModel.class);
-        String blueprint2 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca_2.yaml");
+        String blueprint2 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca_2.yaml");
         Mockito.when(loopElement2.getBlueprint()).thenReturn(blueprint2);
         Mockito.when(umService2.getLoopElementModel()).thenReturn(loopElement2);
 
@@ -72,7 +72,7 @@ public class BlueprintInputParametersTest {
         Mockito.when(umService3.getName()).thenReturn("testName3");
 
         LoopElementModel loopElement3 = Mockito.mock(LoopElementModel.class);
-        String blueprint3 = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca_3.yaml");
+        String blueprint3 = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca_3.yaml");
         Mockito.when(loopElement3.getBlueprint()).thenReturn(blueprint3);
         Mockito.when(umService3.getLoopElementModel()).thenReturn(loopElement3);
 
@@ -90,7 +90,7 @@ public class BlueprintInputParametersTest {
         JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
 
         Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
-                ResourceFileUtil.getResourceAsString(
+                ResourceFileUtils.getResourceAsString(
                         "example/sdc/expected-result/deployment-parameters-multi-blueprints.json"));
     }
 
@@ -112,14 +112,14 @@ public class BlueprintInputParametersTest {
 
         LoopTemplate template = Mockito.mock(LoopTemplate.class);
         Mockito.when(template.getUniqueBlueprint()).thenReturn(true);
-        String blueprint = ResourceFileUtil.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
+        String blueprint = ResourceFileUtils.getResourceAsString("example/sdc/blueprint-dcae/tca.yaml");
         Mockito.when(template.getBlueprint()).thenReturn(blueprint);
         Mockito.when(loop.getLoopTemplate()).thenReturn(template);
 
         JsonObject paramJson = DcaeDeployParameters.getDcaeDeploymentParametersInJson(loop);
 
         Assert.assertEquals(JsonUtils.GSON_JPA_MODEL.toJson(paramJson),
-                ResourceFileUtil.getResourceAsString(
+                ResourceFileUtils.getResourceAsString(
                         "example/sdc/expected-result/deployment-parameters-single-blueprint.json"));
     }
 }
index 01e2184..0bfb6ec 100644 (file)
@@ -27,7 +27,7 @@ import com.google.gson.JsonObject;
 import java.io.IOException;
 import org.junit.Test;
 import org.onap.clamp.clds.util.JsonUtils;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.template.PolicyModel;
 import org.skyscreamer.jsonassert.JSONAssert;
 
@@ -37,10 +37,10 @@ public class MicroServicePayloadTest {
     public void testPayloadConstruction() throws IOException {
         MicroServicePolicy policy = new MicroServicePolicy("testPolicy", new PolicyModel(
                 "onap.policies.monitoring.cdap.tca.hi.lo.app",
-            ResourceFileUtil.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null);
+            ResourceFileUtils.getResourceAsString("tosca/tosca_example.yaml"),"1.0.0"), false,null,null, null,null);
         policy.setConfigurationsJson(JsonUtils.GSON.fromJson(
-            ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class));
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/micro-service-policy-payload.json"),
+            ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-properties.json"), JsonObject.class));
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/micro-service-policy-payload.json"),
             policy.createPolicyPayload(), false);
     }
 }
index cef82e5..36f0007 100644 (file)
@@ -28,35 +28,34 @@ import static org.assertj.core.api.Assertions.assertThat;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonObject;
 import java.io.IOException;
-import java.util.Map;
+
 import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.template.PolicyModel;
 import org.onap.clamp.policy.operational.LegacyOperationalPolicy;
 import org.onap.clamp.policy.operational.OperationalPolicy;
-import org.skyscreamer.jsonassert.JSONAssert;
 
 public class OperationalPolicyPayloadTest {
 
     @Test
     public void testOperationalPolicyLegacyPayloadConstruction() throws IOException {
         JsonObject jsonConfig = new GsonBuilder().create().fromJson(
-                ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+                ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
         OperationalPolicy policy = new OperationalPolicy("testPolicy.legacy", jsonConfig, null,
                 new PolicyModel("onap.policies.controlloop.Operational.legacy", "", "1.0.0", "test"), null, null, null);
 
         assertThat(policy.createPolicyPayloadYaml())
-                .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.yaml"));
+                .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.yaml"));
 
         assertThat(policy.createPolicyPayload())
-                .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload.json"));
+                .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload.json"));
     }
 
     @Test
     public void testLegacyOperationalPolicyPayloadConstruction() throws IOException {
         JsonObject jsonConfig = new GsonBuilder().create().fromJson(
-                ResourceFileUtil.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
+                ResourceFileUtils.getResourceAsString("tosca/operational-policy-properties.json"), JsonObject.class);
         assertThat(LegacyOperationalPolicy.createPolicyPayloadYamlLegacy(jsonConfig.get("operational_policy")))
-                .isEqualTo(ResourceFileUtil.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
+                .isEqualTo(ResourceFileUtils.getResourceAsString("tosca/operational-policy-payload-legacy.yaml"));
     }
 }
index 4f728b4..322548b 100644 (file)
@@ -29,7 +29,7 @@ import com.google.gson.GsonBuilder;
 import com.google.gson.JsonObject;
 import java.io.IOException;
 import org.junit.Test;
-import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.clds.util.ResourceFileUtils;
 import org.onap.clamp.loop.service.Service;
 import org.skyscreamer.jsonassert.JSONAssert;
 
@@ -37,7 +37,7 @@ public class OperationalPolicyRepresentationBuilderTest {
 
     @Test
     public void testOperationalPolicyPayloadConstruction() throws IOException {
-        JsonObject jsonModel = new GsonBuilder().create().fromJson(ResourceFileUtil
+        JsonObject jsonModel = new GsonBuilder().create().fromJson(ResourceFileUtils
                 .getResourceAsString("tosca/model-properties-operational-policy.json"), JsonObject.class);
         Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
                 jsonModel.get("resourceDetails").getAsJsonObject(), "1.0");
@@ -46,14 +46,14 @@ public class OperationalPolicyRepresentationBuilderTest {
 
         assertThat(jsonSchema).isNotNull();
 
-        JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/operational-policy-json-schema.json"),
+        JSONAssert.assertEquals(ResourceFileUtils.getResourceAsString("tosca/operational-policy-json-schema.json"),
                 new GsonBuilder().create().toJson(jsonSchema), false);
     }
 
     @Test
     public void testOperationalPolicyPayloadConstructionForCds() throws IOException {
         JsonObject jsonModel = new GsonBuilder().create()
-                .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
+                .fromJson(ResourceFileUtils.getResourceAsString("tosca/model-properties-cds.json"), JsonObject.class);
         Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
                 jsonModel.get("resourceDetails").getAsJsonObject(),
                 "1.0");
@@ -61,7 +61,7 @@ public class OperationalPolicyRepresentationBuilderTest {
         JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service);
         assertThat(jsonSchema).isNotNull();
         JSONAssert.assertEquals(
-                ResourceFileUtil.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
+                ResourceFileUtils.getResourceAsString("tosca/operational-policy-cds-payload-with-list.json"),
                 new GsonBuilder().create().toJson(jsonSchema), false);
     }
 }
index df1823f..6f3a405 100644 (file)
@@ -36,6 +36,7 @@ server.ssl.key-alias=clamp@clamp.onap.org
 # The key file used to decode the key store and trust store password
 # If not defined, the key store and trust store password will not be decrypted
 clamp.config.keyFile=classpath:clds/aaf/org.onap.clamp.keyfile
+clamp.config.caCerts=classpath:clds/aaf/ssl/ca-certs.pem
 
 ## Config part for Client certificates
 server.ssl.client-auth=want