From a84b3aeee6331420f3017ff65764823058aa8b95 Mon Sep 17 00:00:00 2001 From: yufei_zhou Date: Sat, 7 Oct 2017 11:56:25 +0800 Subject: Make code compliant with ONAP requirement Change-Id: I60f1a13ac612b29df22d1cacd2d57ff314a745d6 Issue-ID: VFC-53 Signed-off-by: yufei_zhou --- .../nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java | 6 ++++ .../vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java | 32 +++++++++++----------- .../driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java | 4 +-- .../adaptor/Cbam2DriverResponseConverter.java | 5 ++-- .../svnfm/adaptor/Driver2CbamRequestConverter.java | 2 -- .../adaptor/InstantiateVnfContinueRunnable.java | 4 +-- .../adaptor/TerminateVnfContinueRunnable.java | 4 +-- .../vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java | 6 ++++ .../vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java | 2 +- .../driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java | 4 +-- .../driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java | 12 ++++---- .../vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java | 2 +- .../vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java | 5 ++-- .../vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java | 8 +++--- .../svnfm/catalog/impl/CatalogMgmrImplTest.java | 5 +++- 15 files changed, 57 insertions(+), 44 deletions(-) (limited to 'nokia') diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java index 0d75003b..e405f868 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/AaiVnfmInfo.java @@ -21,20 +21,26 @@ import java.util.List; import org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.bo.entity.EsrSystemInfo; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.annotations.SerializedName; public class AaiVnfmInfo { + @SerializedName("vnfm-id") @JsonProperty("vnfm-id") private String vnfmId; + @SerializedName("vim-id") @JsonProperty("vim-id") private String vimId; + @SerializedName("certificate-url") @JsonProperty("certificate-url") private String certificateUrl; + @SerializedName("resource-version") @JsonProperty("resource-version") private String resourceVersion; + @SerializedName("esr-system-info-list") @JsonProperty("esr-system-info-list") private List esrSystemInfoList; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java index 75e0e7fa..9e750ea1 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/bo/entity/EsrSystemInfo.java @@ -16,52 +16,52 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.bo.entity; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.annotations.SerializedName; public class EsrSystemInfo { - @JsonProperty("esr-system-info-id") + @SerializedName("esr-system-info-id") private String esrSystemId; - @JsonProperty("system-name") + @SerializedName("system-name") private String esrSystemName; - @JsonProperty("type") + @SerializedName("type") private String type; - @JsonProperty("vendor") + @SerializedName("vendor") private String vendor; - @JsonProperty("version") + @SerializedName("version") private String version; - @JsonProperty("service-url") + @SerializedName("service-url") private String serviceUrl; - @JsonProperty("user-name") + @SerializedName("user-name") private String userName; - @JsonProperty("password") + @SerializedName("password") private String password; - @JsonProperty("protocal") + @SerializedName("protocal") private String protocal; - @JsonProperty("ssl-cacert") + @SerializedName("ssl-cacert") private String sslCacert; - @JsonProperty("ssl-insecure") + @SerializedName("ssl-insecure") private String sslInsecure; - @JsonProperty("ip-address") + @SerializedName("ip-address") private String ip; - @JsonProperty("port") + @SerializedName("port") private String port; - @JsonProperty("cloud-domain") + @SerializedName("cloud-domain") private String cloudDomain; - @JsonProperty("default-tenant") + @SerializedName("default-tenant") private String defaultTenant; public String getEsrSystemId() { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java index 00fc0000..a8286f86 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImpl.java @@ -20,13 +20,11 @@ import java.io.IOException; import java.util.HashMap; import org.apache.http.client.ClientProtocolException; -import org.apache.http.impl.client.HttpClientBuilder; import org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.bo.AaiVnfmInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.aai.inf.AaiMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants; import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpClientProcessorInf; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -64,7 +62,7 @@ public class AaiMgmrInfImpl implements AaiMgmrInf{ private String operateHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException { String url=adaptorEnv.getAaiApiUriFront() + httpPath; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); String responseStr = httpClientProcessor.process(url, method, map, gson.toJson(httpBodyObj)).getContent(); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java index b79104f9..e741b78e 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Cbam2DriverResponseConverter.java @@ -80,8 +80,7 @@ public class Cbam2DriverResponseConverter { } public QueryVnfResponse queryRspConvert(CBAMQueryVnfResponse cbamResponse) { - QueryVnfResponse response = new QueryVnfResponse(); - VnfInfo vnf = new VnfInfo(); + QueryVnfResponse vnf = new QueryVnfResponse(); vnf.setVnfdId(cbamResponse.getVnfdId()); vnf.setVersion(cbamResponse.getVnfdVersion()); vnf.setVnfInstanceId(cbamResponse.getId()); @@ -91,7 +90,7 @@ public class Cbam2DriverResponseConverter { vnf.setVnfProvider(cbamResponse.getVnfProvider()); vnf.setVnfStatus(cbamResponse.getInstantiationState()); vnf.setVnfType(cbamResponse.getVnfSoftwareVersion()); - return response; + return vnf; } public OperStatusVnfResponse operRspConvert(OperationExecution oper) { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java index a6dcc0af..5b9f95fe 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/Driver2CbamRequestConverter.java @@ -35,12 +35,10 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.GrantInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VimComputeResourceFlavour; - import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest; - import org.springframework.stereotype.Component; @Component diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java index 76a97d71..09cfee86 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java @@ -21,8 +21,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.http.client.ClientProtocolException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf.CatalogMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfResponse; @@ -39,6 +37,8 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.VnfPackageInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.inf.NslcmMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class InstantiateVnfContinueRunnable implements Runnable { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java index 4485ad18..37348420 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java @@ -21,8 +21,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.http.client.ClientProtocolException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.inf.CbamMgmrInf; @@ -37,6 +35,8 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmNotifyLCMEventsRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.entity.ResourceDefinition; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.inf.NslcmMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java index 10802c87..29d2fc2d 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java @@ -107,6 +107,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ vnfContinueProcessorInf.continueInstantiateVnf(driverRequest, vnfInstanceId, jobId.toString(), nslcmMgmr, catalogMgmr, cbamMgmr, requestConverter, jobDbManager); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> instantiateVnf. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } @@ -133,6 +134,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ vnfContinueProcessorInf.continueTerminateVnf(driverRequest, vnfInstanceId, jobId, nslcmMgmr, cbamMgmr, requestConverter, jobDbManager); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> terminateVnf. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } @@ -160,6 +162,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ CBAMQueryVnfResponse cbamResponse = cbamMgmr.queryVnf(vnfInstanceId); driverResponse = responseConverter.queryRspConvert(cbamResponse); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> queryVnf. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } @@ -177,6 +180,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ String execId = jobInfo.getVnfmExecutionId(); cbamResponse = cbamMgmr.queryOperExecution(execId); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> getOperStatus. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } @@ -193,6 +197,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ CBAMScaleVnfResponse cbamResponse = cbamMgmr.scaleVnf(cbamRequest, vnfInstanceId); driverResponse = responseConverter.scaleRspConvert(cbamResponse); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> scaleVnf. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } @@ -207,6 +212,7 @@ public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ CBAMHealVnfResponse cbamResponse = cbamMgmr.healVnf(cbamRequest, vnfInstanceId); driverResponse = responseConverter.healRspConvert(cbamResponse); } catch (Exception e) { + logger.error("error VnfmDriverMgmrImpl --> healVnf. ", e); throw new VnfmDriverException(HttpStatus.SC_INTERNAL_SERVER_ERROR, CommonConstants.HTTP_ERROR_DESC_500); } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java index 2e4dd999..e8bb6be4 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java @@ -52,7 +52,7 @@ public class CatalogMgmrImpl implements CatalogMgmrInf{ public VnfPackageInfo queryVnfPackage(String vnfPackageId) throws ClientProtocolException, IOException { String url=adaptorEnv.getCatalogApiUriFront() + String.format(CommonConstants.RetrieveVnfPackagePath, vnfPackageId); - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); String bodyPostStr = String.format(CommonConstants.RetrieveCbamTokenPostStr, adaptorEnv.getGrantType(), adaptorEnv.getClientId(), adaptorEnv.getClientSecret()); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java index ee6b011a..79966f63 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java @@ -60,7 +60,7 @@ public class CbamMgmrImpl implements CbamMgmrInf { private String retrieveToken() throws ClientProtocolException, IOException, JSONException { String result = null; String url= adaptorEnv.getCbamApiUriFront() + CommonConstants.RetrieveCbamTokenPath; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put(CommonConstants.ACCEPT, "*/*"); map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_FORM_URLENCODED_VALUE); @@ -175,7 +175,7 @@ public class CbamMgmrImpl implements CbamMgmrInf { String url= adaptorEnv.getCbamApiUriFront() + httpPath; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put(CommonConstants.AUTHORIZATION, "bearer " + token); map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java index 8f668c2f..675229f1 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java @@ -86,17 +86,19 @@ public class MsbMgmrImpl implements IMsbMgmr { public String getServiceUrlInMsbBySeriveNameAndPort(String serviceName, String version) throws RouteException { + String serviceUrl = null; MSBServiceClient msbClient = new MSBServiceClient(adaptorEnv.getMsbIp(), adaptorEnv.getMsbPort()); MicroServiceFullInfo microServiceInfo = msbClient.queryMicroServiceInfo(serviceName, version); if(null == microServiceInfo) { logger.error("There is no service in MSB for serviceName = {} and version = {}", serviceName, version); } - - String serviceUrl = microServiceInfo.getUrl(); - logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl); - - return serviceUrl; + else + { + serviceUrl = microServiceInfo.getUrl(); + logger.info("Service Url in MSB for serviceName = {} and version = {} is {}", serviceName, version, serviceUrl); + } + return serviceUrl; } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java index e9c58122..57e8fbac 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java @@ -89,7 +89,7 @@ public class NslcmMgmrImpl implements NslcmMgmrInf{ private String operateNslcmHttpTask(Object httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException { String url=adaptorEnv.getLcmApiUriFront() + httpPath; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); String responseStr = httpClientProcessor.process(url, method, map, gson.toJson(httpBodyObj)).getContent(); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java index 23a4893f..ceeb6fba 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/aai/impl/AaiMgmrInfImplTest.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.HashMap; import org.apache.http.client.ClientProtocolException; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -52,7 +53,7 @@ public class AaiMgmrInfImplTest { String json = "{" + "\"vnfm-id\":\"vnfm-id_001\"," - + "\"esr-system-info-list\":[{\"ip\" : \"1.3.5.6\"}]" + + "\"esr-system-info-list\":[{\"ip-address\" : \"1.3.5.6\"}]" + "}" + ""; HttpResult httpResult = new HttpResult(); @@ -65,6 +66,6 @@ public class AaiMgmrInfImplTest { public void testQueryVnfPackage() throws ClientProtocolException, IOException { AaiVnfmInfo vnfmInfo = aaiMgmr.queryVnfm(vnfmId); -// Assert.assertEquals("1.3.5.6", vnfmInfo.getEsrSystemInfoList().get(0).getIp()); + Assert.assertEquals("1.3.5.6", vnfmInfo.getEsrSystemInfoList().get(0).getIp()); } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java index aa24bf3c..b738fcc5 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImplTest.java @@ -180,11 +180,10 @@ public class VnfmDriverMgmrImplTest { public void testQueryVnf() throws ClientProtocolException, IOException { CBAMQueryVnfResponse mockCbamResponse = new CBAMQueryVnfResponse(); mockCbamResponse.setId("executionId_001"); - + mockCbamResponse.setVnfdId(vnfInstanceId); when(cbamMgmr.queryVnf(Mockito.anyString())).thenReturn(mockCbamResponse); - ScaleVnfRequest request = new ScaleVnfRequest(); - request.setType(CommonEnum.ScaleType.SCALE_IN); QueryVnfResponse response = vnfmDriverMgmr.queryVnf(vnfmId, vnfInstanceId); + Assert.assertEquals(vnfInstanceId, response.getVnfdId()); } @Test @@ -201,8 +200,9 @@ public class VnfmDriverMgmrImplTest { cbamResponse.setGrantId("001002001"); when(cbamMgmr.queryOperExecution(Mockito.anyString())).thenReturn(cbamResponse); - ScaleVnfRequest request = new ScaleVnfRequest(); OperStatusVnfResponse response = vnfmDriverMgmr.getOperStatus(vnfmId, "1"); + + Assert.assertEquals("executionId_001", response.getJobId()); } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java index a8ad4ae3..33ca1761 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/test/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImplTest.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.util.HashMap; import org.apache.http.client.ClientProtocolException; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -61,10 +62,12 @@ public class CatalogMgmrImplTest { when(httpClientProcessor.process(Mockito.anyString(), Mockito.any(RequestMethod.class), Mockito.any(HashMap.class), Mockito.anyString())).thenReturn(httpResult); } + @Test public void testQueryVnfPackage() throws ClientProtocolException, IOException { - VnfPackageInfo response = catalogMgmr.queryVnfPackage(vnfPackageId); + VnfPackageInfo packageInfo = catalogMgmr.queryVnfPackage(vnfPackageId); + Assert.assertEquals("1.3.5.6", packageInfo.getDownloadUri()); } } -- cgit 1.2.3-korg