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