From ebaab76841e7c7cfee0143e6c40c6e1ae3204309 Mon Sep 17 00:00:00 2001 From: Mukesh Paliwal Date: Tue, 24 May 2022 10:30:48 +0530 Subject: [PATCH] CodeCoverage improvement for dcaegen2-analytics-tca-gen2 Issue-ID: DCAEGEN2-3159 Signed-off-by: Mukesh Paliwal Change-Id: I0aaae42e30a83eac41957114a3090d584b43d42a --- ChangeLog.md | 3 + .../dcae/analytics/model/DmaapMrConstantsTest.java | 33 +++++ .../model/ecomplogger/AnalyticsErrorTypeTest.java | 34 ++++++ .../util/function/JsonStringToMapFunctionTest.java | 65 ++++++++++ .../function/JsonToJavaObjectBiFunctionTest.java | 48 ++++++++ .../util/function/StringToURLFunctionTest.java | 42 +++++++ .../util/function/URLToHttpGetFunctionTest.java | 40 ++++++ .../util/json/mixin/cef/AlertTypeMixinTest.java | 13 +- .../model/util/json/mixin/cef/CriticalityTest.java | 34 ++++++ .../util/json/mixin/common/ConfigSourceTest.java | 35 ++++++ .../supplier/AnalyticsRequestIdSupplierTest.java | 33 +++++ .../supplier/CreationTimestampSupplierTest.java | 41 +++++++ .../model/util/supplier/RandomIdSupplierTest.java | 32 +++++ .../model/util/supplier/UnboundedSupplierTest.java | 61 ++++++++++ .../web/config/AnalyticsWebTestConfig.java | 25 ++-- .../analytics/web/config/DmaapMrTestConfig.java | 134 +++++++++++++++------ .../web/config/DmaapPollerTestConfig.java | 92 ++++++++++++++ .../analytics/web/config/DmaapRetryTestConfig.java | 104 ++++++++++++++++ .../web/config/MessageStoreTestConfig.java | 44 +++++++ .../web/dmaap/MrPublisherPreferencesTest.java | 44 +++++++ .../web/dmaap/MrSubscriberPollingAdviceTest.java | 39 ++++++ .../web/dmaap/MrSubscriberPreferencesTest.java | 67 +++++++++++ .../AnalyticsValidationExceptionTest.java | 39 ++++++ .../analytics/web/util/AnalyticsHttpUtilsTest.java | 78 ++++++++++++ .../analytics/web/util/AnalyticsWebUtilsTest.java | 40 ++++++ .../analytics/web/util/ValidationUtilsTest.java | 38 ++++++ .../validation/GenericValidationResponseTest.java | 7 +- dcae-analytics/version.properties | 3 +- eelf-logger/version.properties | 7 +- pom.xml | 3 +- version.properties | 3 +- 31 files changed, 1218 insertions(+), 63 deletions(-) create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/DmaapMrConstantsTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/ecomplogger/AnalyticsErrorTypeTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonStringToMapFunctionTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonToJavaObjectBiFunctionTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/StringToURLFunctionTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/URLToHttpGetFunctionTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/CriticalityTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/common/ConfigSourceTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/AnalyticsRequestIdSupplierTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/CreationTimestampSupplierTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/RandomIdSupplierTest.java create mode 100644 dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/UnboundedSupplierTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapPollerTestConfig.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapRetryTestConfig.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/MessageStoreTestConfig.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrPublisherPreferencesTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdviceTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPreferencesTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/exception/AnalyticsValidationExceptionTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsHttpUtilsTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsWebUtilsTest.java create mode 100644 dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/ValidationUtilsTest.java diff --git a/ChangeLog.md b/ChangeLog.md index 16c0b71..22e1077 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -4,5 +4,8 @@ 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.3.3] - 2022/05/24 + - [DCAEGEN2-3159](https://jira.onap.org/browse/DCAEGEN2-3159) - CodeCoverage improvement for dcaegen2-analytics-tca-gen2 + ## [1.3.2] - 2022/02/21 - [DCAEGEN2-3042](https://jira.onap.org/browse/DCAEGEN2-3042) - Remove security vulnerabilities diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/DmaapMrConstantsTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/DmaapMrConstantsTest.java new file mode 100644 index 0000000..2410eca --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/DmaapMrConstantsTest.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model; + +import org.junit.jupiter.api.Test; + +import java.util.Set; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class DmaapMrConstantsTest { + @Test + public void DmaapHeadersTest () throws Exception { + Set dmaapConstatnts = DmaapMrConstants.getDmaapmappedHeaders(); + assertEquals("X-RequestID", dmaapConstatnts.iterator().next()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/ecomplogger/AnalyticsErrorTypeTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/ecomplogger/AnalyticsErrorTypeTest.java new file mode 100644 index 0000000..157a447 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/ecomplogger/AnalyticsErrorTypeTest.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.ecomplogger; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class AnalyticsErrorTypeTest { + @Test + public void getErrorCodeTest () throws Exception { + AnalyticsErrorType analyticsErrorType = AnalyticsErrorType.SCHEMA_ERROR; + int errCode = analyticsErrorType.getErrorCode(); + String errDesc = analyticsErrorType.getErrorDescription(); + assertEquals(400, errCode); + assertEquals("Schema Error", errDesc); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonStringToMapFunctionTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonStringToMapFunctionTest.java new file mode 100644 index 0000000..b2b75b6 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonStringToMapFunctionTest.java @@ -0,0 +1,65 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.function; + +import org.junit.jupiter.api.Test; + +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class JsonStringToMapFunctionTest { + @Test + public void applyTest() throws Exception { + JsonStringToMapFunction jsonStringToMapFunction = new JsonStringToMapFunction(); + Map jObj = jsonStringToMapFunction.apply("{\"name\":\"test\",\"company\":\"test123\"}"); + assertEquals("test", jObj.get("name")); + } + + @Test + public void applyTestObject() throws Exception { + JsonStringToMapFunction jsonStringToMapFunction = new JsonStringToMapFunction(); + Map jObj = jsonStringToMapFunction. + apply("{\"name\":\"test\",\"company\":\"test123\",\"testObj\":{\"status\":\"true\"}}"); + assertEquals("test", jObj.get("name")); + } + + @Test + public void applyTestArray() throws Exception { + JsonStringToMapFunction jsonStringToMapFunction = new JsonStringToMapFunction(); + Map jObj = jsonStringToMapFunction. + apply("{\"name\":\"test\",\"company\":\"test123\",\"testObj\":[{\"status\":\"true\"}]}"); + assertEquals("test", jObj.get("name")); + } + + @Test + public void applyTest1() throws Exception { + JsonStringToMapFunction jsonStringToMapFunction = new JsonStringToMapFunction("abc"); + Map jObj = jsonStringToMapFunction.apply("{\"name\":\"test\",\"company\":\"test123\"}"); + assertEquals("test", jObj.get("abc.name")); + } + + @Test + public void applyTest2() throws Exception { + JsonStringToMapFunction jsonStringToMapFunction = new JsonStringToMapFunction("xyz", "|"); + Map jObj = jsonStringToMapFunction.apply("{\"name\":\"test\",\"company\":\"test123\"}"); + assertEquals("test123", jObj.get("xyz|company")); + } + +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonToJavaObjectBiFunctionTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonToJavaObjectBiFunctionTest.java new file mode 100644 index 0000000..6d4452d --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/JsonToJavaObjectBiFunctionTest.java @@ -0,0 +1,48 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.function; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; + +import java.util.Map; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class JsonToJavaObjectBiFunctionTest { + @Test + public void apply () throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + JsonToJavaObjectBiFunction jsonToJavaObjectBiFunction = new JsonToJavaObjectBiFunction(objectMapper); + TypeReference stringTypeRef = new TypeReference(){}; + Optional optional = jsonToJavaObjectBiFunction.apply(stringTypeRef, "{\"name\":\"test\",\"company\":\"test123\"}"); + assertTrue(optional.isPresent()); + } + + @Test + public void applyError () throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + JsonToJavaObjectBiFunction jsonToJavaObjectBiFunction = new JsonToJavaObjectBiFunction(objectMapper); + TypeReference stringTypeRef = new TypeReference(){}; + Optional optional = jsonToJavaObjectBiFunction.apply(stringTypeRef, "{\"name\":\"test\",\"company\":\"test123\"}"); + assertTrue(optional.isEmpty()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/StringToURLFunctionTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/StringToURLFunctionTest.java new file mode 100644 index 0000000..11fdb37 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/StringToURLFunctionTest.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.function; + +import org.junit.jupiter.api.Test; + +import java.net.URL; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class StringToURLFunctionTest { + @Test + public void apply () throws Exception { + StringToURLFunction stringToURLFunction = new StringToURLFunction (); + Optional optionalURL = stringToURLFunction.apply("https://localhost:8080/test"); + assertTrue(optionalURL.isPresent()); + } + + @Test + public void applyException () throws Exception { + StringToURLFunction stringToURLFunction = new StringToURLFunction (); + Optional optionalURL = stringToURLFunction.apply(""); + assertTrue(optionalURL.isEmpty()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/URLToHttpGetFunctionTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/URLToHttpGetFunctionTest.java new file mode 100644 index 0000000..13a17f5 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/function/URLToHttpGetFunctionTest.java @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.function; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.Optional; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class URLToHttpGetFunctionTest { + @Test + public void apply () throws Exception { + URL url = new URL("http://localhost:8080"); + URLToHttpGetFunction urlToHttpGetFunction = new URLToHttpGetFunction(); + HttpURLConnection httpURLConnection = Mockito.mock(HttpURLConnection.class); + Mockito.when(httpURLConnection.getResponseCode()).thenReturn(200); + Optional optional = urlToHttpGetFunction.apply(url); + assertTrue(optional.isEmpty()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/AlertTypeMixinTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/AlertTypeMixinTest.java index d3368de..ab19775 100644 --- a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/AlertTypeMixinTest.java +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/AlertTypeMixinTest.java @@ -1,6 +1,7 @@ /* - * ================================================================================ + * ============LICENSE_START======================================================= * Copyright (c) 2018 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. @@ -19,6 +20,7 @@ package org.onap.dcae.analytics.model.util.json.mixin.cef; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.onap.dcae.analytics.model.util.json.AnalyticsModelJsonConversion.ANALYTICS_MODEL_OBJECT_MAPPER; import org.assertj.core.api.Assertions; @@ -51,4 +53,13 @@ class AlertTypeMixinTest extends BaseAnalyticsModelTest { .isEqualTo(AlertType.CARD_ANOMALY); } + @Test + public void forvalueTest() throws Exception { + assertEquals(AlertType.CARD_ANOMALY, AlertTypeMixin.forValue("CARD-ANOMALY")); + assertEquals(AlertType.ELEMENT_ANOMALY, AlertTypeMixin.forValue("ELEMENT-ANOMALY")); + assertEquals(AlertType.INTERFACE_ANOMALY, AlertTypeMixin.forValue("INTERFACE-ANOMALY")); + assertEquals(AlertType.SERVICE_ANOMALY, AlertTypeMixin.forValue("SERVICE-ANOMALY")); + assertEquals(AlertType.UNKNOWN, AlertTypeMixin.forValue("UNKNOWN")); + } + } diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/CriticalityTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/CriticalityTest.java new file mode 100644 index 0000000..1defec7 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/cef/CriticalityTest.java @@ -0,0 +1,34 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.json.mixin.cef; + +import org.junit.jupiter.api.Test; +import org.onap.dcae.analytics.model.cef.Criticality; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class CriticalityTest { + + @Test + public void testCriticality () throws Exception { + assertEquals("UNKNOWN", Criticality.UNKNOWN.toString()); + assertEquals("MAJ", Criticality.MAJ.toString()); + assertEquals("CRIT", Criticality.CRIT.toString()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/common/ConfigSourceTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/common/ConfigSourceTest.java new file mode 100644 index 0000000..4051ca5 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/json/mixin/common/ConfigSourceTest.java @@ -0,0 +1,35 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.json.mixin.common; + +import org.junit.jupiter.api.Test; +import org.onap.dcae.analytics.model.common.ConfigSource; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ConfigSourceTest { + @Test + public void testConfigSource () throws Exception { + assertEquals("CONFIG_BINDING_SERVICE", ConfigSource.CONFIG_BINDING_SERVICE.toString()); + assertEquals("CLASSPATH", ConfigSource.CLASSPATH.toString()); + assertEquals("MONGO", ConfigSource.MONGO.toString()); + assertEquals("REDIS", ConfigSource.REDIS.toString()); + assertEquals("REST_API", ConfigSource.REST_API.toString()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/AnalyticsRequestIdSupplierTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/AnalyticsRequestIdSupplierTest.java new file mode 100644 index 0000000..ce278d7 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/AnalyticsRequestIdSupplierTest.java @@ -0,0 +1,33 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.supplier; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class AnalyticsRequestIdSupplierTest { + @Test + public void getTest () throws Exception { + AnalyticsRequestIdSupplier analyticsRequestIdSupplier = + new AnalyticsRequestIdSupplier(); + String str = analyticsRequestIdSupplier.get(); + assertNotNull(str); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/CreationTimestampSupplierTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/CreationTimestampSupplierTest.java new file mode 100644 index 0000000..17134a5 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/CreationTimestampSupplierTest.java @@ -0,0 +1,41 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.supplier; + +import org.junit.jupiter.api.Test; + +import java.util.Date; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class CreationTimestampSupplierTest { + @Test + public void getTest () throws Exception { + CreationTimestampSupplier creationTimestampSupplier = + new CreationTimestampSupplier(); + String str = creationTimestampSupplier.get(); + assertNotNull(str); + } + + @Test + public void getParsedDateTest () throws Exception { + Date date = CreationTimestampSupplier.getParsedDate("2020-08-24T21:49:31.702+0400"); + assertNotNull(date.getTime()); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/RandomIdSupplierTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/RandomIdSupplierTest.java new file mode 100644 index 0000000..6805978 --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/RandomIdSupplierTest.java @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.supplier; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class RandomIdSupplierTest { + @Test + public void getTest () throws Exception { + RandomIdSupplier randomIdSupplier = new RandomIdSupplier(100); + String maxNumber = randomIdSupplier.get(); + assertNotNull(maxNumber); + } +} diff --git a/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/UnboundedSupplierTest.java b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/UnboundedSupplierTest.java new file mode 100644 index 0000000..6b1fe7d --- /dev/null +++ b/dcae-analytics/dcae-analytics-model/src/test/java/org/onap/dcae/analytics/model/util/supplier/UnboundedSupplierTest.java @@ -0,0 +1,61 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.model.util.supplier; + +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class UnboundedSupplierTest { + @Test + public void getTest () throws Exception { + Map str = new HashMap(); + str.put("name", "test"); + Map str2 = new HashMap(); + str2.put("name1", "test1"); + UnboundedSupplier unboundedSupplier = + new UnboundedSupplier(UnboundedSupplier.GenerationMode.ROUND_ROBIN, str, str2); + String s = unboundedSupplier.get().toString(); + assertTrue(unboundedSupplier.get().toString().contains("test")); + } + + @Test + public void getRandomTest () throws Exception { + Map str = new HashMap(); + str.put("name", "test"); + Map str2 = new HashMap(); + str2.put("name1", "test1"); + UnboundedSupplier unboundedSupplier = + new UnboundedSupplier(UnboundedSupplier.GenerationMode.RANDOM, str, str2); + String s = unboundedSupplier.get().toString(); + assertTrue(unboundedSupplier.get().toString().contains("test")); + } + + @Test + public void getTest1 () throws Exception { + Map str = new HashMap(); + str.put("name", "test"); + UnboundedSupplier unboundedSupplier = + new UnboundedSupplier(str); + assertTrue(unboundedSupplier.get().toString().contains("test")); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/AnalyticsWebTestConfig.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/AnalyticsWebTestConfig.java index b80be2c..b9a06a8 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/AnalyticsWebTestConfig.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/AnalyticsWebTestConfig.java @@ -1,6 +1,7 @@ /* - * ================================================================================ + * ============LICENSE_START======================================================= * Copyright (c) 2018 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. @@ -19,25 +20,15 @@ package org.onap.dcae.analytics.web.config; -import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; -import org.onap.dcae.analytics.model.util.json.AnalyticsModelJsonConversion; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; +import static org.junit.jupiter.api.Assertions.assertNotNull; -/** - * @author Rajiv Singla - */ -@Configuration -@EnableAutoConfiguration -@Import(value = {AnalyticsWebConfig.class, DmaapMrTestConfig.class}) public class AnalyticsWebTestConfig { - @Bean - public ObjectMapper objectMapper() { - return AnalyticsModelJsonConversion.ANALYTICS_MODEL_OBJECT_MAPPER; + @Test + public void AnalyticsWebTestConfigTest () throws Exception { + AnalyticsWebConfig analyticsWebConfig = new AnalyticsWebConfig(); + assertNotNull(analyticsWebConfig); } - } diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapMrTestConfig.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapMrTestConfig.java index 9e884ea..deb8642 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapMrTestConfig.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapMrTestConfig.java @@ -1,6 +1,7 @@ /* - * ================================================================================ + * ============LICENSE_START======================================================= * Copyright (c) 2018 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. @@ -19,55 +20,116 @@ package org.onap.dcae.analytics.web.config; -import org.onap.dcae.analytics.model.AnalyticsProfile; -import org.onap.dcae.analytics.web.BaseAnalyticsWebSpringBootIT; -import org.onap.dcae.analytics.web.dmaap.MrPublisherPreferences; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingPreferences; import org.onap.dcae.analytics.web.dmaap.MrSubscriberPreferences; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; +import org.onap.dcae.analytics.web.dmaap.MrTriggerMessageProvider; +import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingAdvice; +import org.onap.dcae.analytics.web.dmaap.MrMessageSplitter; +import org.onap.dcae.analytics.web.dmaap.MrPublisherPreferences; +import org.springframework.http.HttpHeaders; import org.springframework.integration.channel.DirectChannel; import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.core.MessageSource; import org.springframework.integration.dsl.IntegrationFlow; -import org.springframework.integration.dsl.IntegrationFlows; -import org.springframework.integration.handler.LoggingHandler; +import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice; +import org.springframework.integration.scheduling.PollerMetadata; +import org.springframework.integration.store.BasicMessageGroupStore; +import org.springframework.web.client.RestTemplate; + +import java.net.URL; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; -/** - * @author Rajiv Singla - */ -@Configuration -@Profile({AnalyticsProfile.DMAAP_PROFILE_NAME}) public class DmaapMrTestConfig { - @Bean - public MrSubscriberPreferences mrSubscriberPreferences() { - return new MrSubscriberPreferences(BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_TOPIC_URL, null, - null, BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_AAF_USERNAME, - BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_AAF_PASSWORD, - null, null, null, - BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_CONSUMER_GROUP, - BaseAnalyticsWebSpringBootIT.TEST_SUBSCRIBER_CONSUMER_IDS, - null, null, null); + @Test + public void mrPublisherInputChannelTest () throws Exception { + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + DirectChannel directChannel = dmaapMrConfig.mrPublisherInputChannel(); + assertNotNull(directChannel); } - @Bean - public MrPublisherPreferences mrPublisherPreferences() { - return new MrPublisherPreferences(BaseAnalyticsWebSpringBootIT.TEST_PUBLISHER_TOPIC_URL); + @Test + public void mrTriggerMessageProviderTest () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1"), + new Integer(4), new Integer(3), pollingPreferences); + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + MrTriggerMessageProvider mrTriggerMessageProvider = dmaapMrConfig.mrTriggerMessageProvider(subscriberPreferences); + assertEquals("getTriggerMessage", mrTriggerMessageProvider.TRIGGER_METHOD_NAME); + assertEquals("http://localhost:8080/TestGroup/TestId1?limit=4&timeout=3", + mrTriggerMessageProvider.getTriggerMessage().getPayload()); } - @Bean - public Integer processingBatchSize() { - return 1; + @Test + public void mrMessageSourceTest () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), pollingPreferences); + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + MrTriggerMessageProvider mrTriggerMessageProvider = dmaapMrConfig.mrTriggerMessageProvider(subscriberPreferences); + MessageSource messageSource = dmaapMrConfig.mrMessageSource(mrTriggerMessageProvider); + assertEquals("inbound_channel_adapter", messageSource.getIntegrationPatternType().name()); } + @Test + public void mrSubscriberOutputChannelTest () throws Exception { + BasicMessageGroupStore basicMessageGroupStore = Mockito.mock(BasicMessageGroupStore.class); + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + QueueChannel queueChannel = dmaapMrConfig.mrSubscriberOutputChannel(basicMessageGroupStore); + assertTrue(queueChannel.getRemainingCapacity() > 0); + } - @Bean - public IntegrationFlow noOperationMrFlow(final QueueChannel mrSubscriberOutputChannel, - final DirectChannel mrPublisherInputChannel) { - return IntegrationFlows.from(mrSubscriberOutputChannel) - .log(LoggingHandler.Level.INFO) - .channel(mrPublisherInputChannel) - .get(); + @Test + public void mrSubscriberFlowTest () throws Exception { + PollerMetadata pollerMetadata = Mockito.mock(PollerMetadata.class); + QueueChannel queueChannel = Mockito.mock(QueueChannel.class); + RestTemplate restTemplate = Mockito.mock(RestTemplate.class); + MessageSource messageSource = Mockito.mock(MessageSource.class); + MrMessageSplitter mrMessageSplitter = Mockito.mock(MrMessageSplitter.class); + MrSubscriberPollingAdvice mrSubscriberPollingAdvice = Mockito.mock(MrSubscriberPollingAdvice.class); + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + IntegrationFlow integratedFlow = dmaapMrConfig.mrSubscriberFlow(pollerMetadata,restTemplate,messageSource,queueChannel, mrMessageSplitter, mrSubscriberPollingAdvice); + assertNotNull(integratedFlow.getInputChannel()); } + @Test + public void mrPublisherFlowTest () throws Exception { + RequestHandlerRetryAdvice requestHandlerRetryAdvice = Mockito.mock(RequestHandlerRetryAdvice.class); + DirectChannel directChannel = Mockito.mock(DirectChannel.class); + RestTemplate restTemplate = Mockito.mock(RestTemplate.class); + MrPublisherPreferences mrPublisherPreferences = Mockito.mock(MrPublisherPreferences.class); + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + IntegrationFlow integratedFlow = dmaapMrConfig.mrPublisherFlow(mrPublisherPreferences,restTemplate,directChannel,requestHandlerRetryAdvice); + assertNotNull(integratedFlow.getInputChannel()); + } + + @Test + public void mrMessageSplitterTest () throws Exception { + ObjectMapper objectMapper = new ObjectMapper(); + int processingBatchSize = 100; + DmaapMrConfig dmaapMrConfig = new DmaapMrConfig(); + MrMessageSplitter mrMessageSplitter = dmaapMrConfig.mrMessageSplitter(objectMapper, processingBatchSize); + assertNotNull(mrMessageSplitter); + } } diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapPollerTestConfig.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapPollerTestConfig.java new file mode 100644 index 0000000..d7bebb8 --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapPollerTestConfig.java @@ -0,0 +1,92 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.config; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingAdvice; +import org.onap.dcae.analytics.web.dmaap.MrSubscriberPollingPreferences; +import org.onap.dcae.analytics.web.dmaap.MrSubscriberPreferences; +import org.springframework.http.HttpHeaders; +import org.springframework.integration.scheduling.PollerMetadata; +import org.springframework.integration.util.DynamicPeriodicTrigger; + +import java.net.URL; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class DmaapPollerTestConfig { + + @Test + public void mrSubscriberPollingAdviceTest () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), pollingPreferences); + + DmaapPollerConfig dmaapPollerConfig = new DmaapPollerConfig(); + DynamicPeriodicTrigger dynamicPeriodicTrigger = new DynamicPeriodicTrigger(1L); + MrSubscriberPollingAdvice mrSubscriberPollingAdvice = dmaapPollerConfig.mrSubscriberPollingAdvice( + dynamicPeriodicTrigger, subscriberPreferences); + assertNotNull(mrSubscriberPollingAdvice); + } + + @Test + public void dynamicPeriodicTriggerTest () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), pollingPreferences); + + DmaapPollerConfig dmaapPollerConfig = new DmaapPollerConfig(); + DynamicPeriodicTrigger dynamicPeriodicTrigger = dmaapPollerConfig.dynamicPeriodicTrigger(subscriberPreferences); + assertTrue(dynamicPeriodicTrigger.isFixedRate()); + } + + @Test + public void pollerMetadataTest () throws Exception { + DmaapPollerConfig dmaapPollerConfig = new DmaapPollerConfig(); + DynamicPeriodicTrigger dynamicPeriodicTrigger = new DynamicPeriodicTrigger(60000); + PollerMetadata pollerMetadata = dmaapPollerConfig.pollerMetadata(dynamicPeriodicTrigger); + assertNotNull(pollerMetadata); + } + + @Test + public void defaultPollerTest () throws Exception { + DmaapPollerConfig dmaapPollerConfig = new DmaapPollerConfig(); + PollerMetadata pollerMetadata = dmaapPollerConfig.defaultPoller(); + assertNotNull(pollerMetadata); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapRetryTestConfig.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapRetryTestConfig.java new file mode 100644 index 0000000..322053c --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/DmaapRetryTestConfig.java @@ -0,0 +1,104 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.config; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.integration.channel.QueueChannel; +import org.springframework.integration.dsl.IntegrationFlow; +import org.springframework.integration.handler.advice.ErrorMessageSendingRecoverer; +import org.springframework.integration.handler.advice.RequestHandlerRetryAdvice; +import org.springframework.integration.store.BasicMessageGroupStore; +import org.springframework.messaging.PollableChannel; +import org.springframework.retry.RetryPolicy; +import org.springframework.retry.backoff.BackOffPolicy; +import org.springframework.retry.support.RetryTemplate; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class DmaapRetryTestConfig { + + @Test + public void errorChannelTest () throws Exception { + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + QueueChannel queueChannel = dmaapRetryConfig.errorChannel(); + assertNotNull(queueChannel); + } + + @Test + public void errorMessageSendingRecovererTest () throws Exception { + PollableChannel pollableChannel = Mockito.mock(PollableChannel.class); + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + ErrorMessageSendingRecoverer errorMessageSendingRecoverer = + dmaapRetryConfig.errorMessageSendingRecoverer(pollableChannel); + Throwable throwable = new Throwable("test"); + assertEquals("test", errorMessageSendingRecoverer.getErrorMessageStrategy() + .buildErrorMessage(throwable, null).getPayload().getMessage()); + } + + @Test + public void recoveryChannelTest () throws Exception { + BasicMessageGroupStore basicMessageGroupStore = Mockito.mock(BasicMessageGroupStore.class); + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + PollableChannel pollableChannel = dmaapRetryConfig.recoveryChannel(basicMessageGroupStore); + assertNotNull(pollableChannel); + } + + @Test + public void requestHandlerRetryAdviceTest () throws Exception { + RetryTemplate retryTemplate = Mockito.mock(RetryTemplate.class); + ErrorMessageSendingRecoverer errorMessageSendingRecoverer = Mockito.mock(ErrorMessageSendingRecoverer.class); + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + RequestHandlerRetryAdvice requestHandlerRetryAdvice = dmaapRetryConfig.requestHandlerRetryAdvice(retryTemplate, + errorMessageSendingRecoverer); + assertNotNull(requestHandlerRetryAdvice); + } + + @Test + public void retryTemplateTest () throws Exception { + RetryPolicy retryPolicy = Mockito.mock(RetryPolicy.class); + BackOffPolicy backOffPolicy = Mockito.mock(BackOffPolicy.class); + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + RetryTemplate retryTemplate = dmaapRetryConfig.retryTemplate(retryPolicy, backOffPolicy); + assertNotNull(retryTemplate); + } + + @Test + public void retryPolicyTest () throws Exception { + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + RetryPolicy retryPolicy = dmaapRetryConfig.retryPolicy(); + assertNotNull(retryPolicy); + } + + @Test + public void backoffPolicyTest () throws Exception { + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + BackOffPolicy backOffPolicy = dmaapRetryConfig.backOffPolicy(); + assertNotNull(backOffPolicy); + } + + @Test + public void loggingFlowTest () throws Exception { + DmaapRetryConfig dmaapRetryConfig = new DmaapRetryConfig(); + IntegrationFlow integrationFlow = dmaapRetryConfig.loggingFlow(); + assertNotNull(integrationFlow); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/MessageStoreTestConfig.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/MessageStoreTestConfig.java new file mode 100644 index 0000000..6510805 --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/config/MessageStoreTestConfig.java @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.config; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.data.mongodb.MongoDatabaseFactory; +import org.springframework.integration.store.BasicMessageGroupStore; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class MessageStoreTestConfig { + @Test + public void simpleMessageGroupStoreTest () { + MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); + BasicMessageGroupStore basicMessageGroupStore = messageStoreConfig.simpleMessageGroupStore(); + assertNotNull(basicMessageGroupStore); + } + + @Test + public void mongoMessageGroupStoreTest () { + MessageStoreConfig messageStoreConfig = new MessageStoreConfig(); + MongoDatabaseFactory mongoDatabaseFactory = Mockito.mock(MongoDatabaseFactory.class); + BasicMessageGroupStore basicMessageGroupStore = messageStoreConfig.mongoMessageGroupStore(mongoDatabaseFactory); + assertNotNull(basicMessageGroupStore); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrPublisherPreferencesTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrPublisherPreferencesTest.java new file mode 100644 index 0000000..8cd6a9b --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrPublisherPreferencesTest.java @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.dmaap; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.http.HttpHeaders; + +import java.net.URL; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class MrPublisherPreferencesTest { + + @Test + public void mrPublisherPreferencesTest () throws Exception { + URL url = new URL("http", "8088", "test"); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrPublisherPreferences mrPublisherPreferences = + new MrPublisherPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + url, false, false); + assertEquals("TestClientId", mrPublisherPreferences.getHttpClientId()); + + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdviceTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdviceTest.java new file mode 100644 index 0000000..d9a0cef --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPollingAdviceTest.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.dmaap; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice; +import org.springframework.integration.util.DynamicPeriodicTrigger; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class MrSubscriberPollingAdviceTest { + + @Test + public void mrSubscriberPollingAdviceTest () throws Exception { + DynamicPeriodicTrigger dynamicPeriodicTrigger = Mockito.mock(DynamicPeriodicTrigger.class); + MrSubscriberPollingAdvice mrSubscriberPollingAdvice = + new MrSubscriberPollingAdvice(dynamicPeriodicTrigger,30000, 0, + 30000, 0); + assertNotNull(mrSubscriberPollingAdvice); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPreferencesTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPreferencesTest.java new file mode 100644 index 0000000..931f20c --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/dmaap/MrSubscriberPreferencesTest.java @@ -0,0 +1,67 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.dmaap; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.http.HttpHeaders; + +import java.net.URL; +import java.util.Arrays; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class MrSubscriberPreferencesTest { + + @Test + public void mrSubscriberPollingPreferencesTest () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), pollingPreferences); + + MrSubscriberPollingPreferences mrSubscriberPollingPreferences = subscriberPreferences.getPollingPreferences(); + assertNotNull(mrSubscriberPollingPreferences); + } + + @Test + public void mrSubscriberPollingPreferences1Test () throws Exception { + URL proxyURL = new URL("http://localhost"); + MrSubscriberPollingPreferences pollingPreferences = Mockito.mock(MrSubscriberPollingPreferences.class); + HttpHeaders headers = Mockito.mock(HttpHeaders.class); + MrSubscriberPreferences subscriberPreferences = + new MrSubscriberPreferences("http://localhost:8080", + "TestClientId", headers, + "TestUserName", "TestPassword", + proxyURL, true, false, "TestGroup", + Arrays.asList("TestId1", "TestId2"), + new Integer(4), new Integer(3), null); + + MrSubscriberPollingPreferences mrSubscriberPollingPreferences = subscriberPreferences.getPollingPreferences(); + assertNotNull(mrSubscriberPollingPreferences); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/exception/AnalyticsValidationExceptionTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/exception/AnalyticsValidationExceptionTest.java new file mode 100644 index 0000000..f019d2a --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/exception/AnalyticsValidationExceptionTest.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.exception; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class AnalyticsValidationExceptionTest { + + @Test + public void AnalyticsValidationExceptionTst() throws Exception { + AnalyticsValidationException analyticsValidationException = new AnalyticsValidationException("Exception", + null); + assertEquals("Exception", analyticsValidationException.getMessage()); + } + + @Test + public void EnvironmentLoaderExceptionTst() throws Exception { + EnvironmentLoaderException environmentLoaderException = new EnvironmentLoaderException("Exception"); + assertEquals("Exception", environmentLoaderException.getMessage()); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsHttpUtilsTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsHttpUtilsTest.java new file mode 100644 index 0000000..d20cd65 --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsHttpUtilsTest.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.util; + +import org.junit.jupiter.api.Test; +import org.springframework.http.HttpHeaders; +import org.springframework.messaging.MessageHeaders; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class AnalyticsHttpUtilsTest { + + @Test + public void createDefaultHttpHeadersTest () throws Exception { + HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders(); + httpHeaders.set("X-TransactionID", "transactionID"); + String transactionId = AnalyticsHttpUtils.getTransactionId(httpHeaders); + assertEquals("transactionID", transactionId); + } + + @Test + public void createDefaultHttpHeadersRequestIDTest () throws Exception { + HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders("requestID"); + String requestId = AnalyticsHttpUtils.getRequestId(httpHeaders); + assertEquals("requestID", requestId); + } + + @Test + public void createDefaultHttpHeadersTransactionIDTest () throws Exception { + HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders(); + httpHeaders.set("X-TransactionID", "transactionID"); + String requestId = AnalyticsHttpUtils.getTransactionId(httpHeaders); + assertEquals("transactionID", requestId); + } + + @Test + public void getTransactionIdTest () throws Exception { + MessageHeaders httpHeaders = new MessageHeaders(null); + String transactionId = AnalyticsHttpUtils.getTransactionId(httpHeaders); + assertEquals("UNKNOWN-TRANSACTION_ID", transactionId); + } + + @Test + public void getRequestIdTest () throws Exception { + MessageHeaders httpHeaders = new MessageHeaders(null); + String requestId = AnalyticsHttpUtils.getRequestId(httpHeaders); + assertEquals("UNKNOWN-REQUEST_ID", requestId); + } + + @Test + public void getTimestampFromHeadersTest () throws Exception { + Map headers = new HashMap(); + Date dt = AnalyticsHttpUtils.getTimestampFromHeaders(headers, null); + assertNotNull(dt); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsWebUtilsTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsWebUtilsTest.java new file mode 100644 index 0000000..49f00b0 --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsWebUtilsTest.java @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.util; + +import org.junit.jupiter.api.Test; + +import java.util.function.Supplier; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class AnalyticsWebUtilsTest { + + @Test + public void AnalyticsWebUtilsTst () throws Exception { + Supplier creationTimestampSupplier = AnalyticsWebUtils.CREATION_TIMESTAMP_SUPPLIER; + Supplier randomIdSupplier = AnalyticsWebUtils.RANDOM_ID_SUPPLIER; + Supplier requestIdSupplier = AnalyticsWebUtils.REQUEST_ID_SUPPLIER; + assertNotNull(creationTimestampSupplier); + assertNotNull(randomIdSupplier.toString()); + assertNotNull(requestIdSupplier); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/ValidationUtilsTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/ValidationUtilsTest.java new file mode 100644 index 0000000..0cac996 --- /dev/null +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/ValidationUtilsTest.java @@ -0,0 +1,38 @@ +/* + * ============LICENSE_START======================================================= + * 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.dcae.analytics.web.util; + +import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class ValidationUtilsTest { + + @Test + public void isEmptyTest() throws Exception { + boolean isEmpty = ValidationUtils.isEmpty("Test"); + assertEquals(false, isEmpty); + } + + @Test + public void isPresentTest() throws Exception { + boolean isPresent = ValidationUtils.isPresent("Test"); + assertEquals(true, isPresent); + } +} diff --git a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java index 1f790dd..4ec7062 100644 --- a/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java +++ b/dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/validation/GenericValidationResponseTest.java @@ -1,8 +1,8 @@ /* - * ================================================================================ + * ============LICENSE_START======================================================= * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ * Copyright Copyright (c) 2019 IBM + * 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. @@ -50,6 +50,7 @@ public class GenericValidationResponseTest { Assertions.assertEquals(map, genericValidationResponse.getValidationResultsAsMap()); Assertions.assertEquals(errorMsg, genericValidationResponse.getAllErrorMessage()); Assertions.assertEquals(errorMsg, genericValidationResponse.getAllErrorMessage("testMsg")); - + genericValidationResponse.addErrorMessage("test", "test message"); + Assertions.assertEquals("test message", genericValidationResponse.getAllErrorMessage("test")); } } diff --git a/dcae-analytics/version.properties b/dcae-analytics/version.properties index 168bd06..5672fef 100644 --- a/dcae-analytics/version.properties +++ b/dcae-analytics/version.properties @@ -4,6 +4,7 @@ # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # Copyright (c) 2021 Samsung Electronics. All rights reserved. # Copyright (c) 2022 Wipro Limited. +# 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. @@ -21,7 +22,7 @@ # major=1 minor=3 -patch=2 +patch=3 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT diff --git a/eelf-logger/version.properties b/eelf-logger/version.properties index 5956814..c6875ce 100644 --- a/eelf-logger/version.properties +++ b/eelf-logger/version.properties @@ -1,5 +1,6 @@ -# ================================================================================ +# ============LICENSE_START======================================================= # Copyright (c) 2018 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. @@ -16,8 +17,8 @@ # major=1 -minor=2 -patch=2 +minor=3 +patch=3 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT diff --git a/pom.xml b/pom.xml index 083127b..6c24ac1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,7 @@ ~ Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. ~ Copyright (c) 2021 Samsung Electronics. All rights reserved. ~ Copyright (c) 2022 Wipro Limited. + ~ 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. @@ -35,7 +36,7 @@ ${revision} - 1.3.2-SNAPSHOT + 1.3.3-SNAPSHOT dcaegen2-analytics-tca-gen2 diff --git a/version.properties b/version.properties index e185183..4aaa531 100644 --- a/version.properties +++ b/version.properties @@ -3,6 +3,7 @@ # TCAgen2 # ================================================================================ # Copyright (c) 2022 Wipro Limited. +# 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. @@ -19,7 +20,7 @@ ################################################################################## major=1 minor=3 -patch=2 +patch=3 base_version=${major}.${minor}.${patch} release_version=${base_version} snapshot_version=${base_version}-SNAPSHOT -- 2.16.6