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 org.junit.Test;
24 import org.mockito.Mockito;
26 import static org.junit.Assert.assertEquals;
27 import static org.mockito.Matchers.any;
28 import static org.mockito.Mockito.doNothing;
29 import static org.mockito.Mockito.mock;
30 import static org.mockito.Mockito.times;
31 import static org.mockito.Mockito.verify;
33 import java.util.ArrayList;
34 import java.util.List;
37 public class WatchdogComponentDistributionStatusDbTest {
39 private static final String distributionId = "ff3514e3-5a33-55df-13ab-12abad84e7ff";
40 private static final String componentName = "MSO";
41 private static final String componentDistributionStatus = "SENT";
45 public void testGetWatchdogComponentDistributionStatus() {
46 List<WatchdogComponentDistributionStatus> watchDogCompDistStatus = new ArrayList<>();
47 WatchdogComponentDistributionStatusDb wdcds = Mockito.mock(WatchdogComponentDistributionStatusDb.class);
48 Mockito.when(wdcds.getWatchdogComponentDistributionStatus("ff3514e3-5a33-55df-13ab-12abad84e7ff")).thenReturn(watchDogCompDistStatus);
49 List<WatchdogComponentDistributionStatus> actual = wdcds.getWatchdogComponentDistributionStatus(distributionId);
51 assertEquals(actual, watchDogCompDistStatus);
52 verify(wdcds, times(1)).getWatchdogComponentDistributionStatus(any(String.class));
57 public void testInsertWatchdogComponentDistributionStatus() {
59 WatchdogComponentDistributionStatusDb wdcds = mock(WatchdogComponentDistributionStatusDb.class);
61 wdcds.insertWatchdogComponentDistributionStatus(distributionId, componentName, componentDistributionStatus);
62 doNothing().when(wdcds).insertWatchdogComponentDistributionStatus(any(String.class), any(String.class), any(String.class));
63 verify(wdcds, times(1)).insertWatchdogComponentDistributionStatus(any(String.class), any(String.class), any(String.class));