6c2f849805128131106f48b0fbaf588562d16150
[vfc/nfvo/resmanagement.git] /
1 /*
2  * Copyright 2016-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.business.impl;
18
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.onap.vfc.nfvo.res.service.business.impl.LimitsBusinessImpl;
22 import org.openo.baseservice.remoteservice.exception.ServiceException;
23 import org.openo.baseservice.roa.util.restclient.HttpRest;
24 import org.openo.baseservice.roa.util.restclient.RestfulOptions;
25 import org.openo.baseservice.roa.util.restclient.RestfulParametes;
26 import org.openo.baseservice.roa.util.restclient.RestfulResponse;
27
28 import mockit.Mock;
29 import mockit.MockUp;
30 import net.sf.json.JSONObject;
31
32 public class LimitsBusinessImplTest {
33
34     private LimitsBusinessImpl limitsBusinessImpl;
35
36     @Before
37     public void setUp() throws ServiceException {
38         limitsBusinessImpl = new LimitsBusinessImpl();
39     }
40
41     @Test
42     public void testGetCpuLimits() throws ServiceException {
43         new MockUp<HttpRest>() {
44
45             @Mock
46             public RestfulResponse get(String servicePath, RestfulParametes restParametes, RestfulOptions option)
47                     throws ServiceException {
48                 RestfulResponse rsp = new RestfulResponse();
49                 rsp.setStatus(200);
50                 return rsp;
51             }
52         };
53         JSONObject paramJson = new JSONObject();
54         paramJson.put("vimId", "vimId");
55         paramJson.put("tenantId", "tenantId");
56     }
57
58     @Test
59     public void testgetLimits() throws ServiceException {
60         new MockUp<HttpRest>() {
61
62             @Mock
63             public RestfulResponse get(String servicePath, RestfulParametes restParametes, RestfulOptions option)
64                     throws ServiceException {
65                 RestfulResponse rsp = new RestfulResponse();
66                 rsp.setStatus(200);
67                 return rsp;
68             }
69
70         };
71     }
72 }