Remove unused parameter in restRoa 75/15875/2
authorluxin <luxin7@huawei.com>
Wed, 27 Sep 2017 09:23:25 +0000 (17:23 +0800)
committerluxin <luxin7@huawei.com>
Wed, 27 Sep 2017 09:36:25 +0000 (17:36 +0800)
Change-Id: Ia627e06fbe42825825a3b512b53fdff9bb32b219
Issue-Id:VFC-425
Signed-off-by: luxin <luxin7@huawei.com>
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoa.java
huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoa.java
huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/AuthRoaTest.java
huawei/vnfmadapter/VnfmadapterService/service/src/test/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/rest/VnfAdapterResourceRoaTest.java

index d88cf78..3494377 100644 (file)
@@ -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");
index bcc2487..fe9f953 100644 (file)
@@ -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.
 
 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");
     }
index 027a9da..2369b02 100644 (file)
@@ -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");
index d8ea9cd..58c584d 100644 (file)
@@ -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);
     }
 
 }