Change-Id: Ia627e06fbe42825825a3b512b53fdff9bb32b219
Issue-Id:VFC-425
Signed-off-by: luxin <luxin7@huawei.com>
JSONObject data = authResult.getJSONObject("data");
resp.setStatus(Constant.HTTP_OK);
JSONObject data = authResult.getJSONObject("data");
resp.setStatus(Constant.HTTP_OK);
- // resp.setHeader("accessSession", data.getString("accessSession"));
- return data.toString();// String.format(ParamConstants.GET_TOKEN_SUC_RESP,
- // data.getString(Constant.USERNAME),
- // data.getString(Constant.USERNAME), data.getString("roaRand"));
+ return data.toString();
} else if(authResult.getInt(Constant.RETCODE) == Constant.HTTP_INNERERROR) {
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(authResult.getString("data")).build();
} else if(authResult.getInt(Constant.RETCODE) == Constant.HTTP_INNERERROR) {
Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(authResult.getString("data")).build();
*/
@DELETE
@Path("/auth/tokens/{userName}/{roarand}")
*/
@DELETE
@Path("/auth/tokens/{userName}/{roarand}")
- public String delAuthToken(@Context HttpServletRequest context, @PathParam(Constant.USERNAME) String userName,
- @PathParam("roarand") String roarand, @Context HttpServletResponse resp) {
+ public String delAuthToken(@PathParam(Constant.USERNAME) String userName, @PathParam("roarand") String roarand,
+ @Context HttpServletResponse resp) {
LOG.warn("function=logout, msg=enter to logout");
JSONObject resultJson = new JSONObject();
LOG.warn("function=logout, msg=enter to logout");
JSONObject resultJson = new JSONObject();
*/
@GET
@Path("/nfvo/shakehand")
*/
@GET
@Path("/nfvo/shakehand")
- public String shakehand(@Context HttpServletRequest context, @QueryParam("roattr") String roattr,
- @Context HttpServletResponse resp) {
+ public String shakehand(@QueryParam("roattr") String roattr, @Context HttpServletResponse resp) {
JSONObject resultJson = new JSONObject();
resultJson.put("status", "running");
resultJson.put("description", "Operation success");
JSONObject resultJson = new JSONObject();
resultJson.put("status", "running");
resultJson.put("description", "Operation success");
- * Copyright 2016 Huawei Technologies Co., Ltd.
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.rest;
package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.rest;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.adapter.impl.AdapterResourceManager;
import javax.ws.rs.core.MediaType;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.adapter.impl.AdapterResourceManager;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
/**
* Provide interfaces of resource for VNFM.
* <br/>
/**
* Provide interfaces of resource for VNFM.
* <br/>
private static final Logger LOG = LoggerFactory.getLogger(VnfAdapterResourceRoa.class);
private static final Logger LOG = LoggerFactory.getLogger(VnfAdapterResourceRoa.class);
/**
* Provide function of grant resource.
* <br/>
/**
* Provide function of grant resource.
* <br/>
- public String getAllCloudInfo(@Context HttpServletRequest context) {
+ public String getAllCloudInfo() {
LOG.info("function=getAllCloudInfo, msg=getAllCloudInfo resource");
LOG.info("function=getAllCloudInfo, msg=getAllCloudInfo resource");
- //Find a way to get url and pass it getAllCloud(); //NOSONAR
+ // Find a way to get url and pass it getAllCloud()
AdapterResourceManager arm = new AdapterResourceManager();
AdapterResourceManager arm = new AdapterResourceManager();
- JSONObject resultObj = arm.getAllCloud("","");
+ JSONObject resultObj = arm.getAllCloud("", "");
return resultObj.getString("vim_id");
}
return resultObj.getString("vim_id");
}
- * Copyright 2016 Huawei Technologies Co., Ltd.
+ * Copyright 2016-2017 Huawei Technologies Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@Test
public void testDelAuthToken() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
@Test
public void testDelAuthToken() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
- HttpServletRequest mockInstance = proxyStub.getMockInstance();
MockUp<HttpServletResponse> proxyResStub = new MockUp<HttpServletResponse>() {};
HttpServletResponse mockResInstance = proxyResStub.getMockInstance();
MockUp<HttpServletResponse> proxyResStub = new MockUp<HttpServletResponse>() {};
HttpServletResponse mockResInstance = proxyResStub.getMockInstance();
- String result = authRoa.delAuthToken(mockInstance, null, null, mockResInstance);
+ String result = authRoa.delAuthToken(null, null, mockResInstance);
JSONObject resultJson = new JSONObject();
resultJson.put("Information", "Operation success");
JSONObject resultJson = new JSONObject();
resultJson.put("Information", "Operation success");
@Test
public void testShakehand() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
@Test
public void testShakehand() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
- HttpServletRequest mockInstance = proxyStub.getMockInstance();
MockUp<HttpServletResponse> proxyResStub = new MockUp<HttpServletResponse>() {};
HttpServletResponse mockResInstance = proxyResStub.getMockInstance();
MockUp<HttpServletResponse> proxyResStub = new MockUp<HttpServletResponse>() {};
HttpServletResponse mockResInstance = proxyResStub.getMockInstance();
- String result = authRoa.shakehand(mockInstance, null, mockResInstance);
+ String result = authRoa.shakehand(null, mockResInstance);
JSONObject resultJson = new JSONObject();
resultJson.put("status", "running");
JSONObject resultJson = new JSONObject();
resultJson.put("status", "running");
public JSONObject getAllCloud(String url, String conntoken) {
JSONObject resultObj = new JSONObject();
resultObj.put("dn", "test");
public JSONObject getAllCloud(String url, String conntoken) {
JSONObject resultObj = new JSONObject();
resultObj.put("dn", "test");
+ resultObj.put("vim_id", "12345");
return resultObj;
}
};
VnfAdapterResourceRoa vnfAdapter = new VnfAdapterResourceRoa();
return resultObj;
}
};
VnfAdapterResourceRoa vnfAdapter = new VnfAdapterResourceRoa();
- String result = vnfAdapter.getAllCloudInfo(null);
- assertEquals("test", result);
+ String result = vnfAdapter.getAllCloudInfo();
+ assertEquals("12345", result);