Fix the comments 15/10515/1
authorc00149107 <chenchuanyu@huawei.com>
Wed, 6 Sep 2017 07:53:47 +0000 (15:53 +0800)
committerc00149107 <chenchuanyu@huawei.com>
Wed, 6 Sep 2017 07:53:47 +0000 (15:53 +0800)
Fix the review comments for vf-c adapter

Change-Id: I1b2a7de490b7d46c07d522f5720ef005bfffe67d
Issue-ID:SO-109
Signed-off-by: c00149107 <chenchuanyu@huawei.com>
15 files changed:
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java [moved from adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiAdapter.java with 98% similarity]
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/CommonConstant.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/HttpCode.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/exceptions/ApplicationException.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/LocationConstraint.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsInstantiateReq.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsParameters.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/NsProgressStatus.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/model/RestfulResponse.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java

@@ -30,7 +30,7 @@ import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
  * @author
  * @version     ONAP Amsterdam Release  2017-08-28
  */
-public class AaiAdapter {
+public class AaiUtil {
 
     public static RestfulResponse addRelation(String serviceInstanceID, String resourceInstanceID)
     {
index 221448c..afea05c 100644 (file)
@@ -114,7 +114,7 @@ public class VfcManager {
         LOGGER.info("create ns -> end");
         LOGGER.info("save segment and operaton info -> begin");
         // Step 5: add relation between service and NS
-        AaiAdapter.addRelation(segInput.getNsOperationKey().getServiceId(), nsInstanceId);
+        AaiUtil.addRelation(segInput.getNsOperationKey().getServiceId(), nsInstanceId);
 
         // Step 6: save resource operation information
         ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus(
@@ -168,7 +168,7 @@ public class VfcManager {
         }
 
         // Step3: remove relation info between service and ns
-        AaiAdapter.removeRelation(nsOperationKey.getServiceId(), nsInstanceId);
+        AaiUtil.removeRelation(nsOperationKey.getServiceId(), nsInstanceId);
         LOGGER.info("delete segment information -> end");
 
         // Step4: update service segment operation status
@@ -322,6 +322,7 @@ public class VfcManager {
     public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) {
 
         ValidateUtil.assertObjectNotNull(jobId);
+        // Step 1: query the current resource operation status
         ResourceOperationStatus nsOperInfo = RequestsDatabase.getResourceOperationStatus(nsOperationKey.getServiceId(),
                 nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateId());
 
@@ -334,6 +335,7 @@ public class VfcManager {
         ValidateUtil.assertObjectNotNull(rsp);
         LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
         LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
+        //Step 3:check the response staus
         if(!HttpCode.isSucess(rsp.getStatus())) {
             LOGGER.info("fail to query job status");
             nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
@@ -370,7 +372,7 @@ public class VfcManager {
             RequestsDatabase.updateResOperStatus(nsOperInfo);
             throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
         } else {
-            // do nothing
+            LOGGER.error("unexcepted response status");
         }
         LOGGER.info("query ns status -> end");
 
index c2a9a68..b2fc445 100644 (file)
@@ -32,18 +32,6 @@ public class CommonConstant {
     
     public static final String STR_EMPTY = "";
 
-    public static final String CATALOGUE_QUERY_SVC_TMPL_NODETYPE_URL = "/openoapi/catalog/v1/servicetemplates/nesting";
-
-    public static final String SDNO_CREATE_URL = "/openoapi/sdnonslcm/v1/ns";
-
-    public static final String SDNO_INSTANTIATE_URL = "/openoapi/sdnonslcm/v1/ns/%s/instantiate";
-
-    public static final String SDNO_TERMINATE_URL = "/openoapi/sdnonslcm/v1/ns/%s/terminate";
-
-    public static final String SDNO_DELETE_URL = "/openoapi/sdnonslcm/v1/ns/%s";
-
-    public static final String SDNO_QUERY_URL = "/openoapi/sdnonslcm/v1/jobs/%s";
-
     public static final String NFVO_CREATE_URL = "/openoapi/nslcm/v1/ns";
 
     public static final String NFVO_INSTANTIATE_URL = "/openoapi/nslcm/v1/ns/%s/instantiate";
@@ -54,11 +42,6 @@ public class CommonConstant {
 
     public static final String NFVO_QUERY_URL = "/openoapi/nslcm/v1/jobs/%s";
 
-    public static final String GSO_CREATE_URL = "/openoapi/gso/v1/services";
-
-    public static final String GSO_DELETE_URL = "/openoapi/gso/v1/services/%s";
-
-    public static final String GSO_QUERY_URL = "/openoapi/gso/v1/services/%s/operations/%s";
 
     public static final String LEFT_QUOTE_LEFT_BRACE = "\"\\{";
 
index 5df1a9f..652de97 100644 (file)
@@ -26,7 +26,7 @@ package org.openecomp.mso.adapters.vfc.constant;
  * identification of adapter exception
  * 
  * @author
- * @version GSO 0.5 2016/9/3
+ * @version ONAP Amsterdam Release 2017-9-6
  */
 public class DriverExceptionID {
 
@@ -45,14 +45,10 @@ public class DriverExceptionID {
 
     public static final String FAIL_TO_CREATE_NS = "Fail to create ns";
 
-    public static final String FAIL_TO_CREATE_GSO_NS = "Fail to create gso ns";
-
     public static final String INVALID_RESPONSEE_FROM_DELETE_OPERATION = "Invalid response from delete operation";
 
     public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation";
 
-    public static final String FAIL_TO_DELETE_GSO_NS = "Fail to delete gso ns";
-
     public static final String FAIL_TO_DELETE_NS = "Fail to delete ns";
 
     public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns";
index b9bb786..0eda7bd 100644 (file)
@@ -72,7 +72,7 @@ public class HttpCode {
      * <p>
      * </p>
      * 
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     private HttpCode() {
 
@@ -83,7 +83,7 @@ public class HttpCode {
      * 
      * @param httpCode response code
      * @return true or false
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     public static boolean isSucess(int httpCode) {
         return httpCode / 100 == 2;
index 831eaab..6a78d2e 100644 (file)
@@ -37,7 +37,7 @@ public class ApplicationException extends WebApplicationException {
      * 
      * @param errorCode error status
      * @param errorDetail error detail
-     * @since GSO 0.5
+     * @since  ONAP Amsterdam Release 2017-9-6
      */
     public ApplicationException(int errorCode, Object errorDetail) {
         super(Response.status(errorCode).entity(errorDetail).type(MediaType.APPLICATION_JSON).build());
index 6c1d209..7e8a9ce 100644 (file)
@@ -26,7 +26,7 @@ package org.openecomp.mso.adapters.vfc.model;
  * request model for instatiate
  * 
  * @author
- * @version GSO 0.5 2016/9/3
+ * @version ONAP Amsterdam Release 2017-9-6
  */
 public class NsInstantiateReq extends NsParameters {
 
index 414c1f1..d68da47 100644 (file)
@@ -28,7 +28,7 @@ import java.util.List;
  * response model of query operation status
  * 
  * @author
- * @version GSO 0.5 2016/9/3
+ * @version ONAP Amsterdam Release 2017-9-6
  */
 public class NsProgressStatus {
 
index 510f613..483c952 100644 (file)
@@ -21,12 +21,24 @@ package org.openecomp.mso.adapters.vfc.model;
 \r
 import java.util.Map;\r
 \r
+/**\r
+ * The Unified Restful Reponse Class\r
+ * <br>\r
+ * <p>\r
+ * </p>\r
+ * \r
+ * @author\r
+ * @version     ONAP Amsterdam Release  2017-09-06\r
+ */\r
 public class RestfulResponse {\r
 \r
+    // the response content\r
     private String responseContent;\r
 \r
+    //the response status\r
     private int status;\r
 \r
+    //the response header\r
     private Map<String, String> respHeaderMap;\r
 \r
     public RestfulResponse() {\r
index 579c607..34beb02 100644 (file)
@@ -36,7 +36,7 @@ import org.openecomp.mso.logger.MsoLogger;
  * </p>
  * 
  * @author
- * @version GSO 0.5 2016/9/1
+ * @version ONAP Amsterdam Release 2017-9-6
  */
 public class JsonUtil {
 
@@ -61,7 +61,7 @@ public class JsonUtil {
      * <p>
      * </p>
      * 
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     private JsonUtil() {
 
@@ -73,7 +73,7 @@ public class JsonUtil {
      * @param jsonstr json string.
      * @param type that convert json string to
      * @return model object
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     public static <T> T unMarshal(String jsonstr, Class<T> type) {
         try {
@@ -90,7 +90,7 @@ public class JsonUtil {
      * @param jsonstr json string.
      * @param type that convert json string to
      * @return model object
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     public static <T> T unMarshal(String jsonstr, TypeReference<T> type) {
         try {
@@ -106,7 +106,7 @@ public class JsonUtil {
      * 
      * @param srcObj data object
      * @return json string
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     public static String marshal(Object srcObj) {
         try {
@@ -121,7 +121,7 @@ public class JsonUtil {
      * Get mapper.<br/>
      * 
      * @return mapper
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     public static ObjectMapper getMapper() {
         return MAPPER;
index 95025af..19cbca8 100644 (file)
@@ -53,7 +53,7 @@ import org.openecomp.mso.logger.MsoLogger;
  * utility to invoke restclient
  * 
  * @author
- * @version GSO 0.5 2016/9/3
+ * @version ONAP Amsterdam Release 2017-9-6
  */
 public class RestfulUtil {
 
index 1d8549c..37228c8 100644 (file)
@@ -36,7 +36,7 @@ public class ValidateUtil {
      * <p>\r
      * </p>\r
      * \r
-     * @since GSO 0.5\r
+     * @since ONAP Amsterdam Release 2017-9-6\r
      */\r
     private ValidateUtil() {\r
 \r
@@ -47,7 +47,7 @@ public class ValidateUtil {
      * \r
      * @param paramValue parameter data\r
      * @param name of parameter\r
-     * @since GSO 0.5\r
+     * @since ONAP Amsterdam Release 2017-9-6\r
      */\r
     public static void assertStringNotNull(String paramValue, String paramName) {\r
         if(null != paramValue && !paramValue.isEmpty()) {\r
@@ -62,7 +62,7 @@ public class ValidateUtil {
      * Assert object is null.<br/>\r
      * \r
      * @param object data object\r
-     * @since GSO 0.5\r
+     * @since ONAP Amsterdam Release 2017-9-6\r
      */\r
     public static void assertObjectNotNull(Object object) {\r
         if(null == object) {\r
index 3b43a15..46ab134 100644 (file)
@@ -108,7 +108,7 @@ public class VfcAdapterTest {
      * Mock to get request body.<br/>
      * 
      * @param file json file path.
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     private void mockGetRequestBody(final String file) {
         new MockUp<RestfulUtil>() {
@@ -126,7 +126,7 @@ public class VfcAdapterTest {
      * @param file the path of file
      * @return json string
      * @throws IOException when fail to read
-     * @since GSO 0.5
+     * @since ONAP Amsterdam Release 2017-9-6
      */
     private String getJsonString(final String file) {
         if(ValidateUtil.isStrEmpty(file)) {