c131bd137960aa8da349d62f83ee518ac5b9d998
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2017 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.vfc.nfvo.res.service.dao.impl;
18
19 import static org.junit.Assert.*;
20
21 import org.junit.Test;
22 import org.onap.vfc.nfvo.res.service.dao.impl.AbstractDao;
23 import org.onap.vfc.nfvo.res.service.dao.impl.LocationDaoImpl;
24 import org.onap.vfc.nfvo.res.service.dao.impl.NetworkDaoImpl;
25 import org.onap.vfc.nfvo.res.service.entity.LocationEntity;
26 import org.onap.vfc.nfvo.res.service.entity.NetworkEntity;
27 import org.onap.vfc.nfvo.res.service.mapper.LocationMapper;
28 import org.openo.baseservice.remoteservice.exception.ServiceException;
29
30 import mockit.Mock;
31 import mockit.MockUp;
32
33 public class LocationDaoImplTest {
34     LocationMapper mapper;
35     @Test
36     public void testaddHost() throws ServiceException {
37
38         new MockUp<AbstractDao>() {
39
40             @Mock
41              public <T> T getMapperManager(Class<T> type) {
42                 return (T) mapper;
43
44             }
45         };
46         LocationDaoImpl impl = new LocationDaoImpl();
47         LocationEntity locationEntity =new LocationEntity();
48         locationEntity.setId("locationEntity");
49
50
51     }
52
53     @Test
54     public void testaddLocationSelective() throws ServiceException {
55
56         new MockUp<AbstractDao>() {
57
58             @Mock
59              public <T> T getMapperManager(Class<T> type) {
60                 return (T) mapper;
61
62             }
63         };
64         LocationDaoImpl impl = new LocationDaoImpl();
65         LocationEntity locationEntity =new LocationEntity();
66         locationEntity.setId("1");
67
68
69     }
70
71     @Test
72     public void testupdateNetwork() throws ServiceException {
73
74             new MockUp<AbstractDao>() {
75
76             @Mock
77              public <T> T getMapperManager(Class<T> type) {
78                 return (T) mapper;
79
80             }
81         };
82         NetworkDaoImpl impl = new NetworkDaoImpl();
83         NetworkEntity networkEntity =new NetworkEntity();
84         networkEntity.setId("1");
85
86     }
87
88 }