2 * ============LICENSE_START=======================================================
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
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=========================================================
21 package org.openecomp.mso.requestsdb;
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;
28 import java.sql.Timestamp;
30 import org.junit.After;
31 import org.junit.Before;
32 import org.junit.Test;
34 public class WatchdogComponentDistributionStatusTest {
36 WatchdogComponentDistributionStatus _watchdogComponentDistributionStatus;
38 protected String _distributionId;
39 protected String _componentName;
40 protected String _componentDistributionStatus;
41 protected Timestamp _createTime;
42 protected Timestamp _modifyTime;
44 public WatchdogComponentDistributionStatusTest() {
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());
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);
64 public void tearDown() {
65 _watchdogComponentDistributionStatus = null;
69 * Test of getDistributionId method
72 public void testGetDistributionId() {
73 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
74 assertEquals(_watchdogComponentDistributionStatus.getDistributionId(),_distributionId);
79 * Test setDistributionId method
82 public void testSetDistributionId() {
83 _watchdogComponentDistributionStatus.setDistributionId(_distributionId);
84 verify(_watchdogComponentDistributionStatus).setDistributionId(_distributionId);
88 * Test of getDistributionId method
91 public void testGetComponentName() {
92 _watchdogComponentDistributionStatus.setComponentName(_componentName);
93 assertEquals(_watchdogComponentDistributionStatus.getComponentName(),_componentName);
98 * Test setDistributionId method
101 public void testSetComponentName() {
102 _watchdogComponentDistributionStatus.setComponentName(_componentName);
103 verify(_watchdogComponentDistributionStatus).setComponentName(_componentName);
107 * Test of getDistributionId method
110 public void testGetComponentDistributionStatus() {
111 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
112 assertEquals(_watchdogComponentDistributionStatus.getComponentDistributionStatus(),_componentDistributionStatus);
117 * Test setDistributionId method
120 public void testSetComponentDistributionStatus() {
121 _watchdogComponentDistributionStatus.setComponentDistributionStatus(_componentDistributionStatus);
122 verify(_watchdogComponentDistributionStatus).setComponentDistributionStatus(_componentDistributionStatus);
126 * Test of getCreateTime method
129 public void testGetCreateTime() {
130 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
131 System.out.println("CreateTime : " + _createTime);
132 assertEquals(_watchdogComponentDistributionStatus.getCreateTime(),_createTime);
137 * Test setCreateTime method
140 public void testSetCreateTime() {
141 _watchdogComponentDistributionStatus.setCreateTime(_createTime);
142 verify(_watchdogComponentDistributionStatus).setCreateTime(_createTime);
146 * Test of getModifyTime method
149 public void testGetModifyTime() {
150 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
151 System.out.println("ModifyTime : " + _modifyTime);
152 assertEquals(_watchdogComponentDistributionStatus.getModifyTime(),_modifyTime);
157 * Test setModifyTime method
160 public void testSetModifyTime() {
161 _watchdogComponentDistributionStatus.setModifyTime(_modifyTime);
162 verify(_watchdogComponentDistributionStatus).setModifyTime(_modifyTime);