aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRama-Huawei <rama.subba.reddy.s@huawei.com>2022-06-07 19:07:26 +0530
committerRama-Huawei <rama.subba.reddy.s@huawei.com>2022-06-15 09:22:29 +0530
commitb58d6c90de8d4856ff580a038164ede05f4e94c0 (patch)
tree0a699fc6aba45f97ff9000b752c54455fcfdbaac
parentb12e2094176feead427dd6bc44d0b456f7341f02 (diff)
CodeCoverage improvement for dcaegen2-services-mapper
Issue-ID: DCAEGEN2-3167 Signed-off-by: Rama-Huawei <rama.subba.reddy.s@huawei.com> Change-Id: I979d993790f08987c26a02bf4686ba865153e177
-rwxr-xr-xChangelog.md5
-rw-r--r--UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java379
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java109
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/CreatorTest.java60
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherQueueImplTest.java48
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherResponseImplTest.java39
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRSubcriber/DMaaPMRSubscriberImplTest.java48
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/DomainsTest.java34
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/PrioritiesTest.java34
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SeverityTest.java35
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/StateTest.java34
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SysLogSeverityTest.java34
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/TcaAlertActionTest.java43
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/VnfStatusTest.java35
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java4
-rw-r--r--UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java3
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VESAdapterInitializerTest.java40
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/CollectorConfigPropertyRetrievalTest.java69
-rwxr-xr-xUniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/DmaapConfigTest.java90
-rwxr-xr-xversion.properties2
20 files changed, 951 insertions, 194 deletions
diff --git a/Changelog.md b/Changelog.md
index 7671699..018b2e4 100755
--- a/Changelog.md
+++ b/Changelog.md
@@ -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
diff --git a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java
index 4b15f55..8b3e52e 100644
--- a/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java
+++ b/UniversalVesAdapter/src/main/java/org/onap/universalvesadapter/configs/DMaaPMRPublisherConfig.java
@@ -3,6 +3,7 @@
* dcae-analytics
* ================================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -43,23 +44,22 @@ import com.google.common.base.Objects;
@ComponentScan
public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig {
+ /**
+ * Publisher batching queue size
+ */
+ private int maxBatchSize;
- /**
- * Publisher batching queue size
- */
- private int maxBatchSize;
+ /**
+ * Publisher Recovery Queue Size
+ */
+ private int maxRecoveryQueueSize;
- /**
- * Publisher Recovery Queue Size
- */
- private int maxRecoveryQueueSize;
-
- /**
- * Default uri path prefix
- */
- private String dmaapUriPathPrefix ;
+ /**
+ * Default uri path prefix
+ */
+ private String dmaapUriPathPrefix ;
- private DMaaPMRPublisherConfig(Builder builder) {
+ public DMaaPMRPublisherConfig(Builder builder) {
this.hostName = builder.hostName;
this.portNumber = builder.portNumber;
this.topicName = builder.topicName;
@@ -72,182 +72,183 @@ public class DMaaPMRPublisherConfig extends DMaaPMRBaseConfig {
this.dmaapUriPathPrefix = builder.dmaapUriPathPrefix;
}
- /**
- * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object
- */
- public static class Builder {
-
- private String hostName;
- private Integer portNumber;
- private String topicName;
- private String userName;
- private String userPassword;
- private String protocol;
- private String contentType;
- private int maxBatchSize;
- private int maxRecoveryQueueSize;
- private String dmaapUriPathPrefix ;
-
-
-
- public Builder(@Nonnull String topicName, DmaapConfig dmaapConfig) throws IOException {
-this.topicName = topicName;
-this.hostName = dmaapConfig.getDmaaphost();
- this.portNumber = dmaapConfig.getDEFAULT_PORT_NUMBER();
- // Default values
-
- this.userName = dmaapConfig.getDEFAULT_USER_NAME();
- this.userPassword = dmaapConfig.getDEFAULT_USER_PASSWORD();
- this.protocol =dmaapConfig.getDEFAULT_PROTOCOL();
- this.contentType = dmaapConfig.getDEFAULT_CONTENT_TYPE();
-
- this.maxBatchSize =dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE();
- this.maxRecoveryQueueSize = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE();
- this.dmaapUriPathPrefix=dmaapConfig.getDMAAP_URI_PATH_PREFIX();
- }
-
- /**
- * Setup for custom host port number - Defaults to 80.
- *
- * @param portNumber
- * custom port number
- * @return Builder object itself for chaining
- */
- public Builder setPortNumber(@Nonnull Integer portNumber) {
- this.portNumber = portNumber;
- return this;
- }
-
- /**
- * Setup user name for authentication. If no username is provided authentication
- * will be disabled
- *
- * @param userName
- * user name for DMaaP Topic Authentication
- * @return Builder object itself for chaining
- */
- public Builder setUserName(@Nonnull String userName) {
- this.userName = userName;
- return this;
- }
-
- /**
- * Setup user password for authentication. If no password is provided
- * authentication will be disabled
- *
- * @param userPassword
- * user password for DMaaP Topic Authentication
- * @return Builder object itself for chaining
- */
- public Builder setUserPassword(@Nonnull String userPassword) {
- this.userPassword = userPassword;
- return this;
- }
-
- /**
- * Setup custom Publisher protocol - Defaults to https. Note: Only http and
- * https are currently supported.
- *
- * @param protocol
- * protocol e.g. https
- * @return Builder object itself for chaining
- */
- public Builder setProtocol(@Nonnull String protocol) {
- this.protocol = normalizeValidateProtocol(protocol);
- return this;
- }
-
- /**
- * Setup custom Publisher content-type - Defaults to application/json
- *
- * @param contentType
- * content type e.g. application/json
- * @return Builder object itself for chaining
- */
- public Builder setContentType(@Nonnull String contentType) {
- final String normalizedContentType = normalizeValidateContentType(contentType);
- this.contentType = normalizedContentType;
- return this;
- }
-
- /**
- * Setup custom Publisher Max Batch Size - Defaults to 100
- *
- * @param maxBatchSize
- * max Batch Size
- * @return Builder object itself for chaining
- */
- public Builder setMaxBatchSize(int maxBatchSize) {
- this.maxBatchSize = maxBatchSize;
- return this;
- }
-
- /**
- * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold
- * messages temporarily in case DMaaP MR Publisher topic is not responding for
- * any reason. Defaults to 100,000
- *
- * @param maxRecoveryQueueSize
- * max recovery queue size
- * @return Builder object itself for chaining
- */
- public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) {
- this.maxRecoveryQueueSize = maxRecoveryQueueSize;
- return this;
- }
-
-
- /**
- * Creates immutable instance of {@link DMaaPMRPublisherConfig}
- *
- * @return Builds and returns thread safe, immutable
- * {@link DMaaPMRPublisherConfig} object
- */
+ /**
+ * Builder to initialize immutable {@link DMaaPMRPublisherConfig} object
+ */
+ public static class Builder {
+
+ private String hostName;
+ private Integer portNumber;
+ private String topicName;
+ private String userName;
+ private String userPassword;
+ private String protocol;
+ private String contentType;
+ private int maxBatchSize;
+ private int maxRecoveryQueueSize;
+ private String dmaapUriPathPrefix ;
+
+
+
+ public Builder(@Nonnull String topicName, DmaapConfig dmaapConfig) throws IOException {
+ this.topicName = topicName;
+ this.hostName = dmaapConfig.getDmaaphost();
+ this.portNumber = dmaapConfig.getDEFAULT_PORT_NUMBER();
+ // Default values
+
+ this.userName = dmaapConfig.getDEFAULT_USER_NAME();
+ this.userPassword = dmaapConfig.getDEFAULT_USER_PASSWORD();
+ this.protocol =dmaapConfig.getDEFAULT_PROTOCOL();
+ this.contentType = dmaapConfig.getDEFAULT_CONTENT_TYPE();
+
+ this.maxBatchSize =dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_BATCH_SIZE();
+ this.maxRecoveryQueueSize = dmaapConfig.getPublisherDEFAULT_PUBLISHER_MAX_RECOVERY_QUEUE_SIZE();
+ this.dmaapUriPathPrefix=dmaapConfig.getDMAAP_URI_PATH_PREFIX();
+ }
+
+ /**
+ * Setup for custom host port number - Defaults to 80.
+ *
+ * @param portNumber
+ * custom port number
+ * @return Builder object itself for chaining
+ */
+ public Builder setPortNumber(@Nonnull Integer portNumber) {
+ this.portNumber = portNumber;
+ return this;
+ }
+
+ /**
+ * Setup user name for authentication. If no username is provided authentication
+ * will be disabled
+ *
+ * @param userName
+ * user name for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserName(@Nonnull String userName) {
+ this.userName = userName;
+ return this;
+ }
+
+ /**
+ * Setup user password for authentication. If no password is provided
+ * authentication will be disabled
+ *
+ * @param userPassword
+ * user password for DMaaP Topic Authentication
+ * @return Builder object itself for chaining
+ */
+ public Builder setUserPassword(@Nonnull String userPassword) {
+ this.userPassword = userPassword;
+ return this;
+ }
+
+ /**
+ * Setup custom Publisher protocol - Defaults to https. Note: Only http and
+ * https are currently supported.
+ *
+ * @param protocol
+ * protocol e.g. https
+ * @return Builder object itself for chaining
+ */
+ public Builder setProtocol(@Nonnull String protocol) {
+ this.protocol = normalizeValidateProtocol(protocol);
+ return this;
+ }
+
+ /**
+ * Setup custom Publisher content-type - Defaults to application/json
+ *
+ * @param contentType
+ * content type e.g. application/json
+ * @return Builder object itself for chaining
+ */
+ public Builder setContentType(@Nonnull String contentType) {
+ final String normalizedContentType = normalizeValidateContentType(contentType);
+ this.contentType = normalizedContentType;
+ return this;
+ }
+
+ /**
+ * Setup custom Publisher Max Batch Size - Defaults to 100
+ *
+ * @param maxBatchSize
+ * max Batch Size
+ * @return Builder object itself for chaining
+ */
+ public Builder setMaxBatchSize(int maxBatchSize) {
+ this.maxBatchSize = maxBatchSize;
+ return this;
+ }
+
+ /**
+ * Setup custom Maximum Recovery Queue Size. Recovery Queue is used to hold
+ * messages temporarily in case DMaaP MR Publisher topic is not responding for
+ * any reason. Defaults to 100,000
+ *
+ * @param maxRecoveryQueueSize
+ * max recovery queue size
+ * @return Builder object itself for chaining
+ */
+ public Builder setMaxRecoveryQueueSize(int maxRecoveryQueueSize) {
+ this.maxRecoveryQueueSize = maxRecoveryQueueSize;
+ return this;
+ }
+
+
+ /**
+ * Creates immutable instance of {@link DMaaPMRPublisherConfig}
+ *
+ * @return Builds and returns thread safe, immutable
+ * {@link DMaaPMRPublisherConfig} object
+ */
public DMaaPMRPublisherConfig build() {
return new DMaaPMRPublisherConfig(this);
}
- }
- public String getDmaapUriPathPrefix() {
- return dmaapUriPathPrefix;
- }
-
- /**
- * Returns max Publisher Batch Queue Size
- *
- * @return max Publisher Batch Queue size
- */
- public int getMaxBatchSize() {
- return maxBatchSize;
- }
-
- /**
- * Returns max Publisher Recovery Queue Size
- *
- * @return max Recovery Queue size
- */
- public int getMaxRecoveryQueueSize() {
- return maxRecoveryQueueSize;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- if (!super.equals(o)) {
- return false;
- }
- DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o;
- return maxBatchSize == that.maxBatchSize && maxRecoveryQueueSize == that.maxRecoveryQueueSize;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize);
- }
-
-} \ No newline at end of file
+ }
+ public String getDmaapUriPathPrefix() {
+ return dmaapUriPathPrefix;
+ }
+
+ /**
+ * Returns max Publisher Batch Queue Size
+ *
+ * @return max Publisher Batch Queue size
+ */
+ public int getMaxBatchSize() {
+ return maxBatchSize;
+ }
+
+ /**
+ * Returns max Publisher Recovery Queue Size
+ *
+ * @return max Recovery Queue size
+ */
+ public int getMaxRecoveryQueueSize() {
+ return maxRecoveryQueueSize;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ if (!super.equals(o)) {
+ return false;
+ }
+ DMaaPMRPublisherConfig that = (DMaaPMRPublisherConfig) o;
+ return maxBatchSize == that.maxBatchSize && maxRecoveryQueueSize == that.maxRecoveryQueueSize;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(super.hashCode(), maxBatchSize, maxRecoveryQueueSize);
+ }
+
+}
+
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java
index 495722f..e0b72de 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/configs/DmaapMrBaseConfigTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
+ * 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.
@@ -22,11 +23,18 @@ package org.onap.universalvesadapter.configs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNotEquals;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.universalvesadapter.exception.DMaapException;
+import org.onap.universalvesadapter.utils.DmaapConfig;
+
+import java.io.IOException;
+
public class DmaapMrBaseConfigTest {
DMaaPMRBaseConfig dmaapMrBaseConfig = null;
@@ -75,4 +83,105 @@ public class DmaapMrBaseConfigTest {
assertEquals(JSON_APPLICATION_TYPE,
DMaaPMRBaseConfig.normalizeValidateContentType("application/json"));
}
+
+ @Test
+ public void testDMaaPMRSubscriberConfig() throws IOException {
+ DMaaPMRSubscriberConfig dMaaPMRSubscriberConfig = new DMaaPMRSubscriberConfig(new DMaaPMRSubscriberConfig
+ .Builder("test", new DmaapConfig()));
+ assertNotNull(dMaaPMRSubscriberConfig);
+ String timeout = dMaaPMRSubscriberConfig.getTimeoutMSParam();
+ assertNull(timeout);
+ dMaaPMRSubscriberConfig.setTimeoutMSParam("10");
+ timeout = dMaaPMRSubscriberConfig.getTimeoutMSParam();
+ assertNotNull(timeout);
+ String limitParam = dMaaPMRSubscriberConfig.getMessageLimitParam();
+ assertNull(limitParam);
+ dMaaPMRSubscriberConfig.setMessageLimitParam("test");
+ dMaaPMRSubscriberConfig.setUriPrefix("test");
+ String uriPrefix = dMaaPMRSubscriberConfig.getUriPrefix();
+ assertNotNull(uriPrefix);
+ String consumerId = dMaaPMRSubscriberConfig.getConsumerId();
+ assertNull(consumerId);
+ String consumerGroup = dMaaPMRSubscriberConfig.getConsumerGroup();
+ assertNull(consumerGroup);
+ int timeoutMS = dMaaPMRSubscriberConfig.getTimeoutMS();
+ assertEquals(0, timeoutMS);
+ int messageLimit = dMaaPMRSubscriberConfig.getMessageLimit();
+ assertEquals(0, messageLimit);
+ boolean result = dMaaPMRSubscriberConfig.equals(new Object());
+ assertFalse(result);
+ result = dMaaPMRSubscriberConfig.equals(new DMaaPMRSubscriberConfig(new DMaaPMRSubscriberConfig
+ .Builder("test", new DmaapConfig())));
+ assertTrue(result);
+ int res = dMaaPMRSubscriberConfig.hashCode();
+ assertNotEquals(0, res);
+ }
+
+ @Test
+ public void testDMaaPMRSubscriberConfigBuilder() throws IOException {
+ DMaaPMRSubscriberConfig.Builder builder = new DMaaPMRSubscriberConfig
+ .Builder("test", new DmaapConfig());
+ DMaaPMRSubscriberConfig.Builder builder1 = builder.setPortNumber(1234);
+ assertNotNull(builder1);
+ builder1 = builder.setUserName("john");
+ assertNotNull(builder1);
+ builder1 = builder.setUserPassword("sample");
+ assertNotNull(builder1);
+ builder1 = builder.setProtocol("HTTPS");
+ assertNotNull(builder1);
+ builder1 = builder.setContentType("application/json");
+ assertNotNull(builder1);
+ builder1 = builder.setConsumerId("1234");
+ assertNotNull(builder1);
+ builder1 = builder.setConsumerGroup("consumergroup");
+ assertNotNull(builder1);
+ builder1 = builder.setTimeoutMS(10);
+ assertNotNull(builder1);
+ builder1 = builder.setMessageLimit(10);
+ assertNotNull(builder1);
+ DMaaPMRSubscriberConfig dMaaPMRSubscriberConfig = builder.build();
+ assertNotNull(dMaaPMRSubscriberConfig);
+ }
+
+ @Test
+ public void testDMaaPMRPublisherConfig() throws IOException {
+ DMaaPMRPublisherConfig dMaaPMRPublisherConfig = new DMaaPMRPublisherConfig(new DMaaPMRPublisherConfig
+ .Builder("test", new DmaapConfig()));
+ assertNotNull(dMaaPMRPublisherConfig);
+ String uriPathPrefix = dMaaPMRPublisherConfig.getDmaapUriPathPrefix();
+ assertNull(uriPathPrefix);
+ int maxBatchSize = dMaaPMRPublisherConfig.getMaxBatchSize();
+ assertEquals(0, maxBatchSize);
+ int maxRecoveryQueueSize = dMaaPMRPublisherConfig.getMaxRecoveryQueueSize();
+ assertEquals(0, maxRecoveryQueueSize);
+ boolean result = dMaaPMRPublisherConfig.equals(new Object());
+ assertFalse(result);
+ result = dMaaPMRPublisherConfig.equals(new DMaaPMRPublisherConfig(new DMaaPMRPublisherConfig
+ .Builder("test", new DmaapConfig())));
+ assertTrue(result);
+ int res = dMaaPMRPublisherConfig.hashCode();
+ assertNotEquals(0, res);
+ }
+
+ @Test
+ public void testDMaaPMRPublisherConfigBuilder() throws IOException {
+ DMaaPMRPublisherConfig.Builder builder = new DMaaPMRPublisherConfig
+ .Builder("test", new DmaapConfig());
+ DMaaPMRPublisherConfig.Builder builder1 = builder.setPortNumber(1234);
+ assertNotNull(builder1);
+ builder1 = builder.setUserName("john");
+ assertNotNull(builder1);
+ builder1 = builder.setUserPassword("sample");
+ assertNotNull(builder1);
+ builder1 = builder.setProtocol("HTTPS");
+ assertNotNull(builder1);
+ builder1 = builder.setContentType("application/json");
+ assertNotNull(builder1);
+ builder1 = builder.setMaxBatchSize(10);
+ assertNotNull(builder1);
+ builder1 = builder.setMaxRecoveryQueueSize(10);
+ assertNotNull(builder1);
+ DMaaPMRPublisherConfig dMaaPMRPublisherConfig = builder.build();
+ assertNotNull(dMaaPMRPublisherConfig);
+ }
}
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
index 0000000..0d5a486
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/CreatorTest.java
@@ -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
index 0000000..ac5007a
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherQueueImplTest.java
@@ -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
index 0000000..fbc3ee3
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRPublisher/DMaaPMRPublisherResponseImplTest.java
@@ -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
index 0000000..47ccb3b
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/dmaap/MRSubcriber/DMaaPMRSubscriberImplTest.java
@@ -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
index 0000000..7185954
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/DomainsTest.java
@@ -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
index 0000000..1894562
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/PrioritiesTest.java
@@ -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
index 0000000..ca32b4a
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SeverityTest.java
@@ -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
index 0000000..d25ff13
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/StateTest.java
@@ -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
index 0000000..4ebb91b
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/SysLogSeverityTest.java
@@ -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
index 0000000..dbc3c88
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/TcaAlertActionTest.java
@@ -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
index 0000000..a0e2478
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/domain/VnfStatusTest.java
@@ -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);
+ }
+
+}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java
index 0097658..00ed93a 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/EntryTest.java
@@ -3,6 +3,7 @@
* ONAP : DCAE
* ================================================================================
* Copyright 2018-2019 TechMahindra
+ * 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.
@@ -52,9 +53,8 @@ public class EntryTest {
assertEquals(entry.getAdditionalProperties(), additionalProperties);
assert (entry.toString() != null);
assert (entry.hashCode() != 0);
-
+ assert (!entry.equals(null));
assert (entry.equals(entry));
-
}
}
diff --git a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java
index a9cf2b0..7c3c170 100644
--- a/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/mappingconfig/MapperConfigTest.java
@@ -3,6 +3,7 @@
* ONAP : DCAE
* ================================================================================
* Copyright 2018-2019 TechMahindra
+ * 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.
@@ -47,7 +48,7 @@ public class MapperConfigTest {
assertEquals(mapperConfig.getEntries(), entries);
assert (mapperConfig.toString() != null);
assert (mapperConfig.hashCode() != 0);
-
+ assert (!mapperConfig.equals(null));
assert (mapperConfig.equals(mapperConfig));
}
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
index 0000000..5aac110
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/service/VESAdapterInitializerTest.java
@@ -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
index 0000000..2d8d860
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/CollectorConfigPropertyRetrievalTest.java
@@ -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
index 0000000..ab6765b
--- /dev/null
+++ b/UniversalVesAdapter/src/test/java/org/onap/universalvesadapter/utils/DmaapConfigTest.java
@@ -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);
+ }
+}
diff --git a/version.properties b/version.properties
index e21ebcd..b0c0f62 100755
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=1
minor=4
-patch=1
+patch=2
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT