summaryrefslogtreecommitdiffstats
path: root/dcae-analytics/dcae-analytics-tca-model
diff options
context:
space:
mode:
authormalar <malarvizhi.44@wipro.com>2022-07-28 09:52:22 +0000
committermalar <malarvizhi.44@wipro.com>2022-08-05 06:53:10 +0000
commitc56c4a5e36d97cb22c97d9acc29d057760b0ec0f (patch)
treeeb9bd65d207ccf7763c06f9c26d14ee816f79f69 /dcae-analytics/dcae-analytics-tca-model
parentebaab76841e7c7cfee0143e6c40c6e1ae3204309 (diff)
Support 7.2.1 VES in TCAGEN2
- Includes modifications for processing Tca Policy as a List to support both v5 and v7 policies Issue-ID: DCAEGEN2-2976 Signed-off-by: Malarvizhi Paramasivam <malarvizhi.44@wipro.com> Change-Id: I29f56048d825710d268e4588f4b5779d5fdb6020
Diffstat (limited to 'dcae-analytics/dcae-analytics-tca-model')
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/pom.xml3
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/policy/MetricsPerEventName.java6
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/util/json/TcaModelJsonConversion.java10
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java11
4 files changed, 19 insertions, 11 deletions
diff --git a/dcae-analytics/dcae-analytics-tca-model/pom.xml b/dcae-analytics/dcae-analytics-tca-model/pom.xml
index 488d1c8..9b5223b 100644
--- a/dcae-analytics/dcae-analytics-tca-model/pom.xml
+++ b/dcae-analytics/dcae-analytics-tca-model/pom.xml
@@ -42,7 +42,8 @@
<description>Contains models for TCA (Threshold Crossing Alert) micro service</description>
<properties>
- <main.basedir>${project.parent.basedir}</main.basedir>
+ <main.basedir>${project.parent.basedir}</main.basedir>
+ <onap-gerrit-review>-changelog-missing</onap-gerrit-review>
</properties>
diff --git a/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/policy/MetricsPerEventName.java b/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/policy/MetricsPerEventName.java
index 024202a..8db9723 100644
--- a/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/policy/MetricsPerEventName.java
+++ b/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/policy/MetricsPerEventName.java
@@ -1,6 +1,7 @@
/*
- * ================================================================================
+ * ===========LICENSE_START========================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2022 Wipro Limited Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,6 +66,7 @@ public class MetricsPerEventName extends BaseTcaPolicyModel {
* Policy Thresholds
*/
private List<Threshold> thresholds;
-
+
+ public MetricsPerEventName() { }
}
diff --git a/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/util/json/TcaModelJsonConversion.java b/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/util/json/TcaModelJsonConversion.java
index aaec970..df14b32 100644
--- a/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/util/json/TcaModelJsonConversion.java
+++ b/dcae-analytics/dcae-analytics-tca-model/src/main/java/org/onap/dcae/analytics/tca/model/util/json/TcaModelJsonConversion.java
@@ -1,6 +1,7 @@
/*
- * ================================================================================
+ * ===========LICENSE_START========================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2022 Wipro Limited Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +25,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Optional;
import java.util.function.Function;
+import java.util.List;
import org.onap.dcae.analytics.model.util.function.JsonToJavaObjectBiFunction;
import org.onap.dcae.analytics.tca.model.facade.TcaAlert;
@@ -38,7 +40,7 @@ public abstract class TcaModelJsonConversion {
public static final ObjectMapper TCA_OBJECT_MAPPER = new TcaObjectMapperSupplier().get();
// Type reference to convert tca policy string to tca policy object
- private static final TypeReference<TcaPolicy> TCA_POLICY_TYPE_REF = new TypeReference<TcaPolicy>() {
+ private static final TypeReference<List<TcaPolicy>> TCA_POLICY_TYPE_REF = new TypeReference<List<TcaPolicy>>() {
};
// Type reference to convert tca alert string to tca alert
@@ -46,8 +48,8 @@ public abstract class TcaModelJsonConversion {
};
// Tca Policy JSON conversion function
- public static final Function<String, Optional<TcaPolicy>> TCA_POLICY_JSON_FUNCTION = new
- JsonToJavaObjectBiFunction<TcaPolicy>(TCA_OBJECT_MAPPER).curry(TCA_POLICY_TYPE_REF);
+ public static final Function<String, Optional<List<TcaPolicy>>> TCA_POLICY_JSON_FUNCTION = new
+ JsonToJavaObjectBiFunction<List<TcaPolicy>>(TCA_OBJECT_MAPPER).curry(TCA_POLICY_TYPE_REF);
// Tca Alert JSON conversion function
public static final Function<String, Optional<TcaAlert>> TCA_ALERT_JSON_FUNCTION = new
diff --git a/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java
index 5592f3b..1cfc1b3 100644
--- a/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java
+++ b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java
@@ -1,6 +1,7 @@
/*
- * ================================================================================
+ * ============LICENSE_START=======================================================
* Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (c) 2022 Wipro Limited Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,6 +27,7 @@ import org.junit.jupiter.api.Test;
import org.onap.dcae.analytics.tca.model.BaseTcaModelTest;
import org.onap.dcae.analytics.tca.model.policy.TcaPolicy;
import org.onap.dcae.analytics.tca.model.util.json.TcaModelJsonConversion;
+import java.util.List;
/**
* @author Rajiv Singla
@@ -36,15 +38,16 @@ class TcaPolicyMixinTest extends BaseTcaModelTest {
@DisplayName("Test TCA Policy JSON Conversions")
void testTCAPolicyJsonConversions() throws Exception {
- final TcaPolicy tcaPolicy =
+ final List<TcaPolicy> tcaPolicy =
assertJsonConversions(TestFileLocation.TCA_POLICY_JSON, TcaModelJsonConversion
.TCA_POLICY_JSON_FUNCTION, TcaModelJsonConversion.TCA_OBJECT_MAPPER);
assertThat(tcaPolicy).isNotNull();
- assertThat(tcaPolicy.getMetricsPerEventName().size())
+ TcaPolicy tcaPol = tcaPolicy.get(0);
+ assertThat(tcaPol.getMetricsPerEventName().size())
.as("TCA Policy Metrics Per Event Name must be 3").isEqualTo(3);
- assertThat(tcaPolicy.getMetricsPerEventName().get(0).getThresholds().size())
+ assertThat(tcaPol.getMetricsPerEventName().get(0).getThresholds().size())
.as("TCA Policy Thresholds for first event name must be 3").isEqualTo(3);
// test tca policy serialization