2 * Copyright 2017 Huawei Technologies Co., Ltd.
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
17 package org.openo.nfvo.resmanagement.service.rest;
\r
19 import static org.junit.Assert.assertNotNull;
\r
21 import javax.servlet.http.HttpServletRequest;
\r
23 import org.junit.Before;
\r
24 import org.junit.Test;
\r
25 import org.openo.baseservice.remoteservice.exception.ServiceException;
\r
26 import org.openo.nfvo.resmanagement.service.business.impl.LimitsBusinessImpl;
\r
27 import org.openo.nfvo.resmanagement.service.business.inf.LimitsBusiness;
\r
28 import org.springframework.mock.web.MockHttpServletRequest;
\r
31 import mockit.MockUp;
\r
32 import net.sf.json.JSONObject;
\r
40 * @version NFVO 0.5 Feb 9, 2017
\r
42 public class LimitsRoaTest {
\r
44 private LimitsRoa roa;
\r
46 private LimitsBusiness limitsBusiness;
\r
49 public void setUp() {
\r
50 roa = new LimitsRoa();
\r
51 limitsBusiness = new LimitsBusinessImpl();
\r
52 roa.setLimitsBusiness(limitsBusiness);
\r
56 public void testGetLimitsResource() throws ServiceException {
\r
57 new MockUp<LimitsBusinessImpl>() {
\r
60 public JSONObject getLimits(String vimId) throws ServiceException {
\r
61 return new JSONObject();
\r
64 HttpServletRequest context = new MockHttpServletRequest();
\r
65 JSONObject result = roa.getLimits(context, "vimId");
\r
66 assertNotNull(result);
\r