2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright 2018 TechMahindra
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.openecomp.mso.requestsdb;
22 import static org.junit.Assert.assertEquals;
23 import java.sql.Timestamp;
24 import org.junit.Test;
26 public class WatchdogComponentDistributionStatusTest {
28 WatchdogComponentDistributionStatus wcds=new WatchdogComponentDistributionStatus();
29 Timestamp time=new Timestamp(10);
33 wcds.setComponentDistributionStatus("componentDistributionStatus");
34 wcds.setComponentName("componentName");
35 wcds.setCreateTime(time);
36 wcds.setDistributionId("distributionId");
37 wcds.setModifyTime(time);
39 assertEquals(wcds.getComponentDistributionStatus(), "componentDistributionStatus");
40 assertEquals(wcds.getComponentName(), "componentName");
41 assertEquals(wcds.getCreateTime(), time);
42 assertEquals(wcds.getDistributionId(), "distributionId");
43 assertEquals(wcds.getModifyTime(), time);
47 /*WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
49 protected String _distributionId;
50 protected String _componentName;
51 protected String _componentDistributionStatus;
52 protected Timestamp _createTime;
53 protected Timestamp _modifyTime;
55 public WatchdogComponentDistributionStatusTest() {
60 _watchdogComponentDistributionStatus = mock(WatchdogComponentDistributionStatus.class);
61 _distributionId = "12abad84e7ff";
62 _componentName = "MSO";
63 _componentDistributionStatus = "SENT";
64 _createTime = new Timestamp (System.currentTimeMillis());
65 _modifyTime = new Timestamp (System.currentTimeMillis());
67 when(_watchdogComponentDistributionStatus.getDistributionId()).thenReturn(_distributionId);
68 when(_watchdogComponentDistributionStatus.getComponentName()).thenReturn(_componentName);
69 when(_watchdogComponentDistributionStatus.getComponentDistributionStatus()).thenReturn(_componentDistributionStatus);
70 when(_watchdogComponentDistributionStatus.getCreateTime()).thenReturn(_createTime);
71 when(_watchdogComponentDistributionStatus.getModifyTime()).thenReturn(_modifyTime);
75 public void tearDown() {
76 _watchdogComponentDistributionStatus = null;
80 * Test of getDistributionId method
83 public void testGetDistributionId() {
84 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
85 assertEquals(_watchdogComponentDistributionStatus.getDistributionId(),_distributionId);
90 * Test setDistributionId method
93 public void testSetDistributionId() {
94 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
95 verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId);
99 * Test of getDistributionId method
102 public void testGetComponentName() {
103 _watchdogComponentDistributionStatus.setComponentName(_componentName);
104 assertEquals(_watchdogComponentDistributionStatus.getComponentName(),_componentName);
109 * Test setDistributionId method
112 public void testSetComponentName() {
113 _watchdogComponentDistributionStatus.setComponentName(_componentName);
114 verify(_watchdogComponentDistributionStatus).setComponentName(_componentName);
118 * Test of getDistributionId method
121 public void testGetComponentDistributionStatus() {
122 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
123 assertEquals(_watchdogComponentDistributionStatus.getComponentDistributionStatus(),_componentDistributionStatus);
128 * Test setDistributionId method
131 public void testSetComponentDistributionStatus() {
132 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
133 verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus);
137 * Test of getCreateTime method
140 public void testGetCreateTime() {
141 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
142 System.out.println("CreateTime : " + _createTime);
143 assertEquals(_watchdogComponentDistributionStatus.getCreateTime(),_createTime);
148 * Test setCreateTime method
151 public void testSetCreateTime() {
152 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
153 verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime);
157 * Test of getModifyTime method
160 public void testGetModifyTime() {
161 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
162 System.out.println("ModifyTime : " + _modifyTime);
163 assertEquals(_watchdogComponentDistributionStatus.getModifyTime(),_modifyTime);
168 * Test setModifyTime method
171 public void testSetModifyTime() {
172 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
173 verify(_watchdogComponentDistributionStatus).setModifyTime(_modifyTime);