summaryrefslogtreecommitdiffstats
path: root/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap
diff options
context:
space:
mode:
authorSingla, Rajiv (rs153v) <rs153v@att.com>2018-08-15 11:46:10 -0400
committerSingla, Rajiv (rs153v) <rs153v@att.com>2018-08-16 11:09:15 -0400
commit7a2c23b3ad83eab0eed5b990c70a1603447d5ee5 (patch)
tree24293333fd3cc566c1d77f9c9eedeb034dce9c6c /dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap
parent9650bd18f6b88721628ebedac2575b44e1b0028e (diff)
Standalone TCA with EELF Logger
Issue-ID: DCAEGEN2-633 Change-Id: I4da76b532021c0d6248455e7bd6e77f4614c35a7 Signed-off-by: Singla, Rajiv (rs153v) <rs153v@att.com>
Diffstat (limited to 'dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap')
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/BaseTcaModelTest.java30
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/facade/TcaAlertMixinTest.java58
-rw-r--r--dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java54
3 files changed, 142 insertions, 0 deletions
diff --git a/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/BaseTcaModelTest.java b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/BaseTcaModelTest.java
new file mode 100644
index 0000000..3d5add2
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/BaseTcaModelTest.java
@@ -0,0 +1,30 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T 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.
+ * 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.tca.model;
+
+import org.onap.dcae.analytics.test.BaseAnalyticsUnitTest;
+
+/**
+ * @author Rajiv Singla
+ */
+public abstract class BaseTcaModelTest extends BaseAnalyticsUnitTest {
+
+
+}
diff --git a/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/facade/TcaAlertMixinTest.java b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/facade/TcaAlertMixinTest.java
new file mode 100644
index 0000000..a0ebc05
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/facade/TcaAlertMixinTest.java
@@ -0,0 +1,58 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T 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.
+ * 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.tca.model.util.json.mixin.facade;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.onap.dcae.analytics.tca.model.BaseTcaModelTest;
+import org.onap.dcae.analytics.tca.model.facade.TcaAlert;
+import org.onap.dcae.analytics.tca.model.util.json.TcaModelJsonConversion;
+
+/**
+ * @author Rajiv Singla
+ */
+public class TcaAlertMixinTest extends BaseTcaModelTest {
+
+ @Test
+ @DisplayName("Confirms TCA Alert JSON Conversions")
+ public void testTCAAlertConversion() throws Exception {
+ final TcaAlert tcaAlert =
+ assertJsonConversions(TestFileLocation.TCA_ALERT_JSON, TcaModelJsonConversion
+ .TCA_ALERT_JSON_FUNCTION, TcaModelJsonConversion.TCA_OBJECT_MAPPER);
+
+ assertThat(tcaAlert).isNotNull();
+ assertThat(tcaAlert.getAai().getGenericVNFName()).isEqualTo("vpp-test(?)");
+
+ assertThat(tcaAlert.getTargetType()).isEqualTo("VNF");
+ assertThat(tcaAlert.getRequestId()).isEqualTo("0138afac-b032-4e4b-bd30-88260f444888");
+
+ assertThat(tcaAlert.getClosedLoopControlName())
+ .isEqualTo("CL-FRWL-LOW-TRAFFIC-SIG-d925ed73-8231-4d02-9545-db4e101f88f8");
+
+ assertThat(tcaAlert.getVersion()).isEqualTo("1.0.2");
+
+ assertThat(tcaAlert.getClosedLoopAlarmStart()).isEqualTo(1478189220547L);
+
+ assertThat(tcaAlert.getClosedLoopEventStatus()).isEqualTo("ONSET");
+
+ }
+}
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
new file mode 100644
index 0000000..5592f3b
--- /dev/null
+++ b/dcae-analytics/dcae-analytics-tca-model/src/test/java/org/onap/dcae/analytics/tca/model/util/json/mixin/policy/TcaPolicyMixinTest.java
@@ -0,0 +1,54 @@
+/*
+ * ================================================================================
+ * Copyright (c) 2018 AT&T 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.
+ * 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.tca.model.util.json.mixin.policy;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.DisplayName;
+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;
+
+/**
+ * @author Rajiv Singla
+ */
+class TcaPolicyMixinTest extends BaseTcaModelTest {
+
+ @Test
+ @DisplayName("Test TCA Policy JSON Conversions")
+ void testTCAPolicyJsonConversions() throws Exception {
+
+ final TcaPolicy tcaPolicy =
+ assertJsonConversions(TestFileLocation.TCA_POLICY_JSON, TcaModelJsonConversion
+ .TCA_POLICY_JSON_FUNCTION, TcaModelJsonConversion.TCA_OBJECT_MAPPER);
+
+ assertThat(tcaPolicy).isNotNull();
+ assertThat(tcaPolicy.getMetricsPerEventName().size())
+ .as("TCA Policy Metrics Per Event Name must be 3").isEqualTo(3);
+
+ assertThat(tcaPolicy.getMetricsPerEventName().get(0).getThresholds().size())
+ .as("TCA Policy Thresholds for first event name must be 3").isEqualTo(3);
+
+ // test tca policy serialization
+ testSerialization(tcaPolicy, getClass());
+ }
+
+}