2 * Copyright 2016-2017 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.vfc.nfvo.res.service.business.impl;
19 import static org.junit.Assert.assertTrue;
21 import org.junit.Test;
22 import org.onap.vfc.nfvo.res.service.business.impl.HostBusinessImpl;
23 import org.onap.vfc.nfvo.res.service.dao.impl.HostDaoImpl;
24 import org.onap.vfc.nfvo.res.service.entity.HostEntity;
25 import org.openo.baseservice.remoteservice.exception.ServiceException;
30 public class HostBusinessImplTest {
33 public void testGetHost() {
34 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
35 assertTrue(hostBussinessImp.getHost("") == null);
39 public void testGetHostBranch() {
40 new MockUp<HostDaoImpl>() {
43 public HostEntity getHost(String id) {
44 return new HostEntity();
48 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
49 hostBussinessImp.setHostDao(new HostDaoImpl());
50 assertTrue(hostBussinessImp.getHost("id") != null);
53 @Test(expected = ServiceException.class)
54 public void testDelete() throws ServiceException {
55 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
56 hostBussinessImp.deleteHost("");
59 @Test(expected = ServiceException.class)
60 public void testUpdateHost() throws ServiceException {
61 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
62 hostBussinessImp.updateHost(null);
65 @Test(expected = ServiceException.class)
66 public void testDeleteHostByVimId() throws ServiceException {
67 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
68 hostBussinessImp.deleteHostByVimId("");
71 @Test(expected = ServiceException.class)
72 public void testUpdateHostByVimId() throws ServiceException {
73 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
74 hostBussinessImp.updateHostByVimId(null);
77 @Test(expected = ServiceException.class)
78 public void testAddHost() throws ServiceException {
79 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
80 hostBussinessImp.addHost(null);
83 @Test(expected = ServiceException.class)
84 public void testAddHostSelective() throws ServiceException {
85 HostBusinessImpl hostBussinessImp = new HostBusinessImpl();
86 hostBussinessImp.addHostSelective(null);