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