AT&T 1712 and 1802 release code
[so.git] / mso-api-handlers / mso-requests-db / src / test / java / org / openecomp / mso / requestsdb / WatchdogComponentDistributionStatusTest.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 WatchdogComponentDistributionStatusTest {
35                 
36         WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
37         
38         protected String _distributionId;
39         protected String _componentName;
40         protected String _componentDistributionStatus;
41         protected Timestamp _createTime;
42         protected Timestamp _modifyTime;
43
44         public WatchdogComponentDistributionStatusTest() {
45         }
46         
47     @Before
48         public void setUp() {
49         _watchdogComponentDistributionStatus = mock(WatchdogComponentDistributionStatus.class);
50         _distributionId = "12abad84e7ff";
51         _componentName = "MSO";
52         _componentDistributionStatus = "SENT";  
53         _createTime = new Timestamp (System.currentTimeMillis());
54         _modifyTime = new Timestamp (System.currentTimeMillis());
55         
56         when(_watchdogComponentDistributionStatus.getDistributionId()).thenReturn(_distributionId);
57         when(_watchdogComponentDistributionStatus.getComponentName()).thenReturn(_componentName);
58         when(_watchdogComponentDistributionStatus.getComponentDistributionStatus()).thenReturn(_componentDistributionStatus);
59         when(_watchdogComponentDistributionStatus.getCreateTime()).thenReturn(_createTime);
60         when(_watchdogComponentDistributionStatus.getModifyTime()).thenReturn(_modifyTime);
61         }
62     
63         @After
64         public void tearDown() {
65                 _watchdogComponentDistributionStatus = null;
66         }
67         
68         /**
69          * Test of getDistributionId method
70          */
71         @Test
72         public void testGetDistributionId() {
73                 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
74                 assertEquals(_watchdogComponentDistributionStatus.getDistributionId(),_distributionId);
75
76         }
77
78         /**
79          * Test setDistributionId  method
80          */
81         @Test
82         public void testSetDistributionId() {
83                 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
84                 verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId);
85         }
86         
87         /**
88          * Test of getDistributionId method
89          */
90         @Test
91         public void testGetComponentName() {
92                 _watchdogComponentDistributionStatus.setComponentName(_componentName);
93                 assertEquals(_watchdogComponentDistributionStatus.getComponentName(),_componentName);
94
95         }
96
97         /**
98          * Test setDistributionId  method
99          */
100         @Test
101         public void testSetComponentName() {
102                 _watchdogComponentDistributionStatus.setComponentName(_componentName);
103                 verify(_watchdogComponentDistributionStatus).setComponentName(_componentName);
104         }
105         
106         /**
107          * Test of getDistributionId method
108          */
109         @Test
110         public void testGetComponentDistributionStatus() {
111                 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
112                 assertEquals(_watchdogComponentDistributionStatus.getComponentDistributionStatus(),_componentDistributionStatus);
113
114         }
115
116         /**
117          * Test setDistributionId  method
118          */
119         @Test
120         public void testSetComponentDistributionStatus() {
121                 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
122                 verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus);
123         }
124         
125         /**
126          * Test of getCreateTime method
127          */
128         @Test
129         public void testGetCreateTime() {
130                 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
131                 System.out.println("CreateTime : " + _createTime);
132                 assertEquals(_watchdogComponentDistributionStatus.getCreateTime(),_createTime);
133
134         }
135
136         /**
137          * Test setCreateTime method
138          */
139         @Test
140         public void testSetCreateTime() {
141                 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
142                 verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime);
143         }
144         
145         /**
146          * Test of getModifyTime method
147          */
148         @Test
149         public void testGetModifyTime() {
150                 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
151                 System.out.println("ModifyTime : " + _modifyTime);
152                 assertEquals(_watchdogComponentDistributionStatus.getModifyTime(),_modifyTime);
153
154         }
155
156         /**
157          * Test setModifyTime method
158          */
159         @Test
160         public void testSetModifyTime() {
161                 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
162                 verify(_watchdogComponentDistributionStatus).setModifyTime(_modifyTime);
163         }
164         
165 }