CodeCoverage improvement for dcaegen2-services-mapper 07/129507/4
authorRama-Huawei <rama.subba.reddy.s@huawei.com>
Tue, 7 Jun 2022 13:37:26 +0000 (19:07 +0530)
committerRama-Huawei <rama.subba.reddy.s@huawei.com>
Wed, 15 Jun 2022 03:52:29 +0000 (09:22 +0530)
Issue-ID: DCAEGEN2-3167

Signed-off-by: Rama-Huawei <rama.subba.reddy.s@huawei.com>
Change-Id: I979d993790f08987c26a02bf4686ba865153e177

20 files changed:
Changelog.md
UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/CreatorTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherQueueImplTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherResponseImplTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRSubcriber/DMaaPMRSubscriberImplTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/DomainsTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/PrioritiesTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SeverityTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/StateTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SysLogSeverityTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/TcaAlertActionTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/VnfStatusTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VESAdapterInitializerTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/CollectorConfigPropertyRetrievalTest.java [new file with mode: 0755]
UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/DmaapConfigTest.java [new file with mode: 0755]
version.properties

index 7671699..018b2e4 100755 (executable)
@@ -1,9 +1,12 @@
-# Change Log
+# Change Log
 All notable changes to this project will be documented in this file.
 
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).
 
+## [1.4.2] - 2022/06/14
+         - [DCAEGEN2-3167] - CodeCoverage improvement for dcaegen2-services-mapper
+
 ## [1.4.1] - 2022/05/19
          - [DCAEGEN2-3105] - Remove log4j transitive dependency from VES-Mapper
 
index 4b15f55..8b3e52e 100644 (file)
@@ -3,6 +3,7 @@
  *  dcae-analytics\r
  * ================================================================================\r
  *    Copyright Â© 2017 AT&T Intellectual Property. All rights reserved.\r
+ *    Copyright (C) 2022 Huawei. All rights reserved.\r
  * ================================================================================\r
  *  Licensed under the Apache License, Version 2.0 (the "License");\r
  *  you may not use this file except in compliance with the License.\r
