AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-requests-db / src / test / java / org / openecomp / mso / requestsdb / WatchdogServiceModVerIdLookupDbTest.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 /**
22  * 
23  */
24 package org.openecomp.mso.requestsdb;
25
26 import org.junit.Test;
27 import org.mockito.Mockito;
28
29 import static org.junit.Assert.assertEquals;
30 import static org.mockito.Matchers.any;
31 import static org.mockito.Mockito.doNothing;
32 import static org.mockito.Mockito.mock;
33 import static org.mockito.Mockito.times;
34 import static org.mockito.Mockito.verify;
35
36
37 public class WatchdogServiceModVerIdLookupDbTest {
38
39         private static final String distributionId = "ff3514e3-5a33-55df-13ab-12abad84e7ff";
40         private static final String serviceModelVersionId = "SENT";
41         
42         @Test
43         public void testInsertWatchdogServiceModVerIdLookup() {
44         
45                 WatchdogServiceModVerIdLookupDb wdsm = mock(WatchdogServiceModVerIdLookupDb.class);
46                 
47                 wdsm.insertWatchdogServiceModVerIdLookup(distributionId, serviceModelVersionId);                
48                 doNothing().when(wdsm).insertWatchdogServiceModVerIdLookup(any(String.class), any(String.class));       
49                 verify(wdsm, times(1)).insertWatchdogServiceModVerIdLookup(any(String.class), any(String.class));
50         
51         }
52         
53         @Test
54         public void testGetWatchdogServiceModVerId() {
55                         
56                 WatchdogServiceModVerIdLookupDb wdsm = Mockito.mock(WatchdogServiceModVerIdLookupDb.class);
57                 Mockito.when(wdsm.getWatchdogServiceModVerId("ff305d54-75b4-431b-adb2-eb6b9e5ff001")).thenReturn("ff3514e3-5a33-55df-13ab-12abad84e7ff");
58                 String actual = wdsm.getWatchdogServiceModVerId("ff305d54-75b4-431b-adb2-eb6b9e5ff001");
59                 assertEquals(actual, "ff3514e3-5a33-55df-13ab-12abad84e7ff");
60                 verify(wdsm, times(1)).getWatchdogServiceModVerId(any(String.class));
61         }
62         
63 }