Code cleanup 02/121502/2
authordenilson.l65 <denilson.l65@wipro.com>
Fri, 21 May 2021 15:50:02 +0000 (21:20 +0530)
committerdenilson.l65 <denilson.l65@wipro.com>
Mon, 31 May 2021 06:15:04 +0000 (11:45 +0530)
Issue-ID: DCAEGEN2-2504
Signed-off-by: denilson.l65 <denilson.l65@wipro.com>
Change-Id: Ife119bb0e084a5ef0e3199a70523876c4e258f67

34 files changed:
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/configdb/CpsService.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/controller/ConfigFetchFromCbs.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/controller/HealthCheck.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationCallback.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/NotificationProducer.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/dmaap/PmNotificationCallback.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/CUModel.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/CellCUList.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/ConfigData.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/ConfigPolicy.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/MLOutputModel.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/MeasurementObject.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/SubCounter.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/configdb/CellsModel.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/configdb/NetworkFunctionModel.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/pmnotification/Event.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/pmnotification/MeasValuesList.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AdditionalProperties.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/Payload.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/restclients/AaiRestClient.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/restclients/ConfigDbRestClient.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/restclients/CpsRestClient.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/restclients/RestClient.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/AverageCalculator.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/ConsumerThread.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/MLMessageProcessor.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PmDataQueue.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PmEventProcessor.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PmThread.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/SnssaiSamplesProcessor.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/utils/AppConfig.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/utils/BeanUtil.java
components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/utils/DmaapUtils.java

index f72c99c..f0c27e1 100644 (file)
@@ -20,8 +20,6 @@
  *******************************************************************************/
 package org.onap.slice.analysis.ms.configdb;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -30,8 +28,6 @@ import org.onap.slice.analysis.ms.restclients.CpsRestClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
 /**
index 03e1c23..ce36201 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@ public class NotificationProducer {
 
     private CambriaBatchingPublisher cambriaBatchingPublisher;
      
-
     /**
      * Parameterized constructor.
      */
@@ -45,9 +44,7 @@ public class NotificationProducer {
      * sends notification to dmaap.
      */
     public int sendNotification(String msg) throws IOException {
-    
         return cambriaBatchingPublisher.send("", msg);
-
     }
 
 }