@@ -43,23 +44,22 @@ import com.google.common.base.Objects;
 @ComponentScan\r
 public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig {\r
 \r
+    /**\r
+     * Publisher batching queue size\r
+     */\r
+    private int maxBatchSize;\r
 \r
-       /**\r
-        * Publisher batching queue size\r
-        */\r
-       private int maxBatchSize;\r
+    /**\r
+     * Publisher Recovery Queue Size\r
+     */\r
+    private int maxRecoveryQueueSize;\r
 \r
-       /**\r
-        * Publisher Recovery Queue Size\r
-        */\r
-       private int maxRecoveryQueueSize;\r
-       \r
-       /**\r
-        * Default uri path prefix\r
-        */\r
-       private String dmaapUriPathPrefix ;\r
+    /**\r
+     * Default uri path prefix\r
+     */\r
+    private String dmaapUriPathPrefix ;\r
 \r
-    private DMaaPMRPublisherConfig(Builder builder) {\r
+    public DMaaPMRPublisherConfig(Builder builder) {\r
         this.hostName = builder.hostName;\r
         this.portNumber = builder.portNumber;\r
         this.topicName = builder.topicName;\r
@@ -72,182 +72,183 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig {
         this.dmaapUriPathPrefix = builder.dmaapUriPathPrefix;\r
     }\r
 \r
-       /**\r
-        * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object\r
-        */\r
-       public static class Builder {\r
-\r
-               private String hostName;\r
-               private Integer portNumber;\r
-               private String topicName;\r
-               private String userName;\r
-               private String userPassword;\r
-               private String protocol;\r
-               private String contentType;\r
-               private int maxBatchSize;\r
-               private int maxRecoveryQueueSize;\r
-               private String dmaapUriPathPrefix ;\r
-               \r
-               \r
-\r
-               public Builder(@Nonnull String topicName, DmaapConfig dmaapConfig) throws IOException {\r
-this.topicName = topicName;\r
-this.hostName = dmaapConfig.getDmaaphost();\r
-               this.portNumber = dmaapConfig.getDEFAULT_PORT_NUMBER();\r
-                       // Default values\r
-       \r
-                       this.userName = dmaapConfig.getDEFAULT_USER_NAME();\r
-                       this.userPassword = dmaapConfig.getDEFAULT_USER_PASSWORD();\r
-                       this.protocol =dmaapConfig.getDEFAULT_PROTOCOL();\r
-                       this.contentType = dmaapConfig.getDEFAULT_CONTENT_TYPE();\r
-\r
-                       this.maxBatchSize =dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE();\r
-                       this.maxRecoveryQueueSize = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE();\r
-                       this.dmaapUriPathPrefix=dmaapConfig.getDMAAP_URI_PATH_PREFIX();\r
-               }\r
-\r
-               /**\r
-                * Setup for custom host port number - Defaults to 80.\r
-                *\r
-                * @param portNumber\r
-                *            custom port number\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setPortNumber(@Nonnull Integer portNumber) {\r
-                       this.portNumber = portNumber;\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup user name for authentication. If no username is provided authentication\r
-                * will be disabled\r
-                *\r
-                * @param userName\r
-                *            user name for DMaaP Topic Authentication\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setUserName(@Nonnull String userName) {\r
-                       this.userName = userName;\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup user password for authentication. If no password is provided\r
-                * authentication will be disabled\r
-                *\r
-                * @param userPassword\r
-                *            user password for DMaaP Topic Authentication\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setUserPassword(@Nonnull String userPassword) {\r
-                       this.userPassword = userPassword;\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup custom Publisher protocol - Defaults to https. Note: Only http and\r
-                * https are currently supported.\r
-                *\r
-                * @param protocol\r
-                *            protocol e.g. https\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setProtocol(@Nonnull String protocol) {\r
-                       this.protocol = normalizeValidateProtocol(protocol);\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup custom Publisher content-type - Defaults to application/json\r
-                *\r
-                * @param contentType\r
-                *            content type e.g. application/json\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setContentType(@Nonnull String contentType) {\r
-                       final String normalizedContentType = normalizeValidateContentType(contentType);\r
-                       this.contentType = normalizedContentType;\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup custom Publisher Max Batch Size - Defaults to 100\r
-                *\r
-                * @param maxBatchSize\r
-                *            max Batch Size\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setMaxBatchSize(int maxBatchSize) {\r
-                       this.maxBatchSize = maxBatchSize;\r
-                       return this;\r
-               }\r
-\r
-               /**\r
-                * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold\r
-                * messages temporarily in case DMaaP MR Publisher topic is not responding for\r
-                * any reason. Defaults to 100,000\r
-                *\r
-                * @param maxRecoveryQueueSize\r
-                *            max recovery queue size\r
-                * @return Builder object itself for chaining\r
-                */\r
-               public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) {\r
-                       this.maxRecoveryQueueSize = maxRecoveryQueueSize;\r
-                       return this;\r
-               }\r
-               \r
-\r
-               /**\r
-                * Creates immutable instance of {@link DMaaPMRPublisherConfig}\r
-                *\r
-                * @return Builds and returns thread safe, immutable\r
-                *         {@link DMaaPMRPublisherConfig} object\r
-                */\r
+    /**\r
+     * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object\r
+     */\r
+    public static class Builder {\r
+\r
+        private String hostName;\r
+        private Integer portNumber;\r
+        private String topicName;\r
+        private String userName;\r
+        private String userPassword;\r
+        private String protocol;\r
+        private String contentType;\r
+        private int maxBatchSize;\r
+        private int maxRecoveryQueueSize;\r
+        private String dmaapUriPathPrefix ;\r
+\r
+\r
+\r
+        public Builder(@Nonnull String topicName, DmaapConfig dmaapConfig) throws IOException {\r
+            this.topicName = topicName;\r
+            this.hostName = dmaapConfig.getDmaaphost();\r
+            this.portNumber = dmaapConfig.getDEFAULT_PORT_NUMBER();\r
+            // Default values\r
+\r
+            this.userName = dmaapConfig.getDEFAULT_USER_NAME();\r
+            this.userPassword = dmaapConfig.getDEFAULT_USER_PASSWORD();\r
+            this.protocol =dmaapConfig.getDEFAULT_PROTOCOL();\r
+            this.contentType = dmaapConfig.getDEFAULT_CONTENT_TYPE();\r
+\r
+            this.maxBatchSize =dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE();\r
+            this.maxRecoveryQueueSize = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE();\r
+            this.dmaapUriPathPrefix=dmaapConfig.getDMAAP_URI_PATH_PREFIX();\r
+        }\r
+\r
+        /**\r
+         * Setup for custom host port number - Defaults to 80.\r
+         *\r
+         * @param portNumber\r
+         *            custom port number\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setPortNumber(@Nonnull Integer portNumber) {\r
+            this.portNumber = portNumber;\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup user name for authentication. If no username is provided authentication\r
+         * will be disabled\r
+         *\r
+         * @param userName\r
+         *            user name for DMaaP Topic Authentication\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setUserName(@Nonnull String userName) {\r
+            this.userName = userName;\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup user password for authentication. If no password is provided\r
+         * authentication will be disabled\r
+         *\r
+         * @param userPassword\r
+         *            user password for DMaaP Topic Authentication\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setUserPassword(@Nonnull String userPassword) {\r
+            this.userPassword = userPassword;\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup custom Publisher protocol - Defaults to https. Note: Only http and\r
+         * https are currently supported.\r
+         *\r
+         * @param protocol\r
+         *            protocol e.g. https\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setProtocol(@Nonnull String protocol) {\r
+            this.protocol = normalizeValidateProtocol(protocol);\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup custom Publisher content-type - Defaults to application/json\r
+         *\r
+         * @param contentType\r
+         *            content type e.g. application/json\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setContentType(@Nonnull String contentType) {\r
+            final String normalizedContentType = normalizeValidateContentType(contentType);\r
+            this.contentType = normalizedContentType;\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup custom Publisher Max Batch Size - Defaults to 100\r
+         *\r
+         * @param maxBatchSize\r
+         *            max Batch Size\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setMaxBatchSize(int maxBatchSize) {\r
+            this.maxBatchSize = maxBatchSize;\r
+            return this;\r
+        }\r
+\r
+        /**\r
+         * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold\r
+         * messages temporarily in case DMaaP MR Publisher topic is not responding for\r
+         * any reason. Defaults to 100,000\r
+         *\r
+         * @param maxRecoveryQueueSize\r
+         *            max recovery queue size\r
+         * @return Builder object itself for chaining\r
+         */\r
+        public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) {\r
+            this.maxRecoveryQueueSize = maxRecoveryQueueSize;\r
+            return this;\r
+        }\r
+\r
+\r
+        /**\r
+         * Creates immutable instance of {@link DMaaPMRPublisherConfig}\r
+         *\r
+         * @return Builds and returns thread safe, immutable\r
+         *         {@link DMaaPMRPublisherConfig} object\r
+         */\r
         public DMaaPMRPublisherConfig build() {\r
             return new DMaaPMRPublisherConfig(this);\r
         }\r
 \r
-       }\r
-       public String getDmaapUriPathPrefix() {\r
-               return dmaapUriPathPrefix;\r
-       }\r
-\r
-       /**\r
-        * Returns max Publisher Batch Queue Size\r
-        *\r
-        * @return max Publisher Batch Queue size\r
-        */\r
-       public int getMaxBatchSize() {\r
-               return maxBatchSize;\r
-       }\r
-\r
-       /**\r
-        * Returns max Publisher Recovery Queue Size\r
-        *\r
-        * @return max Recovery Queue size\r
-        */\r
-       public int getMaxRecoveryQueueSize() {\r
-               return maxRecoveryQueueSize;\r
-       }\r
-\r
-       @Override\r
-       public boolean equals(Object o) {\r
-               if (this == o) {\r
-                       return true;\r
-               }\r
-               if (o == null || getClass() != o.getClass()) {\r
-                       return false;\r
-               }\r
-               if (!super.equals(o)) {\r
-                       return false;\r
-               }\r
-               DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o;\r
-               return maxBatchSize == that.maxBatchSize && maxRecoveryQueueSize == that.maxRecoveryQueueSize;\r
-       }\r
-\r
-       @Override\r
-       public int hashCode() {\r
-               return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize);\r
-       }\r
-\r
-}
\ No newline at end of file
+    }\r
+    public String getDmaapUriPathPrefix() {\r
+        return dmaapUriPathPrefix;\r
+    }\r
+\r
+    /**\r
+     * Returns max Publisher Batch Queue Size\r
+     *\r
+     * @return max Publisher Batch Queue size\r
+     */\r
+    public int getMaxBatchSize() {\r
+        return maxBatchSize;\r
+    }\r
+\r
+    /**\r
+     * Returns max Publisher Recovery Queue Size\r
+     *\r
+     * @return max Recovery Queue size\r
+     */\r
+    public int getMaxRecoveryQueueSize() {\r
+        return maxRecoveryQueueSize;\r
+    }\r
+\r
+    @Override\r
+    public boolean equals(Object o) {\r
+        if (this == o) {\r
+            return true;\r
+        }\r
+        if (o == null || getClass() != o.getClass()) {\r
+            return false;\r
+        }\r
+        if (!super.equals(o)) {\r
+            return false;\r
+        }\r
+        DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o;\r
+        return maxBatchSize == that.maxBatchSize && maxRecoveryQueueSize == that.maxRecoveryQueueSize;\r
+    }\r
+\r
+    @Override\r
+    public int hashCode() {\r
+        return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize);\r
+    }\r
+\r
+}\r
+\r
index 495722f..e0b72de 100644 (file)
@@ -1,6 +1,7 @@
 /*-\r
  * ============LICENSE_START=======================================================\r
  *  Copyright (C) 2019 Samsung. All rights reserved.\r
+ *  Copyright (C) 2022 Huawei. All rights reserved.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -22,11 +23,18 @@ package org.onap.universalvesadapter.configs;
 import static org.junit.Assert.assertEquals;\r
 import static org.junit.Assert.assertNotNull;\r
 import static org.junit.Assert.assertNull;\r
+import static org.junit.Assert.assertFalse;\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.assertNotEquals;\r
 \r
 import org.junit.Before;\r
 import org.junit.Test;\r
 import org.mockito.Mockito;\r
 import org.onap.universalvesadapter.exception.DMaapException;\r
+import org.onap.universalvesadapter.utils.DmaapConfig;\r
+\r
+import java.io.IOException;\r
+\r
 \r
 public class DmaapMrBaseConfigTest {\r
     DMaaPMRBaseConfig dmaapMrBaseConfig = null;\r
@@ -75,4 +83,105 @@ public class DmaapMrBaseConfigTest {
         assertEquals(JSON_APPLICATION_TYPE,\r
                 DMaaPMRBaseConfig.normalizeValidateContentType("application/json"));\r
     }\r
+\r
+    @Test\r
+    public void testDMaaPMRSubscriberConfig() throws IOException {\r
+        DMaaPMRSubscriberConfig dMaaPMRSubscriberConfig = new DMaaPMRSubscriberConfig(new DMaaPMRSubscriberConfig\r
+                .Builder("test", new DmaapConfig()));\r
+        assertNotNull(dMaaPMRSubscriberConfig);\r
+        String timeout = dMaaPMRSubscriberConfig.getTimeoutMSParam();\r
+        assertNull(timeout);\r
+        dMaaPMRSubscriberConfig.setTimeoutMSParam("10");\r
+        timeout = dMaaPMRSubscriberConfig.getTimeoutMSParam();\r
+        assertNotNull(timeout);\r
+        String limitParam = dMaaPMRSubscriberConfig.getMessageLimitParam();\r
+        assertNull(limitParam);\r
+        dMaaPMRSubscriberConfig.setMessageLimitParam("test");\r
+        dMaaPMRSubscriberConfig.setUriPrefix("test");\r
+        String uriPrefix = dMaaPMRSubscriberConfig.getUriPrefix();\r
+        assertNotNull(uriPrefix);\r
+        String consumerId = dMaaPMRSubscriberConfig.getConsumerId();\r
+        assertNull(consumerId);\r
+        String consumerGroup = dMaaPMRSubscriberConfig.getConsumerGroup();\r
+        assertNull(consumerGroup);\r
+        int timeoutMS = dMaaPMRSubscriberConfig.getTimeoutMS();\r
+        assertEquals(0, timeoutMS);\r
+        int messageLimit = dMaaPMRSubscriberConfig.getMessageLimit();\r
+        assertEquals(0, messageLimit);\r
+        boolean result = dMaaPMRSubscriberConfig.equals(new Object());\r
+        assertFalse(result);\r
+        result = dMaaPMRSubscriberConfig.equals(new DMaaPMRSubscriberConfig(new DMaaPMRSubscriberConfig\r
+                .Builder("test", new DmaapConfig())));\r
+        assertTrue(result);\r
+        int res = dMaaPMRSubscriberConfig.hashCode();\r
+        assertNotEquals(0, res);\r
+    }\r
+\r
+    @Test\r
+    public void testDMaaPMRSubscriberConfigBuilder() throws IOException {\r
+        DMaaPMRSubscriberConfig.Builder builder = new DMaaPMRSubscriberConfig\r
+                .Builder("test", new DmaapConfig());\r
+        DMaaPMRSubscriberConfig.Builder builder1 = builder.setPortNumber(1234);\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setUserName("john");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setUserPassword("sample");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setProtocol("HTTPS");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setContentType("application/json");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setConsumerId("1234");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setConsumerGroup("consumergroup");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setTimeoutMS(10);\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setMessageLimit(10);\r
+        assertNotNull(builder1);\r
+        DMaaPMRSubscriberConfig dMaaPMRSubscriberConfig = builder.build();\r
+        assertNotNull(dMaaPMRSubscriberConfig);\r
+    }\r
+\r
+    @Test\r
+    public void testDMaaPMRPublisherConfig() throws IOException {\r
+        DMaaPMRPublisherConfig dMaaPMRPublisherConfig = new DMaaPMRPublisherConfig(new DMaaPMRPublisherConfig\r
+                .Builder("test", new DmaapConfig()));\r
+        assertNotNull(dMaaPMRPublisherConfig);\r
+        String uriPathPrefix = dMaaPMRPublisherConfig.getDmaapUriPathPrefix();\r
+        assertNull(uriPathPrefix);\r
+        int maxBatchSize = dMaaPMRPublisherConfig.getMaxBatchSize();\r
+        assertEquals(0, maxBatchSize);\r
+        int maxRecoveryQueueSize = dMaaPMRPublisherConfig.getMaxRecoveryQueueSize();\r
+        assertEquals(0, maxRecoveryQueueSize);\r
+        boolean result = dMaaPMRPublisherConfig.equals(new Object());\r
+        assertFalse(result);\r
+        result = dMaaPMRPublisherConfig.equals(new DMaaPMRPublisherConfig(new DMaaPMRPublisherConfig\r
+                .Builder("test", new DmaapConfig())));\r
+        assertTrue(result);\r
+        int res = dMaaPMRPublisherConfig.hashCode();\r
+        assertNotEquals(0, res);\r
+    }\r
+\r
+    @Test\r
+    public void testDMaaPMRPublisherConfigBuilder() throws IOException {\r
+        DMaaPMRPublisherConfig.Builder builder = new DMaaPMRPublisherConfig\r
+                .Builder("test", new DmaapConfig());\r
+        DMaaPMRPublisherConfig.Builder builder1 = builder.setPortNumber(1234);\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setUserName("john");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setUserPassword("sample");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setProtocol("HTTPS");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setContentType("application/json");\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setMaxBatchSize(10);\r
+        assertNotNull(builder1);\r
+        builder1 = builder.setMaxRecoveryQueueSize(10);\r
+        assertNotNull(builder1);\r
+        DMaaPMRPublisherConfig dMaaPMRPublisherConfig = builder.build();\r
+        assertNotNull(dMaaPMRPublisherConfig);\r
+    }\r
 }\r
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/CreatorTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/CreatorTest.java
new file mode 100755 (executable)
index 0000000..0d5a486
--- /dev/null
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.dmaap;
+
+import org.junit.Test;
+import org.onap.universalvesadapter.dmaap.MRSubcriber.DMaaPMRSubscriber;
+import org.onap.universalvesadapter.utils.DmaapConfig;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class CreatorTest {
+    @Test
+    public void testGetDmaapConfig() {
+        Creator creator = new Creator();
+        creator.setDmaapConfig(new DmaapConfig());
+        DmaapConfig dmaapConfig = creator.getDmaapConfig();
+        assertNotNull(dmaapConfig);
+    }
+
+    @Test
+    public void testGetDMaaPMRPublisher() {
+        Creator creator = new Creator();
+        creator.setDmaapConfig(new DmaapConfig());
+        try {
+            creator.getDMaaPMRPublisher("test");
+        } catch (IllegalArgumentException e) {
+            // expected case
+            return;
+        }
+
+        fail("Exception is not thrown");
+    }
+
+    @Test
+    public void testGetDMaaPMRSubscriber() {
+        Creator creator = new Creator();
+        creator.setDmaapConfig(new DmaapConfig());
+        DMaaPMRSubscriber dMaaPMRSubscriber = creator.getDMaaPMRSubscriber("test");
+        assertNotNull(dMaaPMRSubscriber);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherQueueImplTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherQueueImplTest.java
new file mode 100755 (executable)
index 0000000..ac5007a
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.dmaap.MRPublisher;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class DMaaPMRPublisherQueueImplTest {
+    @Test
+    public void testDMaaPMRPublisherQueueImpl() {
+        DMaaPMRPublisherQueueImpl dMaaPMRPublisherQueue = new DMaaPMRPublisherQueueImpl(2, 2);
+        List<String> messages = new ArrayList<>();
+        messages.add("msg");
+        int result = dMaaPMRPublisherQueue.addBatchMessages(messages);
+        assertEquals(1, result);
+        result = dMaaPMRPublisherQueue.addRecoverableMessages(messages);
+        assertEquals(1, result);
+        List<String> messageForPublishing = dMaaPMRPublisherQueue.getMessageForPublishing();
+        assertNotNull(messageForPublishing);
+        int batchQueueRemainingSize = dMaaPMRPublisherQueue.getBatchQueueRemainingSize();
+        assertEquals(2, batchQueueRemainingSize);
+        int recoveryQueueRemainingSize = dMaaPMRPublisherQueue.getRecoveryQueueRemainingSize();
+        assertEquals(2, recoveryQueueRemainingSize);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherResponseImplTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherResponseImplTest.java
new file mode 100755 (executable)
index 0000000..fbc3ee3
--- /dev/null
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.dmaap.MRPublisher;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DMaaPMRPublisherResponseImplTest {
+    @Test
+    public void testDMaaPMRPublisherResponseImpl() {
+        DMaaPMRPublisherResponseImpl dMaaPMRPublisherResponse
+                = new DMaaPMRPublisherResponseImpl(200, "msg", 2);
+        int responseCode = dMaaPMRPublisherResponse.getResponseCode();
+        assertEquals(200, responseCode);
+        String responseMessage = dMaaPMRPublisherResponse.getResponseMessage();
+        assertEquals("msg", responseMessage);
+        int pendingMessagesCount = dMaaPMRPublisherResponse.getPendingMessagesCount();
+        assertEquals(2, pendingMessagesCount);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRSubcriber/DMaaPMRSubscriberImplTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRSubcriber/DMaaPMRSubscriberImplTest.java
new file mode 100755 (executable)
index 0000000..47ccb3b
--- /dev/null
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.dmaap.MRSubcriber;
+
+import org.junit.Test;
+
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+public class DMaaPMRSubscriberImplTest {
+    @Test
+    public void testFetchMessages() {
+        DMaaPMRSubscriberResponseImpl dMaaPMRSubscriberResponse
+                = new DMaaPMRSubscriberResponseImpl(1, "msg", null);
+        List<String> messages =  dMaaPMRSubscriberResponse.getFetchedMessages();
+        assertNotNull(messages);
+        String resMsg = dMaaPMRSubscriberResponse.getResponseMessage();
+        assertNotNull(resMsg);
+        List<String> fetchedMessages = dMaaPMRSubscriberResponse.getFetchedMessages();
+        assertNotNull(fetchedMessages);
+        int respCode = dMaaPMRSubscriberResponse.getResponseCode();
+        assertEquals(1, respCode);
+        dMaaPMRSubscriberResponse = new DMaaPMRSubscriberResponseImpl(1, "msg");
+        assertNotNull(dMaaPMRSubscriberResponse);
+        String toStr = dMaaPMRSubscriberResponse.toString();
+        assertNotNull(toStr);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/DomainsTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/DomainsTest.java
new file mode 100755 (executable)
index 0000000..7185954
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class DomainsTest {
+    @Test
+    public void testDomains(){
+        assertNotNull(Domains.DOMAIN_FAULT);
+        String value = Domains.DOMAIN_FAULT.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/PrioritiesTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/PrioritiesTest.java
new file mode 100755 (executable)
index 0000000..1894562
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class PrioritiesTest {
+    @Test
+    public void testPriorities() {
+        assertNotNull(Priorities.HIGH);
+        String value = Priorities.HIGH.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SeverityTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SeverityTest.java
new file mode 100755 (executable)
index 0000000..ca32b4a
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+public class SeverityTest {
+    @Test
+    public void testSeverityTest() {
+        assertNotNull(Severity.SEVERITY_CRITICAL);
+        String value = Severity.SEVERITY_CRITICAL.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/StateTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/StateTest.java
new file mode 100755 (executable)
index 0000000..d25ff13
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class StateTest {
+    @Test
+    public void testState() {
+        assertNotNull(State.STATE_IN_SERVICE);
+        String value = State.STATE_IN_SERVICE.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SysLogSeverityTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SysLogSeverityTest.java
new file mode 100755 (executable)
index 0000000..4ebb91b
--- /dev/null
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class SysLogSeverityTest {
+    @Test
+    public void testSysLogSeverity() {
+        assertNotNull(SysLogSeverity.SEVERITY_ALERT);
+        String value = SysLogSeverity.SEVERITY_ALERT.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/TcaAlertActionTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/TcaAlertActionTest.java
new file mode 100755 (executable)
index 0000000..dbc3c88
--- /dev/null
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class TcaAlertActionTest {
+    @Test
+    public void testTcaAlertAction() {
+        assertNotNull(TcaAlertAction.CLEAR);
+        String value = TcaAlertAction.CLEAR.getValue();
+        assertNotNull(value);
+        assertNotNull(TcaAlertType.CARD_ANOMALY);
+        value = TcaAlertType.CARD_ANOMALY.getValue();
+        assertNotNull(value);
+        assertNotNull(TcaCounterCriticality.CRITICAL);
+        value = TcaCounterCriticality.CRITICAL.getValue();
+        assertNotNull(value);
+        assertNotNull(TcaEventSeverity.SEVERITY_CRITICAL);
+        value = TcaEventSeverity.SEVERITY_CRITICAL.getValue();
+        assertNotNull(value);
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/VnfStatusTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/VnfStatusTest.java
new file mode 100755 (executable)
index 0000000..a0e2478
--- /dev/null
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.domain;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+
+public class VnfStatusTest {
+    @Test
+    public void testVnfStatus() {
+        assertNotNull(VnfStatus.VFSTATUS_ACTIVE);
+        String value = VnfStatus.VFSTATUS_ACTIVE.getValue();
+        assertNotNull(value);
+    }
+
+}
index 0097658..00ed93a 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP : DCAE\r
  * ================================================================================\r
  * Copyright 2018-2019 TechMahindra\r
+ * Copyright (C) 2022 Huawei. All rights reserved. \r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -52,9 +53,8 @@ public class EntryTest {
         assertEquals(entry.getAdditionalProperties(), additionalProperties);\r
         assert (entry.toString() != null);\r
         assert (entry.hashCode() != 0);\r
-        \r
+        assert (!entry.equals(null));\r
         assert (entry.equals(entry));\r
-        \r
     }\r
     \r
 }\r
index a9cf2b0..7c3c170 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP : DCAE\r
  * ================================================================================\r
  * Copyright 2018-2019 TechMahindra\r
+ * Copyright (C) 2022 Huawei. All rights reserved. \r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -47,7 +48,7 @@ public class MapperConfigTest {
         assertEquals(mapperConfig.getEntries(), entries);\r
         assert (mapperConfig.toString() != null);\r
         assert (mapperConfig.hashCode() != 0);\r
-        \r
+        assert (!mapperConfig.equals(null));\r
         assert (mapperConfig.equals(mapperConfig));\r
         \r
     }\r
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VESAdapterInitializerTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VESAdapterInitializerTest.java
new file mode 100755 (executable)
index 0000000..5aac110
--- /dev/null
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.service;
+
+import org.junit.Test;
+
+import static org.junit.Assert.fail;
+
+public class VESAdapterInitializerTest {
+    @Test
+    public void testVESAdapterInitializer() {
+        try {
+            VesService vesService = new VesService();
+            vesService.stop();
+            vesService.start();
+        } catch (Exception e) {
+            // expected case
+            return;
+        }
+        fail("Exception is not thrown");
+    }
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/CollectorConfigPropertyRetrievalTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/CollectorConfigPropertyRetrievalTest.java
new file mode 100755 (executable)
index 0000000..2d8d860
--- /dev/null
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.utils;
+
+import org.junit.Test;
+
+import java.net.URISyntaxException;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class CollectorConfigPropertyRetrievalTest {
+    @Test
+    public void testGetDmaapTopics() {
+        CollectorConfigPropertyRetrieval collectorConfigPropertyRetrieval = new CollectorConfigPropertyRetrieval();
+        try {
+            collectorConfigPropertyRetrieval.getDmaapTopics("subsrciber", "publisher", "null");
+        } catch (NullPointerException e) {
+            // expected case
+            return;
+        }
+        fail("Exception is not thrown");
+    }
+
+    @Test
+    public void testGetTopics() {
+        CollectorConfigPropertyRetrieval collectorConfigPropertyRetrieval = new CollectorConfigPropertyRetrieval();
+        try {
+            collectorConfigPropertyRetrieval.getTopics("subsrciber", "publisher", "null");
+        } catch (IllegalArgumentException e)  {
+            // expected case
+            return;
+        }
+        fail("Exception is not thrown");
+    }
+
+    @Test
+    public void testGetTopicName() {
+        CollectorConfigPropertyRetrieval collectorConfigPropertyRetrieval = new CollectorConfigPropertyRetrieval();
+        try {
+            String topicName = collectorConfigPropertyRetrieval.getTopicName("http://127.0.0.1");
+            assertNotNull(topicName);
+            collectorConfigPropertyRetrieval.setDmaapConfig("http://127.0.0.1");
+        } catch (URISyntaxException | NullPointerException e) {
+            // expected case
+            return;
+        }
+        fail("Exception is not thrown");
+    }
+
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/DmaapConfigTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/DmaapConfigTest.java
new file mode 100755 (executable)
index 0000000..ab6765b
--- /dev/null
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : DCAE
+ * ================================================================================
+ * Copyright (C) 2022 Huawei. 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.universalvesadapter.utils;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DmaapConfigTest {
+
+    @Test
+    public void testSetDmaaphost() {
+        DmaapConfig dmaapConfig = new DmaapConfig();
+        dmaapConfig.setDmaaphost("dmaapHost");
+        String dmaaphost = dmaapConfig.getDmaaphost();
+        assertEquals("dmaapHost", dmaaphost);
+        dmaapConfig.setDEFAULT_PORT_NUMBER(1234);
+        int default_port_number = dmaapConfig.getDEFAULT_PORT_NUMBER();
+        assertEquals(1234, default_port_number);
+        dmaapConfig.setDMAAP_DEFAULT_CONSUMER_ID("1234");
+        String dmaap_default_consumer_id = dmaapConfig.getDMAAP_DEFAULT_CONSUMER_ID();
+        assertEquals("1234", dmaap_default_consumer_id);
+        dmaapConfig.setDMAAP_GROUP_PREFIX("abc");
+        String dmaap_group_prefix = dmaapConfig.getDMAAP_GROUP_PREFIX();
+        assertEquals("abc", dmaap_group_prefix);
+        dmaapConfig.setDMAAP_URI_PATH_PREFIX("prefix");
+        String dmaap_uri_path_prefix = dmaapConfig.getDMAAP_URI_PATH_PREFIX();
+        assertEquals("prefix", dmaap_uri_path_prefix);
+        dmaapConfig.setDEFAULT_CONTENT_TYPE("abc");
+        String default_content_type = dmaapConfig.getDEFAULT_CONTENT_TYPE();
+        assertEquals("abc", default_content_type);
+        dmaapConfig.setPollingInterval(2);
+        int pollingInterval = dmaapConfig.getPollingInterval();
+        assertEquals(2, pollingInterval);
+        dmaapConfig.setsubscriberSUBSCRIBER_MSG_LIMIT_QUERY_PARAM_NAME("msg");
+        String msg = dmaapConfig.getsubscriberSUBSCRIBER_MSG_LIMIT_QUERY_PARAM_NAME();
+        assertEquals("msg", msg);
+        dmaapConfig.setsubscriberSUBSCRIBER_TIMEOUT_QUERY_PARAM_NAME("timeout");
+        String timeout = dmaapConfig.getsubscriberSUBSCRIBER_TIMEOUT_QUERY_PARAM_NAME();
+        assertEquals("timeout", timeout);
+        dmaapConfig.setsubscriberDEFAULT_SUBSCRIBER_GROUP_PREFIX("prefix");
+        String prefix = dmaapConfig.getsubscriberDEFAULT_SUBSCRIBER_GROUP_PREFIX();
+        assertEquals("prefix", prefix);
+        dmaapConfig.setsubscriberDEFAULT_SUBSCRIBER_MESSAGE_LIMIT(2);
+        int msgLimit = dmaapConfig.getsubscriberDEFAULT_SUBSCRIBER_MESSAGE_LIMIT();
+        assertEquals(2, msgLimit);
+        dmaapConfig.setsubscriberDEFAULT_SUBSCRIBER_TIMEOUT_MS(2);
+        int timeout_ms = dmaapConfig.getsubscriberDEFAULT_SUBSCRIBER_TIMEOUT_MS();
+        assertEquals(2, timeout_ms);
+        dmaapConfig.setPublisherPUBLISHER_DELAY_MS_ON_RETRIES_ON_CLOSE(2);
+        int retries_on_close = dmaapConfig.getPublisherPUBLISHER_DELAY_MS_ON_RETRIES_ON_CLOSE();
+        assertEquals(2, retries_on_close);
+        dmaapConfig.setPublisherPUBLISHER_MAX_FLUSH_RETRIES_ON_CLOSE(2);
+        int flush_retries_on_close = dmaapConfig.getPublisherPUBLISHER_MAX_FLUSH_RETRIES_ON_CLOSE();
+        assertEquals(2, flush_retries_on_close);
+        dmaapConfig.setPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE(2);
+        int max_recovery_queue_size = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE();
+        assertEquals(2, max_recovery_queue_size);
+        dmaapConfig.setPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE(2);
+        int publisherDEFAULT_publisher_max_batch_size = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE();
+        assertEquals(2, publisherDEFAULT_publisher_max_batch_size);
+        dmaapConfig.setDEFAULT_PROTOCOL("HTTPS");
+        String default_protocol = dmaapConfig.getDEFAULT_PROTOCOL();
+        assertEquals("HTTPS", default_protocol);
+        dmaapConfig.setDEFAULT_USER_PASSWORD("abc");
+        String default_user_password = dmaapConfig.getDEFAULT_USER_PASSWORD();
+        assertEquals("abc", default_user_password);
+        dmaapConfig.setDEFAULT_USER_NAME("root");
+        String default_user_name = dmaapConfig.getDEFAULT_USER_NAME();
+        assertEquals("root", default_user_name);
+    }
+}
index e21ebcd..b0c0f62 100755 (executable)
@@ -1,6 +1,6 @@
 major=1\r
 minor=4\r
-patch=1\r
+patch=2\r
 base_version=${major}.${minor}.${patch}\r
 release_version=${base_version}\r
 snapshot_version=${base_version}-SNAPSHOT\r