AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-requests-db / src / test / java / org / openecomp / mso / requestsdb / WatchdogComponentDistributionStatusDbTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 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.mso.requestsdb;
22
23 import org.junit.Test;
24 import org.mockito.Mockito;
25
26 import static org.junit.Assert.assertEquals;
27 import static org.mockito.Matchers.any;
28 import static org.mockito.Mockito.doNothing;
29 import static org.mockito.Mockito.mock;
30 import static org.mockito.Mockito.times;
31 import static org.mockito.Mockito.verify;
32
33 import java.util.ArrayList;
34 import java.util.List;
35
36
37 public class WatchdogComponentDistributionStatusDbTest {
38
39         private static final String distributionId = "ff3514e3-5a33-55df-13ab-12abad84e7ff";
40         private static final String componentName = "MSO";
41         private static final String componentDistributionStatus = "SENT";
42         
43         
44         @Test
45         public void testGetWatchdogComponentDistributionStatus() {
46                 List<WatchdogComponentDistributionStatus> watchDogCompDistStatus = new ArrayList<>();
47                 WatchdogComponentDistributionStatusDb wdcds = Mockito.mock(WatchdogComponentDistributionStatusDb.class);
48                 Mockito.when(wdcds.getWatchdogComponentDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7ff")).thenReturn(watchDogCompDistStatus);
49                 List<WatchdogComponentDistributionStatus> actual = wdcds.getWatchdogComponentDistributionStatus(distributionId);
50                 
51                 assertEquals(actual, watchDogCompDistStatus);
52                 verify(wdcds, times(1)).getWatchdogComponentDistributionStatus(any(String.class));
53         }
54         
55         
56         @Test
57         public void testInsertWatchdogComponentDistributionStatus() {
58         
59                 WatchdogComponentDistributionStatusDb wdcds = mock(WatchdogComponentDistributionStatusDb.class);
60                 
61                 wdcds.insertWatchdogComponentDistributionStatus(distributionId, componentName, componentDistributionStatus);            
62                 doNothing().when(wdcds).insertWatchdogComponentDistributionStatus(any(String.class), any(String.class), any(String.class));       
63                 verify(wdcds, times(1)).insertWatchdogComponentDistributionStatus(any(String.class), any(String.class), any(String.class));
64         
65         }
66         
67 }