index 963165d..c8deccd 100644 (file)
@@ -34,6 +34,9 @@ public class PmNotificationCallback implements NotificationCallback {
 
     private static Logger log = LoggerFactory.getLogger(PmNotificationCallback.class);
 
+    /**
+     * Triggers on handleNofitication method
+     */
     @Override
     public void activateCallBack(String msg) {
         handleNotification(msg);
index 6473ab2..91201f0 100644 (file)
@@ -61,6 +61,9 @@ public class CUModel {
                return "CUModel [gNBCUName=" + gNBCUName + ", nearRTRICId=" + nearRTRICId + ", cellCUList=" + cellCUList + "]";
        }
 
+       /**
+        * Returns a hashcode value for the object
+        */
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -71,6 +74,9 @@ public class CUModel {
                return result;
        }
 
+       /**
+        * Checks whether the object matches with the CUModel
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
index cd56677..5225fd3 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -29,6 +29,9 @@ public class CellCUList {
     private Integer cellLocalId;
     private ConfigData configData;
 
+    /**
+     * Returns a hashcode value for the object
+     */
     @Override
        public int hashCode() {
                final int prime = 31;
@@ -38,6 +41,9 @@ public class CellCUList {
                return result;
        }
 
+       /**
+        * Checks whether the object matches with the CellCUList
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
index f871115..ea81182 100644 (file)
@@ -54,6 +54,9 @@ public class ConfigData {
         this.lastUpdatedTS = lastUpdatedTS;
     }
 
+       /**
+        * Returns a hashcode value for the object
+        */
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -64,6 +67,9 @@ public class ConfigData {
                return result;
        }
 
+       /**
+        * Checks whether the object matches with ConfigData
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
index 6f2b4ec..e18c8c0 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import java.util.Map;
  * Model class for configuration policy
  *
  */
-
 public class ConfigPolicy {
 
        private static ConfigPolicy instance = null;
@@ -69,4 +68,5 @@ public class ConfigPolicy {
        public String toString() {
                return "ConfigPolicy [config=" + config + "]";
        }
+
 }
index 7533d21..aee819b 100644 (file)
@@ -47,6 +47,9 @@ public class MLOutputModel {
                return "MLOutputModel [snssai=" + snssai + ", data=" + data + "]";
        }
        
+       /**
+        * Returns a hashcode value for the object
+        */
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -56,6 +59,9 @@ public class MLOutputModel {
                return result;
        }
        
+       /**
+        * Checks whether the object matches with the MLOutputModel
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
@@ -78,5 +84,4 @@ public class MLOutputModel {
                return true;
        }
        
-       
 }
index b94d75d..cbe97a9 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -32,6 +32,9 @@ public class MeasurementObject {
        private String measurementObjectId;
        private Map<String, Integer> pmData;
 
+       /**
+        * Returns the index of the MeasurementObject
+        */
        public static int findIndex(String measurementObjectId, List<MeasurementObject> list) {
                int index = -1;
                int len = list.size();
@@ -74,6 +77,9 @@ public class MeasurementObject {
 
        }
        
+       /**
+        * Returns a hachcode value for the object
+        */
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -83,6 +89,9 @@ public class MeasurementObject {
                return result;
        }
 
+       /**
+        * Checks whether the object matches with the MeasurementObject
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
index 2990d36..cd54019 100644 (file)
@@ -43,6 +43,9 @@ public final class SubCounter {
                return measuredObject;
        }
 
+       /**
+        * Returns a hashcode value for the object
+        */
        @Override
        public int hashCode() {
                final int prime = 31;
@@ -52,6 +55,9 @@ public final class SubCounter {
                return result;
        }
 
+       /**
+        * Checks whether the object matches with the SubCounter
+        */
        @Override
        public boolean equals(Object obj) {
                if (this == obj)
index e024bf7..5c8f2dc 100644 (file)
@@ -26,13 +26,11 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 /** 
  * Model class for the CellsModel Object 
  */
-
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class CellsModel {
 
        private String cellLocalId;
 
-
        public String getCellLocalId() {
                return cellLocalId;
        }
@@ -46,6 +44,4 @@ public class CellsModel {
                return "CellsModel [cellLocalId=" + cellLocalId + "]";
        }
 
-
-
 }
index 46291d5..6821871 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -20,7 +20,6 @@
  *******************************************************************************/
 package org.onap.slice.analysis.ms.models.configdb;
 
-
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 
 /** 
@@ -31,7 +30,6 @@ public class NetworkFunctionModel {
        
        private String gNBDUId;
        
-
        public String getgNBDUId() {
                return gNBDUId;
        }
@@ -45,8 +43,4 @@ public class NetworkFunctionModel {
                return "NetworkFunctionModel [gNBDUId=" + gNBDUId + "]";
        }
 
-       
-       
-       
-
 }
index 4e41e26..4b0fcaa 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -44,4 +44,5 @@ public class Event {
     public void setPerf3gppFields(Perf3gppFields perf3gppFields) {
         this.perf3gppFields = perf3gppFields;
     }
+
 }
index 38b7c23..36e7b10 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -55,4 +55,5 @@ public class MeasValuesList {
        public void setMeasResults(List<MeasResult> measResults) {
                this.measResults = measResults;
        }
+
 }
index 57aab99..d96850c 100644 (file)
@@ -32,62 +32,50 @@ public class Payload {
        private String networkType;
        private AdditionalProperties<?> additionalProperties;
 
-
        public String getName() {
                return name;
        }
 
-
        public void setName(String name) {
                this.name = name;
        }
 
-
        public String getServiceInstanceID() {
                return serviceInstanceID;
        }
 
-
        public void setServiceInstanceID(String serviceInstanceId) {
                this.serviceInstanceID = serviceInstanceId;
        }
 
-
        public String getGlobalSubscriberId() {
                return globalSubscriberId;
        }
 
-
        public void setGlobalSubscriberId(String globalSubscriberId) {
                this.globalSubscriberId = globalSubscriberId;
        }
 
-
        public String getSubscriptionServiceType() {
                return subscriptionServiceType;
        }
 
-
        public void setSubscriptionServiceType(String subscriptionServiceType) {
                this.subscriptionServiceType = subscriptionServiceType;
        }
 
-
        public String getNetworkType() {
                return networkType;
        }
 
-
        public void setNetworkType(String networkType) {
                this.networkType = networkType;
        }
 
-
        public AdditionalProperties<?> getAdditionalProperties() {
                return additionalProperties;
        }
 
-
        public void setAdditionalProperties(AdditionalProperties<?> additionalProperties) {
                this.additionalProperties = additionalProperties;
        }
index 62e39ad..1f7d084 100644 (file)
@@ -39,6 +39,9 @@ public class AaiRestClient extends RestClient {
                super();
        }
 
+       /**
+        * Sends post request to Aai
+        */
        public <T> ResponseEntity<T> sendPostRequest(String requestUrl, String requestBody,
                        ParameterizedTypeReference<T> responseType) {
                HttpHeaders headers = new HttpHeaders();
@@ -47,6 +50,9 @@ public class AaiRestClient extends RestClient {
                return super.sendPostRequest(headers, requestUrl, requestBody, responseType);
        }
 
+       /**
+        * Sends get request to Aai
+        */
        public <T> ResponseEntity<T> sendGetRequest(String requestUrl, ParameterizedTypeReference<T> responseType) {
                HttpHeaders headers = new HttpHeaders();
                headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON));
@@ -55,5 +61,6 @@ public class AaiRestClient extends RestClient {
                headers.set("X-TransactionId", "get_aai_subscr");
                return super.sendGetRequest(headers, requestUrl, responseType);
        }
+
 }
 
index dbc4291..ebc211c 100644 (file)
@@ -61,4 +61,5 @@ public class ConfigDbRestClient extends RestClient {
                headers.setContentType(MediaType.APPLICATION_JSON);
                return super.sendGetRequest(headers, requestUrl, responseType);
        }
+
 }
index 1d6e238..0d8e72a 100644 (file)
@@ -61,5 +61,5 @@ public class CpsRestClient extends RestClient {
                headers.setContentType(MediaType.APPLICATION_JSON);
                return super.sendGetRequest(headers, requestUrl, responseType);
        }
-}
 
+}
index 3be3fc6..239cedf 100644 (file)
@@ -68,7 +68,6 @@ public class RestClient {
        /**
         * Post Request Template.
         */
-
        public <T> ResponseEntity<T> sendPostRequest(HttpHeaders headers, String requestUrl, String requestBody,
                        ParameterizedTypeReference<T> responseType) {
                HttpEntity<Object> requestEntity = new HttpEntity<>(requestBody, headers);
@@ -83,7 +82,6 @@ public class RestClient {
        /**
         * Get Request Template.
         */
-
        public <T> ResponseEntity<T> sendGetRequest(HttpHeaders headers, String requestUrl,
                        ParameterizedTypeReference<T> responseType) {
                HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
index 52670d5..74c48d9 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -53,7 +53,6 @@ public class AverageCalculator {
                log.debug("find average for samples {}", samples);
                int numOfSamples = samples.size();
                List<MeasurementObject> result = new ArrayList<>();
-               if(!samples.isEmpty()) {
                        for(List<MeasurementObject> sample : samples) {
                                for(MeasurementObject cellMeasObj : sample) {
                                        int index = MeasurementObject.findIndex(cellMeasObj.getMeasurementObjectId(), result);
@@ -65,7 +64,6 @@ public class AverageCalculator {
                                        }
                                }
                        }
-               }
                return findAvg(result, numOfSamples);
        }
 
@@ -95,5 +93,5 @@ public class AverageCalculator {
                }
                return result;
        }
-}
 
+}
index b676273..e802820 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -91,9 +91,9 @@ public class ConsumerThread extends Thread {
                }
        }
 
-        /**
-         * Checks whether enough samples are available for the network functions        
-         */    
+    /**
+     * Checks whether enough samples are available for the network functions
+     */
        public boolean checkForEnoughSamples(List<String> nfs, String snssai) {
                for(String nf : nfs) {
                        if(! pmDataQueue.checkSamplesInQueue(new SubCounter(nf, snssai), samples)) {
index 51a0466..81a49f9 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -103,4 +103,5 @@ public class PmEventProcessor implements IPmEventProcessor{
                result.put("snssai", pmNameArr[2]);
                return result;
        }
-}
\ No newline at end of file
+
+}
index e2903ae..2a24a49 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -89,4 +89,5 @@ public class PmThread extends Thread {
                        }
                }
        }
+
 }
index ca5bf26..2d3a2df 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -48,6 +48,9 @@ public class PolicyService {
        private static Logger log = LoggerFactory.getLogger(PolicyService.class);
        private ObjectMapper objectMapper = new ObjectMapper();
 
+       /**
+        * Initialization
+        */
        @PostConstruct
        public void init() {
                Configuration configuration = Configuration.getInstance();
index 29d7d10..45ef1c3 100644 (file)
@@ -37,8 +37,6 @@ import org.springframework.web.client.RestTemplate;
 @Configuration
 public class AppConfig {
 
-
-    
     /**
      * Rest Template bean.
      */
@@ -65,4 +63,5 @@ public class AppConfig {
         byteArrayHttpMessageConverter.setSupportedMediaTypes(supportedApplicationTypes);
         return byteArrayHttpMessageConverter;
     }
+
 }
index 5f4006c..3257ac0 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.
@@ -49,4 +49,5 @@ public class BeanUtil implements ApplicationContextAware {
     public static <T> T getBean(Class<T> beanClass) {
         return context.getBean(beanClass);
     }
+
 }
index 7457533..6e1cf91 100644 (file)
@@ -2,7 +2,7 @@
  *  ============LICENSE_START=======================================================
  *  slice-analysis-ms
  *  ================================================================================
- *   Copyright (C) 2020 Wipro Limited.
+ *   Copyright (C) 2020-2021 Wipro Limited.
  *   ==============================================================================
  *     Licensed under the Apache License, Version 2.0 (the "License");
  *     you may not use this file except in compliance with the License.