AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-requests-db / src / test / java / org / openecomp / mso / requestsdb / WatchdogServiceModVerIdLookupTest.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 static org.junit.Assert.assertEquals;
24 import static org.mockito.Mockito.mock;
25 import static org.mockito.Mockito.verify;
26 import static org.mockito.Mockito.when;
27
28 import java.sql.Timestamp;
29
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
33
34 public class WatchdogServiceModVerIdLookupTest {
35         
36         WatchdogServiceModVerIdLookup _watchdogServiceModVerIdLookup;
37         
38         protected String _distributionId;
39         protected String _serviceModelVersionId;
40         protected Timestamp _createTime;
41         
42         public WatchdogServiceModVerIdLookupTest() {
43         }
44         
45     @Before
46         public void setUp() {
47         _watchdogServiceModVerIdLookup = mock(WatchdogServiceModVerIdLookup.class);
48         _serviceModelVersionId = "12abad84e7ff";
49         _createTime = new Timestamp (System.currentTimeMillis());
50         
51         when(_watchdogServiceModVerIdLookup.getDistributionId()).thenReturn(_distributionId);
52         when(_watchdogServiceModVerIdLookup.getServiceModelVersionId()).thenReturn(_serviceModelVersionId);
53         when(_watchdogServiceModVerIdLookup.getCreateTime()).thenReturn(_createTime);
54         }
55     
56         @After
57         public void tearDown() {
58                 _watchdogServiceModVerIdLookup = null;
59         }
60         
61         /**
62          * Test of getDistributionId method
63          */
64         @Test
65         public void testGetDistributionId() {
66                 _watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
67                 assertEquals(_watchdogServiceModVerIdLookup.getDistributionId(),_distributionId);
68
69         }
70
71         /**
72          * Test setDistributionId  method
73          */
74         @Test
75         public void testSetDistributionId() {
76                 _watchdogServiceModVerIdLookup.setDistributionId(_distributionId);
77                 verify(_watchdogServiceModVerIdLookup).setDistributionId(_distributionId);
78         }
79         
80         /**
81          * Test of getServiceModelVersionId method
82          */
83         @Test
84         public void testGetServiceModelVersionId() {
85                 _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
86                 assertEquals(_watchdogServiceModVerIdLookup.getServiceModelVersionId(),_serviceModelVersionId);
87
88         }
89
90         /**
91          * Test setServiceModelVersionId  method
92          */
93         @Test
94         public void testSetServiceModelVersionId() {
95                 _watchdogServiceModVerIdLookup.setServiceModelVersionId(_serviceModelVersionId);
96                 verify(_watchdogServiceModVerIdLookup).setServiceModelVersionId(_serviceModelVersionId);
97         }
98         
99         /**
100          * Test of getCreateTime method
101          */
102         @Test
103         public void testGetCreateTime() {
104                 _watchdogServiceModVerIdLookup.setCreateTime(_createTime);
105                 assertEquals(_watchdogServiceModVerIdLookup.getCreateTime(),_createTime);
106
107         }
108
109         /**
110          * Test setCreateTime method
111          */
112         @Test
113         public void testSetCreateTime() {
114                 _watchdogServiceModVerIdLookup.setCreateTime(_createTime);
115                 verify(_watchdogServiceModVerIdLookup).setCreateTime(_createTime);
116         }
117         
118 }