summaryrefslogtreecommitdiffstats
path: root/huawei
diff options
context:
space:
mode:
Diffstat (limited to 'huawei')
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java12
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java12
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java8
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java5
4 files changed, 14 insertions, 23 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java
index d88cf789..34943770 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java
@@ -90,10 +90,7 @@ public class AuthRoa {
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();
@@ -117,8 +114,8 @@ public class AuthRoa {
*/
@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();
@@ -139,8 +136,7 @@ public class AuthRoa {
*/
@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");
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java
index bcc24878..fe9f9530 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java
@@ -1,5 +1,5 @@
/*
- * 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.
@@ -16,12 +16,10 @@
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.core.Context;
import javax.ws.rs.core.MediaType;
import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.adapter.impl.AdapterResourceManager;
@@ -30,7 +28,6 @@ import org.slf4j.LoggerFactory;
import net.sf.json.JSONObject;
-
/**
* Provide interfaces of resource for VNFM.
* <br/>
@@ -45,7 +42,6 @@ public class VnfAdapterResourceRoa {
private static final Logger LOG = LoggerFactory.getLogger(VnfAdapterResourceRoa.class);
-
/**
* Provide function of grant resource.
* <br/>
@@ -55,13 +51,13 @@ public class VnfAdapterResourceRoa {
* @since VFC 1.0
*/
@GET
- public String getAllCloudInfo(@Context HttpServletRequest context) {
+ public String getAllCloudInfo() {
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();
- JSONObject resultObj = arm.getAllCloud("","");
+ JSONObject resultObj = arm.getAllCloud("", "");
return resultObj.getString("vim_id");
}
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java
index 027a9da2..2369b02a 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java
@@ -1,5 +1,5 @@
/*
- * 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.
@@ -174,11 +174,10 @@ public class AuthRoaTest {
@Test
public void testDelAuthToken() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
- HttpServletRequest mockInstance = proxyStub.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");
@@ -188,11 +187,10 @@ public class AuthRoaTest {
@Test
public void testShakehand() {
MockUp<HttpServletRequest> proxyStub = new MockUp<HttpServletRequest>() {};
- HttpServletRequest mockInstance = proxyStub.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");
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java
index d8ea9cd4..58c584d8 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java
@@ -43,13 +43,14 @@ public class VnfAdapterResourceRoaTest {
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();
- String result = vnfAdapter.getAllCloudInfo(null);
- assertEquals("test", result);
+ String result = vnfAdapter.getAllCloudInfo();
+ assertEquals("12345", result);
}
}