TCA: Support for VES/A&AI enrichment
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / test / java / org / openecomp / dcae / apod / analytics / model / domain / cef / EventSeverityTest.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  *  Licensed under the Apache License, Version 2.0 (the "License");\r
8  *  you may not use this file except in compliance with the License.\r
9  *   You may obtain a copy of the License at\r
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  *  Unless required by applicable law or agreed to in writing, software\r
14  *  distributed under the License is distributed on an "AS IS" BASIS,\r
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  *  See the License for the specific language governing permissions and\r
17  *  limitations under the License.\r
18  *  ============================LICENSE_END===========================================\r
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.model.domain.cef;\r
22 \r
23 import org.junit.Assert;\r
24 import org.junit.Test;\r
25 import org.openecomp.dcae.apod.analytics.test.BaseDCAEAnalyticsUnitTest;\r
26 \r
27 import java.util.Collections;\r
28 import java.util.Comparator;\r
29 import java.util.LinkedList;\r
30 import java.util.List;\r
31 \r
32 /**\r
33  *\r
34  * @author Rajiv Singla . Creation Date: 11/10/2016.\r
35  */\r
36 public class EventSeverityTest extends BaseDCAEAnalyticsUnitTest {\r
37 \r
38     private static Comparator<EventSeverity> eventSeverityComparator = new Comparator<EventSeverity>() {\r
39         @Override\r
40         public int compare(EventSeverity eventSeverity1, EventSeverity eventSeverity2) {\r
41             return eventSeverity1.compareTo(eventSeverity2);\r
42         }\r
43     };\r
44 \r
45     @Test\r
46     public void testEventSeverityOrdering() throws Exception {\r
47 \r
48         List<EventSeverity> eventSeverities = new LinkedList<>();\r
49         Collections.addAll(eventSeverities,\r
50                 EventSeverity.NORMAL,\r
51                 EventSeverity.WARNING,\r
52                 EventSeverity.MINOR,\r
53                 EventSeverity.MAJOR,\r
54                 EventSeverity.CRITICAL);\r
55 \r
56         Collections.sort(eventSeverities);\r
57 \r
58         List<EventSeverity> expectedEventSeverities = new LinkedList<>();\r
59         Collections.addAll(expectedEventSeverities,\r
60                 EventSeverity.CRITICAL,\r
61                 EventSeverity.MAJOR,\r
62                 EventSeverity.MINOR,\r
63                 EventSeverity.WARNING,\r
64                 EventSeverity.NORMAL\r
65         );\r
66 \r
67         Assert.assertTrue("Severity Order must be CRITICAL, MAJOR, MINOR, WARNING, NORMAL",\r
68                 eventSeverities.equals(expectedEventSeverities));\r
69 \r
70     }\r
71 }\r