538dcd47a32c4952c964b753f9296f265bf65219
[ccsdk/features.git] /
1 /*******************************************************************************
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk feature sdnr wt
4  *  ================================================================================
5  * Copyright (C) 2019 Nokia Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  ******************************************************************************/
21 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.netconf.container;
22
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance24Hours;
27
28 import java.util.List;
29
30 import static org.junit.Assert.assertEquals;
31 import static org.mockito.Mockito.mock;
32
33
34 public class AllPmTest {
35
36     private AllPm allPm;
37
38     @Before
39     public void setUp(){
40         allPm = AllPm.getEmpty();
41     }
42
43     @Test
44     public void shouldCreateEmptyInstance() {
45         assertEquals(0, allPm.size());
46     }
47
48
49     @Test
50     public void shouldBePossibleToAdd15MinutesPerformanceMeasurements() {
51         // given
52         final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes_1 = mock(EsHistoricalPerformance15Minutes.class);
53         final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes_2 = mock(EsHistoricalPerformance15Minutes.class);
54
55         allPm.add(esHistoricalPerformance15Minutes_1);
56         allPm.add(esHistoricalPerformance15Minutes_2);
57
58
59         // when
60         final List<EsHistoricalPerformance15Minutes> pm15size = allPm.getPm15();
61         final List<EsHistoricalPerformance24Hours> pm24size = allPm.getPm24();
62
63         // then
64         assertEquals(2, pm15size.size());
65         assertEquals(0, pm24size.size());
66     }
67
68     @Test
69     public void shouldBePossibleToAdd24HoursPerformanceMeasurements() {
70         // given
71         final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours_1 = mock(EsHistoricalPerformance24Hours.class);
72         final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours_2 = mock(EsHistoricalPerformance24Hours.class);
73
74         allPm.add(esHistoricalPerformance24Hours_1);
75         allPm.add(esHistoricalPerformance24Hours_2);
76
77
78         // when
79         final List<EsHistoricalPerformance15Minutes> pm15size = allPm.getPm15();
80         final List<EsHistoricalPerformance24Hours> pm24size = allPm.getPm24();
81
82         // then
83         assertEquals(0, pm15size.size());
84         assertEquals(2, pm24size.size());
85     }
86
87     @Test
88     public void shouldBePossibleToAddPerformanceMeasurements() {
89         // given
90         final EsHistoricalPerformance15Minutes esHistoricalPerformance15Minutes = mock(EsHistoricalPerformance15Minutes.class);
91         final EsHistoricalPerformance24Hours esHistoricalPerformance24Hours = mock(EsHistoricalPerformance24Hours.class);
92
93         allPm.add(esHistoricalPerformance15Minutes);
94         allPm.add(esHistoricalPerformance24Hours);
95
96         // when
97         final int size = allPm.size();
98
99         // then
100         assertEquals(2, size);
101     }
102
103
104 }