summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluxin <luxin7@huawei.com>2017-09-26 10:32:35 +0800
committerluxin <luxin7@huawei.com>2017-09-26 10:32:35 +0800
commit24ca0c1ac3a84de0bfe0a35d0db9883439bb5777 (patch)
treee916bc66ffd59c6250fcffcff0eb87a316df9380
parent963ed36db35fd5e302f9a73661b2dab96339b433 (diff)
Add constant instead of duplicating literal
Change-Id: I333527f8f71517a941e145a2d83a36e9046a1972 Issue-Id:VFC-391 Signed-off-by: luxin <luxin7@huawei.com>
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java2
-rw-r--r--huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java36
2 files changed, 24 insertions, 14 deletions
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
index 77c0fcc3..936be09c 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/constant/Constant.java
@@ -63,6 +63,8 @@ public class Constant {
public static final String HEADER_AUTH_TOKEN = "accessSession";
+ public static final String X_AUTH_TOKEN = "X-Auth-Token";
+
public static final String DOWNLOADCSAR_SUCCESS = "Success";
public static final int UNZIP_SUCCESS = 0;
diff --git a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java
index c2c6d5c0..c86e65d2 100644
--- a/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java
+++ b/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/onap/vfc/nfvo/vnfm/svnfm/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java
@@ -42,6 +42,14 @@ public class ConnectMgrVnfm {
private static final Logger LOG = LoggerFactory.getLogger(ConnectMgrVnfm.class);
+ private static final String CONNECT_FAIL = "connect fail, code:";
+
+ private static final String CONNECT_JSONEXCEPTION = "function=connect, msg=connect JSONException e={}.";
+
+ private static final String CONNECT_VNFMEXCEPTION = "function=connect, msg=connect VnfmException e={}.";
+
+ private static final String CONNECT_IOEXCEPTION = "function=connect, msg=connect IOException e={}.";
+
private String accessSession;
private String roaRand;
@@ -63,10 +71,10 @@ public class ConnectMgrVnfm {
}
/**
- * Make connection
* <br>
- *
+ *
* @param vnfmObj
+ * @param authModel
* @return
* @since VFC 1.0
*/
@@ -95,15 +103,15 @@ public class ConnectMgrVnfm {
setRoaRand(tokenObj.getString("roa_rand"));
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {
@@ -149,15 +157,15 @@ public class ConnectMgrVnfm {
setAccessSession(header.getValue());
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {
@@ -201,15 +209,15 @@ public class ConnectMgrVnfm {
setRoaRand(tokenObj.getString("roa_rand"));
statusCode = HttpStatus.SC_OK;
} else {
- LOG.error("connect fail, code:" + statusCode + " re:" + result);
+ LOG.error(CONNECT_FAIL + statusCode + " re:" + result);
}
} catch(JSONException e) {
- LOG.error("function=connect, msg=connect JSONException e={}.", e);
+ LOG.error(CONNECT_JSONEXCEPTION, e);
} catch(VnfmException e) {
- LOG.error("function=connect, msg=connect VnfmException e={}.", e);
+ LOG.error(CONNECT_VNFMEXCEPTION, e);
} catch(IOException e) {
- LOG.error("function=connect, msg=connect IOException e={}.", e);
+ LOG.error(CONNECT_IOEXCEPTION, e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {