From: Lizi Date: Thu, 11 Jan 2018 03:29:08 +0000 (+0000) Subject: Fix the java code style issue. X-Git-Tag: v1.1.0~52 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;ds=sidebyside;h=refs%2Fchanges%2F17%2F27917%2F1;p=aai%2Fesr-server.git Fix the java code style issue. Change-Id: Ic4e307ff6bfede6e505b2d758b7f174532b2335b Issue-ID: AAI-622 Signed-off-by: Lizi --- diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java index e1db108..5b1f6cd 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysApp.java @@ -26,47 +26,46 @@ import org.onap.aai.esr.resource.VnfmManager; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import io.dropwizard.Application; import io.dropwizard.setup.Environment; public class ExtsysApp extends Application { - private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class); - - public static void main(String[] args) throws Exception { - new ExtsysApp().run(args); - } + private static final Logger LOGGER = LoggerFactory.getLogger(ExtsysApp.class); + + public static void main(String[] args) throws Exception { + new ExtsysApp().run(args); + } - @Override - public String getName() { - return "ONAP-ESR"; - } + @Override + public String getName() { + return "ONAP-ESR"; + } - @Override - public void run(ExtsysAppConfiguration configuration, Environment environment) { - LOGGER.info("Start to initialize esr."); - MsbConfig.setMsbServerAddr(configuration.getMsbServerAddr()); - MsbConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp()); - MsbConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort()); - environment.jersey().register(new EmsManager()); - environment.jersey().register(new ThirdpartySdncManager()); - environment.jersey().register(new VimManager()); - environment.jersey().register(new VnfmManager()); - environment.jersey().register(new ServiceTest()); - if (configuration.getRegistByHand().equals("true")){ - String MSB_IP=configuration.getMsbDiscoveryIp(); - Integer MSB_Port= Integer.valueOf(configuration.getMsbDiscoveryPort()); - MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port); - MsbHelper helper = new MsbHelper(msbClient); - try { - helper.registerMsb(); - LOGGER.info("Register esr-server to msb by java-sdk finished"); - } catch (Exception e) { - LOGGER.error("Register esr-server to msb by java-sdk failed", e); - } + @Override + public void run(ExtsysAppConfiguration configuration, Environment environment) { + LOGGER.info("Start to initialize esr."); + MsbConfig.setMsbServerAddr(configuration.getMsbServerAddr()); + MsbConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp()); + MsbConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort()); + environment.jersey().register(new EmsManager()); + environment.jersey().register(new ThirdpartySdncManager()); + environment.jersey().register(new VimManager()); + environment.jersey().register(new VnfmManager()); + environment.jersey().register(new ServiceTest()); + if (configuration.getRegistByHand().equals("true")) { + String MSB_IP = configuration.getMsbDiscoveryIp(); + Integer MSB_Port = Integer.valueOf(configuration.getMsbDiscoveryPort()); + MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port); + MsbHelper helper = new MsbHelper(msbClient); + try { + helper.registerMsb(); + LOGGER.info("Register esr-server to msb by java-sdk finished"); + } catch (Exception e) { + LOGGER.error("Register esr-server to msb by java-sdk failed", e); + } + } + LOGGER.info("Initialize extsys finished."); } - LOGGER.info("Initialize extsys finished."); - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java index 0ac6d7a..dd0a136 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java @@ -20,100 +20,99 @@ import com.fasterxml.jackson.annotation.JsonProperty; import io.dropwizard.Configuration; import org.hibernate.validator.constraints.NotEmpty; import org.jvnet.hk2.annotations.Service; - - import javax.validation.Valid; @Service public class ExtsysAppConfiguration extends Configuration { - @NotEmpty - private String template; - - @NotEmpty - private String defaultName = "ONAP-A&AI-ESR"; - - @NotEmpty - private String msbDiscoveryIp; - - @NotEmpty - private String msbDiscoveryPort; - - @NotEmpty - private String registByHand; - - @NotEmpty - private String msbServerAddr; - - @Valid - private String serviceIp; - - @JsonProperty - public String getTemplate() { - return template; - } - - @JsonProperty - public void setTemplate(String template) { - this.template = template; - } - - @JsonProperty - public String getDefaultName() { - return defaultName; - } - - @JsonProperty - public void setDefaultName(String name) { - this.defaultName = name; - } - - @JsonProperty - public String getMsbDiscoveryIp() { - return msbDiscoveryIp; - } - - @JsonProperty - public void setMsbDiscoveryIp(String discoveryIp) { - this.msbDiscoveryIp = discoveryIp; - } - - @JsonProperty - public String getMsbServerAddr() { - return msbServerAddr; - } - - @JsonProperty - public void setMsbServerAddr(String msbServerAddr) { - this.msbServerAddr = msbServerAddr; - } - @JsonProperty - public String getServiceIp() { - return serviceIp; - } - - @JsonProperty - public void setServiceIp(String serviceIp) { - this.serviceIp = serviceIp; - } - - @JsonProperty - public String getRegistByHand() { - return registByHand; - } - - @JsonProperty - public void setRegistByHand(String registByHand) { - this.registByHand = registByHand; - } - - @JsonProperty - public void setMsbDiscoveryPort(String msbDiscoveryPort) { - this.msbDiscoveryPort = msbDiscoveryPort; - } - - @JsonProperty - public String getMsbDiscoveryPort() { - return msbDiscoveryPort; - } + @NotEmpty + private String template; + + @NotEmpty + private String defaultName = "ONAP-A&AI-ESR"; + + @NotEmpty + private String msbDiscoveryIp; + + @NotEmpty + private String msbDiscoveryPort; + + @NotEmpty + private String registByHand; + + @NotEmpty + private String msbServerAddr; + + @Valid + private String serviceIp; + + @JsonProperty + public String getTemplate() { + return template; + } + + @JsonProperty + public void setTemplate(String template) { + this.template = template; + } + + @JsonProperty + public String getDefaultName() { + return defaultName; + } + + @JsonProperty + public void setDefaultName(String name) { + this.defaultName = name; + } + + @JsonProperty + public String getMsbDiscoveryIp() { + return msbDiscoveryIp; + } + + @JsonProperty + public void setMsbDiscoveryIp(String discoveryIp) { + this.msbDiscoveryIp = discoveryIp; + } + + @JsonProperty + public String getMsbServerAddr() { + return msbServerAddr; + } + + @JsonProperty + public void setMsbServerAddr(String msbServerAddr) { + this.msbServerAddr = msbServerAddr; + } + + @JsonProperty + public String getServiceIp() { + return serviceIp; + } + + @JsonProperty + public void setServiceIp(String serviceIp) { + this.serviceIp = serviceIp; + } + + @JsonProperty + public String getRegistByHand() { + return registByHand; + } + + @JsonProperty + public void setRegistByHand(String registByHand) { + this.registByHand = registByHand; + } + + @JsonProperty + public void setMsbDiscoveryPort(String msbDiscoveryPort) { + this.msbDiscoveryPort = msbDiscoveryPort; + } + + @JsonProperty + public String getMsbDiscoveryPort() { + return msbDiscoveryPort; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java index 3826bf8..fb39f37 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/Config.java @@ -20,13 +20,13 @@ import org.onap.aai.esr.ExtsysAppConfiguration; public class Config { - private static ExtsysAppConfiguration configration; + private static ExtsysAppConfiguration configration; - public static ExtsysAppConfiguration getConfigration() { - return configration; - } + public static ExtsysAppConfiguration getConfigration() { + return configration; + } - public static void setConfigration(ExtsysAppConfiguration config) { - configration = config; - } + public static void setConfigration(ExtsysAppConfiguration config) { + configration = config; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java index 86ff1b0..e2fb682 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/MsbConfig.java @@ -17,64 +17,64 @@ package org.onap.aai.esr.common; public class MsbConfig { - - protected static String msbServerAddr; - - protected static String cloudInfrastructureAddr; - - protected static String externalSystemAddr; - - protected static String multiCloudAddr; - - protected static String msbDiscoveryIp; - - protected static String msbDiscoveryPort; - - public static void setCloudInfrastructureAddr(String address){ - cloudInfrastructureAddr = address; - } - - public static String getCloudInfrastructureAddr(){ - return msbServerAddr + "/api/aai-cloudInfrastructure/v11"; - } - - public static String getExternalSystemAddr() { - return msbServerAddr + "/api/aai-externalSystem/v11"; - } - - public static void setExternalSystemAddr(String Addr) { - externalSystemAddr = Addr; - } - - public static void setMultiCloudAddr(String address){ - multiCloudAddr = address; - } - - public static String getMultiCloudAddr(){ - return msbServerAddr + "/api/multicloud/v0"; - } - - public static String getMsbDiscoveryIp() { - return msbDiscoveryIp; - } - - public static void setMsbDiscoveryIp(String discoveryIp) { - msbDiscoveryIp = discoveryIp; - } - - public static String getMsbDiscoveryPort() { - return msbDiscoveryPort; - } - - public static void setMsbDiscoveryPort(String discoveryPort) { - msbDiscoveryPort = discoveryPort; - } - - public static String getMsbServerAddr() { - return msbServerAddr; - } - - public static void setMsbServerAddr(String msbServerAddr) { - MsbConfig.msbServerAddr = msbServerAddr; - } + + protected static String msbServerAddr; + + protected static String cloudInfrastructureAddr; + + protected static String externalSystemAddr; + + protected static String multiCloudAddr; + + protected static String msbDiscoveryIp; + + protected static String msbDiscoveryPort; + + public static void setCloudInfrastructureAddr(String address) { + cloudInfrastructureAddr = address; + } + + public static String getCloudInfrastructureAddr() { + return msbServerAddr + "/api/aai-cloudInfrastructure/v11"; + } + + public static String getExternalSystemAddr() { + return msbServerAddr + "/api/aai-externalSystem/v11"; + } + + public static void setExternalSystemAddr(String Addr) { + externalSystemAddr = Addr; + } + + public static void setMultiCloudAddr(String address) { + multiCloudAddr = address; + } + + public static String getMultiCloudAddr() { + return msbServerAddr + "/api/multicloud/v0"; + } + + public static String getMsbDiscoveryIp() { + return msbDiscoveryIp; + } + + public static void setMsbDiscoveryIp(String discoveryIp) { + msbDiscoveryIp = discoveryIp; + } + + public static String getMsbDiscoveryPort() { + return msbDiscoveryPort; + } + + public static void setMsbDiscoveryPort(String discoveryPort) { + msbDiscoveryPort = discoveryPort; + } + + public static String getMsbServerAddr() { + return msbServerAddr; + } + + public static void setMsbServerAddr(String msbServerAddr) { + MsbConfig.msbServerAddr = msbServerAddr; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java index 26ce92f..c96884a 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemStatus.java @@ -16,5 +16,5 @@ package org.onap.aai.esr.common; public enum SystemStatus { - normal,abnormal + normal, abnormal } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java index c075865..c637c5e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/common/SystemType.java @@ -17,5 +17,5 @@ package org.onap.aai.esr.common; public enum SystemType { - VNFM,EMS_RESOUCE,EMS_PERFORMANCE,EMS_ALARM,thirdparty_SDNC,VIM + VNFM, EMS_RESOUCE, EMS_PERFORMANCE, EMS_ALARM, thirdparty_SDNC, VIM } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java index b6db29f..afe28ed 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegion.java @@ -16,114 +16,113 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class CloudRegion implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-type") - private String cloudType; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("owner-defined-type") - private String ownerDefinedType; - - @SerializedName("cloud-zone") - private String cloudZone; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("cloud-extra-info") - private String cloudExtraInfo; - - @SerializedName("resource-version") - private String resourceVersion; - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - - public String getCloudRegionId() { - return cloudRegionId; - } - - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } - - public String getCloudType() { - return cloudType; - } - - public void setCloudType(String cloudType) { - this.cloudType = cloudType; - } - - public String getCloudRegionVersion() { - return cloudRegionVersion; - } - - public void setCloudRegionVersion(String cloudRegionVersion) { - this.cloudRegionVersion = cloudRegionVersion; - } - - public String getOwnerDefinedType() { - return ownerDefinedType; - } - - public void setOwnerDefinedType(String ownerDefinedType) { - this.ownerDefinedType = ownerDefinedType; - } - - public String getCloudZone() { - return cloudZone; - } - - public void setCloudZone(String cloudZone) { - this.cloudZone = cloudZone; - } - - public String getComplexName() { - return complexName; - } - - public void setComplexName(String complexName) { - this.complexName = complexName; - } - - public String getCloudExtraInfo() { - return cloudExtraInfo; - } - - public void setCloudExtraInfo(String cloudExtraInfo) { - this.cloudExtraInfo = cloudExtraInfo; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-owner") + private String cloudOwner; + + @SerializedName("cloud-region-id") + private String cloudRegionId; + + @SerializedName("cloud-type") + private String cloudType; + + @SerializedName("cloud-region-version") + private String cloudRegionVersion; + + @SerializedName("owner-defined-type") + private String ownerDefinedType; + + @SerializedName("cloud-zone") + private String cloudZone; + + @SerializedName("complex-name") + private String complexName; + + @SerializedName("cloud-extra-info") + private String cloudExtraInfo; + + @SerializedName("resource-version") + private String resourceVersion; + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + + public String getCloudType() { + return cloudType; + } + + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } + + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + public String getOwnerDefinedType() { + return ownerDefinedType; + } + + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } + + public String getCloudZone() { + return cloudZone; + } + + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } + + public String getComplexName() { + return complexName; + } + + public void setComplexName(String complexName) { + this.complexName = complexName; + } + + public String getCloudExtraInfo() { + return cloudExtraInfo; + } + + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java index 9f44386..4f14c25 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionDetail.java @@ -16,121 +16,120 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class CloudRegionDetail implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("cloud-owner") - private String cloudOwner; - - @SerializedName("cloud-region-id") - private String cloudRegionId; - - @SerializedName("cloud-type") - private String cloudType; - - @SerializedName("cloud-region-version") - private String cloudRegionVersion; - - @SerializedName("owner-defined-type") - private String ownerDefinedType; - - @SerializedName("cloud-zone") - private String cloudZone; - - @SerializedName("complex-name") - private String complexName; - - @SerializedName("cloud-extra-info") - private String cloudExtraInfo; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - - public String getCloudRegionId() { - return cloudRegionId; - } - - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } - - public String getCloudType() { - return cloudType; - } - - public void setCloudType(String cloudType) { - this.cloudType = cloudType; - } - - public String getCloudRegionVersion() { - return cloudRegionVersion; - } - - public void setCloudRegionVersion(String cloudRegionVersion) { - this.cloudRegionVersion = cloudRegionVersion; - } - - public String getOwnerDefinedType() { - return ownerDefinedType; - } - - public void setOwnerDefinedType(String ownerDefinedType) { - this.ownerDefinedType = ownerDefinedType; - } - - public String getCloudZone() { - return cloudZone; - } - - public void setCloudZone(String cloudZone) { - this.cloudZone = cloudZone; - } - - public String getComplexName() { - return complexName; - } - - public void setComplexName(String complexName) { - this.complexName = complexName; - } - - public String getCloudExtraInfo() { - return cloudExtraInfo; - } - - public void setCloudExtraInfo(String cloudExtraInfo) { - this.cloudExtraInfo = cloudExtraInfo; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-owner") + private String cloudOwner; + + @SerializedName("cloud-region-id") + private String cloudRegionId; + + @SerializedName("cloud-type") + private String cloudType; + + @SerializedName("cloud-region-version") + private String cloudRegionVersion; + + @SerializedName("owner-defined-type") + private String ownerDefinedType; + + @SerializedName("cloud-zone") + private String cloudZone; + + @SerializedName("complex-name") + private String complexName; + + @SerializedName("cloud-extra-info") + private String cloudExtraInfo; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + + public String getCloudType() { + return cloudType; + } + + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } + + public String getCloudRegionVersion() { + return cloudRegionVersion; + } + + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } + + public String getOwnerDefinedType() { + return ownerDefinedType; + } + + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } + + public String getCloudZone() { + return cloudZone; + } + + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } + + public String getComplexName() { + return complexName; + } + + public void setComplexName(String complexName) { + this.complexName = complexName; + } + + public String getCloudExtraInfo() { + return cloudExtraInfo; + } + + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java index c6815d2..890cad5 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/CloudRegionList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class CloudRegionList implements Serializable { - - public static final long serialVersionUID = 1L; - @SerializedName("cloud-region") - private List cloudRegion; + public static final long serialVersionUID = 1L; + + @SerializedName("cloud-region") + private List cloudRegion; - public List getCloudRegion() { - return cloudRegion; - } + public List getCloudRegion() { + return cloudRegion; + } - public void setCloudRegion(List cloudRegion) { - this.cloudRegion = cloudRegion; - } + public void setCloudRegion(List cloudRegion) { + this.cloudRegion = cloudRegion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java index d50af6b..1a347e2 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEms.java @@ -16,32 +16,31 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrEms implements Serializable { - -public static final long serialVersionUID = 1L; - - @SerializedName("ems-id") - private String emsId; - - @SerializedName("resource-version") - private String resourceVersion; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("ems-id") + private String emsId; + + @SerializedName("resource-version") + private String resourceVersion; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java index 139c0e2..24b1aa9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsDetail.java @@ -16,43 +16,42 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrEmsDetail implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("ems-id") - private String emsId; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public static final long serialVersionUID = 1L; + + @SerializedName("ems-id") + private String emsId; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java index 8d4dc69..ffb661f 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrEmsList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrEmsList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-ems") - private List esrEms; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-ems") + private List esrEms; - public List getEsrEms() { - return esrEms; - } + public List getEsrEms() { + return esrEms; + } - public void setEsrEms(List esrEms) { - this.esrEms = esrEms; - } + public void setEsrEms(List esrEms) { + this.esrEms = esrEms; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java index b02afbe..4faae16 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfo.java @@ -16,231 +16,230 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrSystemInfo implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("esr-system-info-id") - private String esrSystemInfoId; - - @SerializedName("system-name") - private String systemName; - - @SerializedName("type") - private String type; - - @SerializedName("vendor") - private String vendor; - - @SerializedName("version") - private String version; - - @SerializedName("service-url") - private String serviceUrl; - - @SerializedName("user-name") - private String userName; - - @SerializedName("password") - private String password; - - @SerializedName("system-type") - private String systemType; - - @SerializedName("protocol") - private String protocol; - - @SerializedName("ssl-cassert") - private String sslCassert; - - @SerializedName("ssl-insecure") - private Boolean sslInsecure; - - @SerializedName("ip-address") - private String ipAddress; - - @SerializedName("port") - private String port; - - @SerializedName("cloud-domain") - private String cloudDomain; - - @SerializedName("default-tenant") - private String defaultTenant; - - @SerializedName("passive") - private Boolean passive; - - @SerializedName("remote-path") - private String remotePath; - - @SerializedName("system-status") - private String systemStatus; - - @SerializedName("resource-version") - private String resourceVersion; - - public String getEsrSystemInfoId() { - return esrSystemInfoId; - } - - public void setEsrSystemInfoId(String esrSystemInfoId) { - this.esrSystemInfoId = esrSystemInfoId; - } - - public String getSystemName() { - return systemName; - } - - public void setSystemName(String systemName) { - this.systemName = systemName; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getVendor() { - return vendor; - } - - public void setVendor(String vendor) { - this.vendor = vendor; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getServiceUrl() { - return serviceUrl; - } - - public void setServiceUrl(String serviceUrl) { - this.serviceUrl = serviceUrl; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSystemType() { - return systemType; - } - - public void setSystemType(String systemType) { - this.systemType = systemType; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getSslCassert() { - return sslCassert; - } - - public void setSslCassert(String sslCassert) { - this.sslCassert = sslCassert; - } - - public Boolean getSslInsecure() { - return sslInsecure; - } - - public void setSslInsecure(Boolean sslInsecure) { - this.sslInsecure = sslInsecure; - } - - public String getIpAddress() { - return ipAddress; - } - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } + public static final long serialVersionUID = 1L; + + @SerializedName("esr-system-info-id") + private String esrSystemInfoId; + + @SerializedName("system-name") + private String systemName; + + @SerializedName("type") + private String type; + + @SerializedName("vendor") + private String vendor; + + @SerializedName("version") + private String version; + + @SerializedName("service-url") + private String serviceUrl; + + @SerializedName("user-name") + private String userName; + + @SerializedName("password") + private String password; + + @SerializedName("system-type") + private String systemType; + + @SerializedName("protocol") + private String protocol; + + @SerializedName("ssl-cassert") + private String sslCassert; + + @SerializedName("ssl-insecure") + private Boolean sslInsecure; + + @SerializedName("ip-address") + private String ipAddress; + + @SerializedName("port") + private String port; + + @SerializedName("cloud-domain") + private String cloudDomain; + + @SerializedName("default-tenant") + private String defaultTenant; + + @SerializedName("passive") + private Boolean passive; + + @SerializedName("remote-path") + private String remotePath; + + @SerializedName("system-status") + private String systemStatus; + + @SerializedName("resource-version") + private String resourceVersion; + + public String getEsrSystemInfoId() { + return esrSystemInfoId; + } + + public void setEsrSystemInfoId(String esrSystemInfoId) { + this.esrSystemInfoId = esrSystemInfoId; + } + + public String getSystemName() { + return systemName; + } + + public void setSystemName(String systemName) { + this.systemName = systemName; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getServiceUrl() { + return serviceUrl; + } + + public void setServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSystemType() { + return systemType; + } + + public void setSystemType(String systemType) { + this.systemType = systemType; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getSslCassert() { + return sslCassert; + } + + public void setSslCassert(String sslCassert) { + this.sslCassert = sslCassert; + } + + public Boolean getSslInsecure() { + return sslInsecure; + } + + public void setSslInsecure(Boolean sslInsecure) { + this.sslInsecure = sslInsecure; + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } - public String getPort() { - return port; - } + public String getPort() { + return port; + } - public void setPort(String port) { - this.port = port; - } + public void setPort(String port) { + this.port = port; + } - public String getCloudDomain() { - return cloudDomain; - } + public String getCloudDomain() { + return cloudDomain; + } - public void setCloudDomain(String cloudDomain) { - this.cloudDomain = cloudDomain; - } + public void setCloudDomain(String cloudDomain) { + this.cloudDomain = cloudDomain; + } - public String getDefaultTenant() { - return defaultTenant; - } + public String getDefaultTenant() { + return defaultTenant; + } - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } - public Boolean getPassive() { - return passive; - } + public Boolean getPassive() { + return passive; + } - public void setPassive(Boolean passive) { - this.passive = passive; - } + public void setPassive(Boolean passive) { + this.passive = passive; + } - public String getRemotePath() { - return remotePath; - } + public String getRemotePath() { + return remotePath; + } - public void setRemotePath(String remotePath) { - this.remotePath = remotePath; - } + public void setRemotePath(String remotePath) { + this.remotePath = remotePath; + } - public String getSystemStatus() { - return systemStatus; - } + public String getSystemStatus() { + return systemStatus; + } - public void setSystemStatus(String systemStatus) { - this.systemStatus = systemStatus; - } + public void setSystemStatus(String systemStatus) { + this.systemStatus = systemStatus; + } - public String getResouceVersion() { - return resourceVersion; - } + public String getResouceVersion() { + return resourceVersion; + } - public void setResouceVersion(String resouceVersion) { - this.resourceVersion = resouceVersion; - } + public void setResouceVersion(String resouceVersion) { + this.resourceVersion = resouceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java index dd06c53..452cf73 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrSystemInfoList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrSystemInfoList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-system-info") - private List esrSystemInfo; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-system-info") + private List esrSystemInfo; - public List getEsrSystemInfo() { - return esrSystemInfo; - } + public List getEsrSystemInfo() { + return esrSystemInfo; + } - public void setEsrSystemInfo(List esrSystemInfo) { - this.esrSystemInfo = esrSystemInfo; - } + public void setEsrSystemInfo(List esrSystemInfo) { + this.esrSystemInfo = esrSystemInfo; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java index 89e1ffd..c478d54 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdnc.java @@ -16,53 +16,52 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdnc implements Serializable { -public static final long serialVersionUID = 1L; - - @SerializedName("thirdparty-sdnc-id") - private String thirdpartySdncId; - - @SerializedName("location") - private String location; + public static final long serialVersionUID = 1L; + + @SerializedName("thirdparty-sdnc-id") + private String thirdpartySdncId; + + @SerializedName("location") + private String location; + + @SerializedName("product-name") + private String productName; - @SerializedName("product-name") - private String productName; - - @SerializedName("resource-version") - private String resourceVersion; + @SerializedName("resource-version") + private String resourceVersion; - public String getThirdpartySdncId() { - return thirdpartySdncId; - } + public String getThirdpartySdncId() { + return thirdpartySdncId; + } - public void setThirdpartySdncId(String thirdpartySdncId) { - this.thirdpartySdncId = thirdpartySdncId; - } + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } - public String getLocation() { - return location; - } + public String getLocation() { + return location; + } - public void setLocation(String location) { - this.location = location; - } + public void setLocation(String location) { + this.location = location; + } - public String getProductName() { - return productName; - } + public String getProductName() { + return productName; + } - public void setProductName(String productName) { - this.productName = productName; - } + public void setProductName(String productName) { + this.productName = productName; + } - public String getResourceVersion() { - return resourceVersion; - } + public String getResourceVersion() { + return resourceVersion; + } - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java index 8f3dd0f..90bd29b 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetail.java @@ -16,65 +16,64 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdncDetail implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("thirdparty-sdnc-id") - private String thirdpartySdncId; - - @SerializedName("location") - private String location; - - @SerializedName("product-name") - private String productName; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - public String getThirdpartySdncId() { - return thirdpartySdncId; - } - - public void setThirdpartySdncId(String thirdpartySdncId) { - this.thirdpartySdncId = thirdpartySdncId; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + public static final long serialVersionUID = 1L; + + @SerializedName("thirdparty-sdnc-id") + private String thirdpartySdncId; + + @SerializedName("location") + private String location; + + @SerializedName("product-name") + private String productName; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + public String getThirdpartySdncId() { + return thirdpartySdncId; + } + + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java index 0d4d100..ed247d2 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncList.java @@ -17,21 +17,20 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrThirdpartySdncList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-thirdparty-sdnc") - private List esrThirdpartySdnc; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-thirdparty-sdnc") + private List esrThirdpartySdnc; - public List getEsrThirdpartySdnc() { - return esrThirdpartySdnc; - } + public List getEsrThirdpartySdnc() { + return esrThirdpartySdnc; + } - public void setEsrThirdpartySdnc(List esrThirdpartySdnc) { - this.esrThirdpartySdnc = esrThirdpartySdnc; - } + public void setEsrThirdpartySdnc(List esrThirdpartySdnc) { + this.esrThirdpartySdnc = esrThirdpartySdnc; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java index 73fbc8c..c1d24d9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfm.java @@ -16,58 +16,57 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrVnfm implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("vnfm-id") - private String vnfmId; - - @SerializedName("vim-id") - private String vimId; - - @SerializedName("certificate-id") - private String certificateUrl; - - @SerializedName("resource-version") - private String resourceVersion; - - public String getVnfmId() { - return vnfmId; - } - - public void setVnfmId(String vnfmId) { - this.vnfmId = vnfmId; - } - - public String getVimId() { - return vimId; - } - - public void setVimId(String vimId) { - this.vimId = vimId; - } - - public String getCertificateUrl() { - return certificateUrl; - } - - public void setCertificateUrl(String certificateUrl) { - this.certificateUrl = certificateUrl; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } - - public static long getSerialversionuid() { - return serialVersionUID; - } + public static final long serialVersionUID = 1L; + + @SerializedName("vnfm-id") + private String vnfmId; + + @SerializedName("vim-id") + private String vimId; + + @SerializedName("certificate-id") + private String certificateUrl; + + @SerializedName("resource-version") + private String resourceVersion; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } + + public static long getSerialversionuid() { + return serialVersionUID; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java index eab70cd..7c0a3ba 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmDetail.java @@ -16,66 +16,65 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class EsrVnfmDetail implements Serializable { - - public static final long serialVersionUID = 1L; - - @SerializedName("vnfm-id") - private String vnfmId; - - @SerializedName("vim-id") - private String vimId; - - @SerializedName("certificate-url") - private String certificateUrl; - - @SerializedName("resource-version") - private String resourceVersion; - - @SerializedName("esr-system-info-list") - private EsrSystemInfoList esrSystemInfoList; - - public String getVnfmId() { - return vnfmId; - } - - public void setVnfmId(String vnfmId) { - this.vnfmId = vnfmId; - } - - public String getVimId() { - return vimId; - } - - public void setVimId(String vimId) { - this.vimId = vimId; - } - - public String getCertificateUrl() { - return certificateUrl; - } - - public void setCertificateUrl(String certificateUrl) { - this.certificateUrl = certificateUrl; - } - - public EsrSystemInfoList getEsrSystemInfoList() { - return esrSystemInfoList; - } - - public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { - this.esrSystemInfoList = esrSystemInfoList; - } - - public String getResourceVersion() { - return resourceVersion; - } - - public void setResourceVersion(String resourceVersion) { - this.resourceVersion = resourceVersion; - } + + public static final long serialVersionUID = 1L; + + @SerializedName("vnfm-id") + private String vnfmId; + + @SerializedName("vim-id") + private String vimId; + + @SerializedName("certificate-url") + private String certificateUrl; + + @SerializedName("resource-version") + private String resourceVersion; + + @SerializedName("esr-system-info-list") + private EsrSystemInfoList esrSystemInfoList; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public EsrSystemInfoList getEsrSystemInfoList() { + return esrSystemInfoList; + } + + public void setEsrSystemInfoList(EsrSystemInfoList esrSystemInfoList) { + this.esrSystemInfoList = esrSystemInfoList; + } + + public String getResourceVersion() { + return resourceVersion; + } + + public void setResourceVersion(String resourceVersion) { + this.resourceVersion = resourceVersion; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java index eec0a07..d17ea04 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/aai/EsrVnfmList.java @@ -17,22 +17,21 @@ package org.onap.aai.esr.entity.aai; import java.io.Serializable; import java.util.List; - import com.google.gson.annotations.SerializedName; public class EsrVnfmList implements Serializable { - public static final long serialVersionUID = 1L; - - @SerializedName("esr-vnfm") - private List esrVnfm; + public static final long serialVersionUID = 1L; + + @SerializedName("esr-vnfm") + private List esrVnfm; - public List getEsrVnfm() { - return esrVnfm; - } + public List getEsrVnfm() { + return esrVnfm; + } - public void setEsrVnfm(List esrVnfm) { - this.esrVnfm = esrVnfm; - } + public void setEsrVnfm(List esrVnfm) { + this.esrVnfm = esrVnfm; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java index d777db3..39b8cbe 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/AlarmAddr.java @@ -17,43 +17,43 @@ package org.onap.aai.esr.entity.rest; public class AlarmAddr { - private String ip; - - private String port; - - private String user; - - private String password; - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } + private String ip; + + private String port; + + private String user; + + private String password; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java index 88f38cc..2cc2501 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/CommonRegisterResponse.java @@ -16,15 +16,15 @@ package org.onap.aai.esr.entity.rest; public class CommonRegisterResponse { - - private String id; - public String getId() { - return id; - } + private String id; - public void setId(String id) { - this.id = id; - } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java index 5f9c2b0..745a48e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/EmsRegisterInfo.java @@ -18,74 +18,74 @@ package org.onap.aai.esr.entity.rest; public class EmsRegisterInfo { - private String emsId; - - private String name; - - private String vendor; - - private String version; - - private FtpAddr resourceAddr; - - private FtpAddr performanceAddr; - - private AlarmAddr alarmAddr; - - public String getEmsId() { - return emsId; - } - - public void setEmsId(String emsId) { - this.emsId = emsId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVendor() { - return vendor; - } - - public void setVendor(String vendor) { - this.vendor = vendor; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public FtpAddr getResourceAddr() { - return resourceAddr; - } - - public void setResourceAddr(FtpAddr resourceAddr) { - this.resourceAddr = resourceAddr; - } - - public FtpAddr getPerformanceAddr() { - return performanceAddr; - } - - public void setPerformanceAddr(FtpAddr performanceAddr) { - this.performanceAddr = performanceAddr; - } - - public AlarmAddr getAlarmAddr() { - return alarmAddr; - } - - public void setAlarmAddr(AlarmAddr alarmAddr) { - this.alarmAddr = alarmAddr; - } + private String emsId; + + private String name; + + private String vendor; + + private String version; + + private FtpAddr resourceAddr; + + private FtpAddr performanceAddr; + + private AlarmAddr alarmAddr; + + public String getEmsId() { + return emsId; + } + + public void setEmsId(String emsId) { + this.emsId = emsId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public FtpAddr getResourceAddr() { + return resourceAddr; + } + + public void setResourceAddr(FtpAddr resourceAddr) { + this.resourceAddr = resourceAddr; + } + + public FtpAddr getPerformanceAddr() { + return performanceAddr; + } + + public void setPerformanceAddr(FtpAddr performanceAddr) { + this.performanceAddr = performanceAddr; + } + + public AlarmAddr getAlarmAddr() { + return alarmAddr; + } + + public void setAlarmAddr(AlarmAddr alarmAddr) { + this.alarmAddr = alarmAddr; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java index 598d6ed..f393972 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/FtpAddr.java @@ -16,74 +16,74 @@ package org.onap.aai.esr.entity.rest; public class FtpAddr { - - private String ftptype; - - private String ip; - - private String port; - - private String user; - - private String password; - - private String remotepath; - - private Boolean passive; - - public String getFtptype() { - return ftptype; - } - - public void setFtptype(String ftptype) { - this.ftptype = ftptype; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getRemotepath() { - return remotepath; - } - - public void setRemotepath(String remotepath) { - this.remotepath = remotepath; - } - - public Boolean getPassive() { - return passive; - } - - public void setPassive(Boolean passive) { - this.passive = passive; - } + + private String ftptype; + + private String ip; + + private String port; + + private String user; + + private String password; + + private String remotepath; + + private Boolean passive; + + public String getFtptype() { + return ftptype; + } + + public void setFtptype(String ftptype) { + this.ftptype = ftptype; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRemotepath() { + return remotepath; + } + + public void setRemotepath(String remotepath) { + this.remotepath = remotepath; + } + + public Boolean getPassive() { + return passive; + } + + public void setPassive(Boolean passive) { + this.passive = passive; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java index 667f0cf..30f39e9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfo.java @@ -17,118 +17,118 @@ package org.onap.aai.esr.entity.rest; public class ThirdpartySdncRegisterInfo { - private String thirdpartySdncId; - - private String name; - - private String vendor; - - private String version; - - private String type; - - private String location; - - private String url; - - private String userName; - - private String password; - - private String productName; - - private String protocol; - - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getProductName() { - return productName; - } - - public void setProductName(String productName) { - this.productName = productName; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public ThirdpartySdncRegisterInfo() { - - } - - public String getThirdpartySdncId() { - return thirdpartySdncId; - } - - public void setThirdpartySdncId(String thirdpartySdncId) { - this.thirdpartySdncId = thirdpartySdncId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getVendor() { - return vendor; - } - - public void setVendor(String vendor) { - this.vendor = vendor; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } + private String thirdpartySdncId; + + private String name; + + private String vendor; + + private String version; + + private String type; + + private String location; + + private String url; + + private String userName; + + private String password; + + private String productName; + + private String protocol; + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public ThirdpartySdncRegisterInfo() { + + } + + public String getThirdpartySdncId() { + return thirdpartySdncId; + } + + public void setThirdpartySdncId(String thirdpartySdncId) { + this.thirdpartySdncId = thirdpartySdncId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java index 4bd251f..c2ce6b3 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimAuthInfo.java @@ -16,75 +16,75 @@ package org.onap.aai.esr.entity.rest; public class VimAuthInfo { - - private String cloudDomain; - - private String userName; - - private String password; - - private String authUrl; - - private String defaultTenant; - - private String sslCacert; - - private Boolean sslInsecure; - - public String getCloudDomain() { - return cloudDomain; - } - - public void setCloudDomain(String cloudDomain) { - this.cloudDomain = cloudDomain; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getAuthUrl() { - return authUrl; - } - - public void setAuthUrl(String authUrl) { - this.authUrl = authUrl; - } - - public String getSslCacert() { - return sslCacert; - } - - public void setSslCacert(String sslCacert) { - this.sslCacert = sslCacert; - } - - public Boolean getSslInsecure() { - return sslInsecure; - } - - public void setSslInsecure(Boolean sslInsecure) { - this.sslInsecure = sslInsecure; - } - - public String getDefaultTenant() { - return defaultTenant; - } - - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + + private String cloudDomain; + + private String userName; + + private String password; + + private String authUrl; + + private String defaultTenant; + + private String sslCacert; + + private Boolean sslInsecure; + + public String getCloudDomain() { + return cloudDomain; + } + + public void setCloudDomain(String cloudDomain) { + this.cloudDomain = cloudDomain; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getAuthUrl() { + return authUrl; + } + + public void setAuthUrl(String authUrl) { + this.authUrl = authUrl; + } + + public String getSslCacert() { + return sslCacert; + } + + public void setSslCacert(String sslCacert) { + this.sslCacert = sslCacert; + } + + public Boolean getSslInsecure() { + return sslInsecure; + } + + public void setSslInsecure(Boolean sslInsecure) { + this.sslInsecure = sslInsecure; + } + + public String getDefaultTenant() { + return defaultTenant; + } + + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java index 1441f79..0074490 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterInfo.java @@ -20,104 +20,104 @@ import java.util.List; public class VimRegisterInfo { - private String cloudOwner; + private String cloudOwner; - private String cloudRegionId; + private String cloudRegionId; - private String cloudType; + private String cloudType; - private String cloudRegionVersion; + private String cloudRegionVersion; - private String ownerDefinedType; + private String ownerDefinedType; - private String cloudZone; - - private String complexName; - - private String cloudExtraInfo; - - private String status; - - private List vimAuthInfos; + private String cloudZone; - public String getCloudOwner() { - return cloudOwner; - } + private String complexName; - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } + private String cloudExtraInfo; - public String getCloudRegionId() { - return cloudRegionId; - } + private String status; - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } + private List vimAuthInfos; - public String getCloudType() { - return cloudType; - } + public String getCloudOwner() { + return cloudOwner; + } - public void setCloudType(String cloudType) { - this.cloudType = cloudType; - } + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } - public String getCloudRegionVersion() { - return cloudRegionVersion; - } + public String getCloudRegionId() { + return cloudRegionId; + } - public void setCloudRegionVersion(String cloudRegionVersion) { - this.cloudRegionVersion = cloudRegionVersion; - } + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } - public String getOwnerDefinedType() { - return ownerDefinedType; - } + public String getCloudType() { + return cloudType; + } - public void setOwnerDefinedType(String ownerDefinedType) { - this.ownerDefinedType = ownerDefinedType; - } + public void setCloudType(String cloudType) { + this.cloudType = cloudType; + } - public String getCloudZone() { - return cloudZone; - } + public String getCloudRegionVersion() { + return cloudRegionVersion; + } - public void setCloudZone(String cloudZone) { - this.cloudZone = cloudZone; - } + public void setCloudRegionVersion(String cloudRegionVersion) { + this.cloudRegionVersion = cloudRegionVersion; + } - public String getComplexName() { - return complexName; - } + public String getOwnerDefinedType() { + return ownerDefinedType; + } - public void setComplexName(String complexName) { - this.complexName = complexName; - } + public void setOwnerDefinedType(String ownerDefinedType) { + this.ownerDefinedType = ownerDefinedType; + } - public String getCloudExtraInfo() { - return cloudExtraInfo; - } + public String getCloudZone() { + return cloudZone; + } - public void setCloudExtraInfo(String cloudExtraInfo) { - this.cloudExtraInfo = cloudExtraInfo; - } + public void setCloudZone(String cloudZone) { + this.cloudZone = cloudZone; + } - public List getVimAuthInfos() { - return vimAuthInfos; - } + public String getComplexName() { + return complexName; + } - public void setVimAuthInfos(List vimAuthInfos) { - this.vimAuthInfos = vimAuthInfos; - } + public void setComplexName(String complexName) { + this.complexName = complexName; + } - public String getStatus() { - return status; - } + public String getCloudExtraInfo() { + return cloudExtraInfo; + } - public void setStatus(String status) { - this.status = status; - } + public void setCloudExtraInfo(String cloudExtraInfo) { + this.cloudExtraInfo = cloudExtraInfo; + } + + public List getVimAuthInfos() { + return vimAuthInfos; + } + + public void setVimAuthInfos(List vimAuthInfos) { + this.vimAuthInfos = vimAuthInfos; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java index f12a2bc..c2d8bce 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VimRegisterResponse.java @@ -16,25 +16,25 @@ package org.onap.aai.esr.entity.rest; public class VimRegisterResponse { - - private String cloudOwner; - - private String cloudRegionId; - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - - public String getCloudRegionId() { - return cloudRegionId; - } - - public void setCloudRegionId(String cloudRegionId) { - this.cloudRegionId = cloudRegionId; - } + + private String cloudOwner; + + private String cloudRegionId; + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java index b3f6737..5f91faa 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfo.java @@ -15,106 +15,106 @@ */ package org.onap.aai.esr.entity.rest; -public class VnfmRegisterInfo{ - - private String vnfmId; - - private String name; - - private String type; - - private String vimId; - - private String vendor; - - private String version; - - private String certificateUrl; - - private String url; - - private String userName; - - private String password; - - public String getVnfmId() { - return vnfmId; - } - - public void setVnfmId(String vnfmId) { - this.vnfmId = vnfmId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getVimId() { - return vimId; - } - - public void setVimId(String vimId) { - this.vimId = vimId; - } - - public String getVendor() { - return vendor; - } - - public void setVendor(String vendor) { - this.vendor = vendor; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getCertificateUrl() { - return certificateUrl; - } - - public void setCertificateUrl(String certificateUrl) { - this.certificateUrl = certificateUrl; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - +public class VnfmRegisterInfo { + + private String vnfmId; + + private String name; + + private String type; + + private String vimId; + + private String vendor; + + private String version; + + private String certificateUrl; + + private String url; + + private String userName; + + private String password; + + public String getVnfmId() { + return vnfmId; + } + + public void setVnfmId(String vnfmId) { + this.vnfmId = vnfmId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getVimId() { + return vimId; + } + + public void setVimId(String vimId) { + this.vimId = vimId; + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getCertificateUrl() { + return certificateUrl; + } + + public void setCertificateUrl(String certificateUrl) { + this.certificateUrl = certificateUrl; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java index 57ad6f2..b6f3593 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExceptionUtil.java @@ -21,14 +21,14 @@ import javax.ws.rs.core.Response; public class ExceptionUtil { - private static final int EXCEPTION_CODE = 498; + private static final int EXCEPTION_CODE = 498; - private ExceptionUtil() { + private ExceptionUtil() { - } + } - public static WebApplicationException buildExceptionResponse(String message) { - Response response = Response.status(EXCEPTION_CODE).entity(message).type(MediaType.TEXT_PLAIN).build(); - return new WebApplicationException(response); - } + public static WebApplicationException buildExceptionResponse(String message) { + Response response = Response.status(EXCEPTION_CODE).entity(message).type(MediaType.TEXT_PLAIN).build(); + return new WebApplicationException(response); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java index 9561934..15231b9 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/exception/ExtsysException.java @@ -17,35 +17,35 @@ package org.onap.aai.esr.exception; public class ExtsysException extends Exception { - private static final long serialVersionUID = 1L; - private String errorCode; - private String errorMsg; - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } - - public ExtsysException() { - super(); - } - - public ExtsysException(String msg, Exception e) { - super(msg, e); - } - - public ExtsysException(String msg) { - super(msg); - } + private static final long serialVersionUID = 1L; + private String errorCode; + private String errorMsg; + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public ExtsysException() { + super(); + } + + public ExtsysException(String msg, Exception e) { + super(msg, e); + } + + public ExtsysException(String msg) { + super(msg); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java index ab5e030..d28d5e5 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/AaiCommon.java @@ -17,13 +17,12 @@ package org.onap.aai.esr.externalservice.aai; public class AaiCommon { - private static String AAI_AUTHENTICATION_USER = "AAI"; - private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; - - public static String getAuthenticationCredentials() { - String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" - + AAI_AUTHENTICATION_PAASWORD; - return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()); - } - + private static String AAI_AUTHENTICATION_USER = "AAI"; + private static String AAI_AUTHENTICATION_PAASWORD = "AAI"; + + public static String getAuthenticationCredentials() { + String usernameAndPassword = AAI_AUTHENTICATION_USER + ":" + AAI_AUTHENTICATION_PAASWORD; + return "Basic " + java.util.Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()); + } + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java index 57e6920..a145288 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxy.java @@ -19,59 +19,57 @@ import org.glassfish.jersey.client.ClientConfig; import org.onap.aai.esr.common.MsbConfig; import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class CloudRegionProxy { - private static ICloudRegion adapterServiceproxy; + private static ICloudRegion adapterServiceproxy; - private static String transactionId = "9999"; - private static String fromAppId = "esr-server"; - private static String authorization = AaiCommon.getAuthenticationCredentials(); - static { - ClientConfig config = new ClientConfig(); - adapterServiceproxy = ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), - config, ICloudRegion.class); - } + private static String transactionId = "9999"; + private static String fromAppId = "esr-server"; + private static String authorization = AaiCommon.getAuthenticationCredentials(); + static { + ClientConfig config = new ClientConfig(); + adapterServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); + } - public void registerVim(String cloudOwner, String cloudRegionId, - CloudRegionDetail cloudRegion) throws ExtsysException { - ClientConfig config = new ClientConfig(new VimRegisterProvider()); - ICloudRegion registerVimServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); - try { - registerVimServiceproxy.registerVIMService(transactionId, fromAppId, authorization, cloudOwner, - cloudRegionId, cloudRegion); - } catch (Exception e) { - throw new ExtsysException("PUT cloud region to A&AI failed.", e); + public void registerVim(String cloudOwner, String cloudRegionId, CloudRegionDetail cloudRegion) + throws ExtsysException { + ClientConfig config = new ClientConfig(new VimRegisterProvider()); + ICloudRegion registerVimServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getCloudInfrastructureAddr(), config, ICloudRegion.class); + try { + registerVimServiceproxy.registerVIMService(transactionId, fromAppId, authorization, cloudOwner, + cloudRegionId, cloudRegion); + } catch (Exception e) { + throw new ExtsysException("PUT cloud region to A&AI failed.", e); + } } - } - public String queryVimDetail(String cloud_owner, String cloud_region_id) throws ExtsysException { - try { - return adapterServiceproxy.queryVIMDetail(transactionId, fromAppId, authorization, cloud_owner, - cloud_region_id); - } catch (Exception e) { - throw new ExtsysException("Query cloud region detail from A&AI failed.", e); + public String queryVimDetail(String cloud_owner, String cloud_region_id) throws ExtsysException { + try { + return adapterServiceproxy.queryVIMDetail(transactionId, fromAppId, authorization, cloud_owner, + cloud_region_id); + } catch (Exception e) { + throw new ExtsysException("Query cloud region detail from A&AI failed.", e); + } } - } - public String qureyVimList() throws ExtsysException { - try { - return adapterServiceproxy.queryVIMList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query cloud region list from A&AI failed.", e); + public String qureyVimList() throws ExtsysException { + try { + return adapterServiceproxy.queryVIMList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query cloud region list from A&AI failed.", e); + } } - } - public void deleteVim(String cloud_owner, String cloud_region_id, String resourceVersion) throws ExtsysException - { - try { - adapterServiceproxy.deleteVim(transactionId, fromAppId, authorization, cloud_owner, - cloud_region_id, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete cloud region from A&AI failed.", e); + public void deleteVim(String cloud_owner, String cloud_region_id, String resourceVersion) throws ExtsysException { + try { + adapterServiceproxy.deleteVim(transactionId, fromAppId, authorization, cloud_owner, cloud_region_id, + resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete cloud region from A&AI failed.", e); + } } - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java index 61ad8a5..2ab58ab 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/EmsRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class EmsRegisterProvider implements MessageBodyWriter{ - - private static final Logger logger = LoggerFactory.getLogger(EmsRegisterProvider.class); - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrEmsDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrEmsDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrEmsDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrEmsDetail.class); - logger.info("the param to register EMS input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class EmsRegisterProvider implements MessageBodyWriter { + + private static final Logger logger = LoggerFactory.getLogger(EmsRegisterProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrEmsDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrEmsDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrEmsDetail t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrEmsDetail.class); + logger.info("the param to register EMS input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java index e6addce..0361747 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxy.java @@ -21,189 +21,166 @@ import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class ExternalSystemProxy { - public static boolean isTest = false; - private static IExternalSystem externalSystemproxy; - private static String transactionId = "9999"; - private static String fromAppId = "esr-server"; - private static String authorization = AaiCommon.getAuthenticationCredentials(); - static { - ClientConfig config = new ClientConfig(); - externalSystemproxy = ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), - config, IExternalSystem.class); - } - - public static void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) - throws ExtsysException { - if (isTest) { - - } else { - ClientConfig config = new ClientConfig(new VnfmRegisterProvider()); - IExternalSystem registerVnfmServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerVnfmServiceproxy.registerVNFM(transactionId, fromAppId, authorization, vnfmId, - esrVnfmDetail); - } catch (Exception e) { - throw new ExtsysException("PUT VNFM to A&AI failed.", e); - } - } - } - - public static String queryVnfmDetail(String vnfmId) throws ExtsysException { - if(isTest) { - String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," - + "\"vim-id\":\"987654\"," - + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"qwerty\"," - + "\"system-name\":\"ONAP VNFM\"," - + "\"type\":\"vnfm\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://10.11.22.33:8000\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"VNFM\"}]}}"; - return esrVnfmDetailStr; - } - try { - return externalSystemproxy.queryVNFMDetail(transactionId, fromAppId, authorization, vnfmId); - } catch (Exception e) { - throw new ExtsysException("Query VNFM detail from A&AI failed.", e); + public static boolean isTest = false; + private static IExternalSystem externalSystemproxy; + private static String transactionId = "9999"; + private static String fromAppId = "esr-server"; + private static String authorization = AaiCommon.getAuthenticationCredentials(); + static { + ClientConfig config = new ClientConfig(); + externalSystemproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); } - } - - public static String queryVnfmList() throws ExtsysException { - if(isTest) { - String vnfmListStr = "{\"esr-vnfm\": " - + "[{\"vnfm-id\": \"123456\"," - + "\"vim-id\": \"987654\"," - + "\"certificate-url\": \"http://11.22.33.44:5000/v3\"," - + "\"resource-version\": \"1\"}]}"; - return vnfmListStr; - } - try { - return externalSystemproxy.queryVNFMList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query VNFM list from A&AI failed.", e); + + public static void registerVnfm(String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException { + if (isTest) { + + } else { + ClientConfig config = new ClientConfig(new VnfmRegisterProvider()); + IExternalSystem registerVnfmServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerVnfmServiceproxy.registerVNFM(transactionId, fromAppId, authorization, vnfmId, esrVnfmDetail); + } catch (Exception e) { + throw new ExtsysException("PUT VNFM to A&AI failed.", e); + } + } } - } - - public static void deleteVnfm(String vnfmId, String resourceVersion) throws ExtsysException { - if(!isTest) { - try { - externalSystemproxy.deleteVNFM(transactionId, fromAppId, authorization, vnfmId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete VNFM from A&AI failed.", e); - } + + public static String queryVnfmDetail(String vnfmId) throws ExtsysException { + if (isTest) { + String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," + "\"vim-id\":\"987654\"," + + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," + "\"esr-system-info-list\":{" + + "\"esr-system-info\":[{" + "\"esr-system-info-id\":\"qwerty\"," + "\"system-name\":\"ONAP VNFM\"," + + "\"type\":\"vnfm\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + + "\"service-url\":\"http://10.11.22.33:8000\"," + "\"user-name\":\"onap\"," + + "\"password\":\"987654\"," + "\"system-type\":\"VNFM\"}]}}"; + return esrVnfmDetailStr; + } + try { + return externalSystemproxy.queryVNFMDetail(transactionId, fromAppId, authorization, vnfmId); + } catch (Exception e) { + throw new ExtsysException("Query VNFM detail from A&AI failed.", e); + } } - } - - public static void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) throws ExtsysException { - if(!isTest) { - ClientConfig config = new ClientConfig(new ThirdpartySdncRegisterProvider()); - IExternalSystem registerSdncServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerSdncServiceproxy.registerThirdpartySdnc(transactionId, fromAppId, authorization, thirdpartySdncId, - esrSdncDetail); - } catch (Exception e) { - throw new ExtsysException("PUT thirdparty SDNC to A&AI failed.", e); - } + + public static String queryVnfmList() throws ExtsysException { + if (isTest) { + String vnfmListStr = "{\"esr-vnfm\": " + "[{\"vnfm-id\": \"123456\"," + "\"vim-id\": \"987654\"," + + "\"certificate-url\": \"http://11.22.33.44:5000/v3\"," + "\"resource-version\": \"1\"}]}"; + return vnfmListStr; + } + try { + return externalSystemproxy.queryVNFMList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query VNFM list from A&AI failed.", e); + } } - } - - public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws ExtsysException { - if(isTest) { - String sdncDetail = "{\"thirdparty-sdnc-id\":\"123456\"," - + "\"location\":\"edge\"," - + "\"product-name\":\"thirdparty SDNC\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"987654\"," - + "\"system-name\":\"SDNC_TEST\"," - + "\"type\":\"SDNC\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://127.0.0.1:8000\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"123987\"," - + "\"system-type\":\"thirdparty_SDNC\"," - + "\"protocol\":\"protocol\"}]}}"; - return sdncDetail; + + public static void deleteVnfm(String vnfmId, String resourceVersion) throws ExtsysException { + if (!isTest) { + try { + externalSystemproxy.deleteVNFM(transactionId, fromAppId, authorization, vnfmId, resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete VNFM from A&AI failed.", e); + } + } } - try { - return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, thirdpartySdncId); - } catch (Exception e) { - throw new ExtsysException("Query thirdparty SDNC detail from A&AI failed.", e); + + public static void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) + throws ExtsysException { + if (!isTest) { + ClientConfig config = new ClientConfig(new ThirdpartySdncRegisterProvider()); + IExternalSystem registerSdncServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerSdncServiceproxy.registerThirdpartySdnc(transactionId, fromAppId, authorization, + thirdpartySdncId, esrSdncDetail); + } catch (Exception e) { + throw new ExtsysException("PUT thirdparty SDNC to A&AI failed.", e); + } + } } - } - - public static String querySdncList() throws ExtsysException { - if(isTest) { - String sdncList = "{\"esr-thirdparty-sdnc\": " - + "[{\"thirdparty-sdnc-id\": \"123456\"," - + "\"location\": \"edge\"," - + "\"product-name\": \"thirdparty SDNC\"," - + "\"resource-version\": \"1\"}]}"; - return sdncList; + + public static String queryThirdpartySdncDetail(String thirdpartySdncId) throws ExtsysException { + if (isTest) { + String sdncDetail = "{\"thirdparty-sdnc-id\":\"123456\"," + "\"location\":\"edge\"," + + "\"product-name\":\"thirdparty SDNC\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"987654\"," + "\"system-name\":\"SDNC_TEST\"," + "\"type\":\"SDNC\"," + + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + "\"service-url\":\"http://127.0.0.1:8000\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"123987\"," + "\"system-type\":\"thirdparty_SDNC\"," + + "\"protocol\":\"protocol\"}]}}"; + return sdncDetail; + } + try { + return externalSystemproxy.queryThirdpartySdncDetail(transactionId, fromAppId, authorization, + thirdpartySdncId); + } catch (Exception e) { + throw new ExtsysException("Query thirdparty SDNC detail from A&AI failed.", e); + } } - try { - return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query thirdparty SDNC list from A&AI failed.", e); + + public static String querySdncList() throws ExtsysException { + if (isTest) { + String sdncList = + "{\"esr-thirdparty-sdnc\": " + "[{\"thirdparty-sdnc-id\": \"123456\"," + "\"location\": \"edge\"," + + "\"product-name\": \"thirdparty SDNC\"," + "\"resource-version\": \"1\"}]}"; + return sdncList; + } + try { + return externalSystemproxy.queryThirdpartySdncList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query thirdparty SDNC list from A&AI failed.", e); + } } - } - - public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws ExtsysException { - if(!isTest) { - try { - externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e); - } + + public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws ExtsysException { + if (!isTest) { + try { + externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, + resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e); + } + } } - } - - public static void registerEms(String emsId, EsrEmsDetail emsDetail) throws ExtsysException { - ClientConfig config = new ClientConfig(new EmsRegisterProvider()); - IExternalSystem registerEmsServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); - try { - registerEmsServiceproxy.registerEMS(transactionId, fromAppId, authorization, emsId, - emsDetail); - } catch (Exception e) { - throw new ExtsysException("PUT EMS to A&AI failed.", e); + + public static void registerEms(String emsId, EsrEmsDetail emsDetail) throws ExtsysException { + ClientConfig config = new ClientConfig(new EmsRegisterProvider()); + IExternalSystem registerEmsServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getExternalSystemAddr(), config, IExternalSystem.class); + try { + registerEmsServiceproxy.registerEMS(transactionId, fromAppId, authorization, emsId, emsDetail); + } catch (Exception e) { + throw new ExtsysException("PUT EMS to A&AI failed.", e); + } } - } - - public static String queryEmsDetail(String emsId) throws ExtsysException { - try { - return externalSystemproxy.queryEMSDetail(transactionId, fromAppId, authorization, emsId); - } catch (Exception e) { - throw new ExtsysException("Query EMS detail from A&AI failed.", e); + + public static String queryEmsDetail(String emsId) throws ExtsysException { + try { + return externalSystemproxy.queryEMSDetail(transactionId, fromAppId, authorization, emsId); + } catch (Exception e) { + throw new ExtsysException("Query EMS detail from A&AI failed.", e); + } } - } - - public static String queryEmsList() throws ExtsysException { - try { - return externalSystemproxy.queryEMSList(transactionId, fromAppId, authorization); - } catch (Exception e) { - throw new ExtsysException("Query EMS list from A&AI failed.", e); + + public static String queryEmsList() throws ExtsysException { + try { + return externalSystemproxy.queryEMSList(transactionId, fromAppId, authorization); + } catch (Exception e) { + throw new ExtsysException("Query EMS list from A&AI failed.", e); + } } - } - - public static void deleteEms(String emsId, String resourceVersion) throws ExtsysException { - try { - externalSystemproxy.deleteEMS(transactionId, fromAppId, authorization, emsId, resourceVersion); - } catch (Exception e) { - throw new ExtsysException("Delete EMS from A&AI failed.", e); + + public static void deleteEms(String emsId, String resourceVersion) throws ExtsysException { + try { + externalSystemproxy.deleteEMS(transactionId, fromAppId, authorization, emsId, resourceVersion); + } catch (Exception e) { + throw new ExtsysException("Delete EMS from A&AI failed.", e); + } } - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java index 8f38619..43b9837 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ICloudRegion.java @@ -25,7 +25,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.exception.ExtsysException; @@ -33,41 +32,37 @@ import org.onap.aai.esr.exception.ExtsysException; @Path("/cloud-regions") public interface ICloudRegion { - @PUT - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerVIMService(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, CloudRegionDetail cloudRegion) throws ExtsysException; + @PUT + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerVIMService(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id, + CloudRegionDetail cloudRegion) throws ExtsysException; + + @GET + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVIMDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id) + throws ExtsysException; - @GET - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVIMDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id) throws ExtsysException; - - @GET - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVIMList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVIMList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @DELETE - @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteVim(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @DELETE + @Path("/cloud-region/{cloud_owner}/{cloud_region_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteVim(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("cloud_owner") String cloud_owner, @PathParam("cloud_region_id") String cloud_region_id, + @QueryParam("resource-version") String resourceVersion) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java index 037b077..c066654 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/IExternalSystem.java @@ -25,7 +25,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; @@ -34,111 +33,103 @@ import org.onap.aai.esr.exception.ExtsysException; @Path("/") public interface IExternalSystem { - @PUT - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerVNFM(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("vnfm_id") String vnfmId, - EsrVnfmDetail esrVnfmDetail) throws ExtsysException; + @PUT + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerVNFM(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId, EsrVnfmDetail esrVnfmDetail) throws ExtsysException; + + @GET + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVNFMDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId) throws ExtsysException; - @GET - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVNFMDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("vnfm_id") String vnfmId) - throws ExtsysException; + @GET + @Path("/esr-vnfm-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryVNFMList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @GET - @Path("/esr-vnfm-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryVNFMList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @DELETE + @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteVNFM(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("vnfm_id") String vnfmId, @QueryParam("resource-version") String resourceVersion) + throws ExtsysException; - @DELETE - @Path("/esr-vnfm-list/esr-vnfm/{vnfm_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteVNFM(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("vnfm_id") String vnfmId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @PUT + @Path("/esr-ems-list/esr-ems/{ems_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerEMS(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId, EsrEmsDetail esrEmsDetail) throws ExtsysException; - @PUT - @Path("/esr-ems-list/esr-ems/{ems_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerEMS(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("ems_id") String emsId, - EsrEmsDetail esrEmsDetail) throws ExtsysException; + @GET + @Path("/esr-ems-list/esr-ems/{ems_id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryEMSDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId) throws ExtsysException; - @GET - @Path("/esr-ems-list/esr-ems/{ems_id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryEMSDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("ems_id") String emsId) - throws ExtsysException; + @GET + @Path("/esr-ems-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryEMSList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @GET - @Path("/esr-ems-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryEMSList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @DELETE + @Path("/esr-ems-list/esr-ems/{ems_id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteEMS(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("ems_id") String emsId, @QueryParam("resource-version") String resourceVersion) + throws ExtsysException; - @DELETE - @Path("/esr-ems-list/esr-ems/{ems_id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteEMS(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("ems_id") String emsId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; - - @PUT - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void registerThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, - EsrThirdpartySdncDetail esrThirdpartySdncDetail) throws ExtsysException; + @PUT + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void registerThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, EsrThirdpartySdncDetail esrThirdpartySdncDetail) + throws ExtsysException; - @GET - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}?depth=all") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryThirdpartySdncDetail(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, @PathParam("thirdparty-sdnc-id") String thirdpartySdncId) - throws ExtsysException; + @GET + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}?depth=all") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryThirdpartySdncDetail(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId) throws ExtsysException; - @GET - @Path("/esr-thirdparty-sdnc-list") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public String queryThirdpartySdncList(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization) throws ExtsysException; + @GET + @Path("/esr-thirdparty-sdnc-list") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryThirdpartySdncList(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization) + throws ExtsysException; - @DELETE - @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void deleteThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, - @HeaderParam("X-FromAppId") String fromApp, - @HeaderParam("Authorization") String authorization, - @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, - @QueryParam("resource-version") String resourceVersion) throws ExtsysException; + @DELETE + @Path("/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/{thirdparty-sdnc-id}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void deleteThirdpartySdnc(@HeaderParam("X-TransactionId") String transactionId, + @HeaderParam("X-FromAppId") String fromApp, @HeaderParam("Authorization") String authorization, + @PathParam("thirdparty-sdnc-id") String thirdpartySdncId, + @QueryParam("resource-version") String resourceVersion) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java index 61964fc..d4c4bc4 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/ThirdpartySdncRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class ThirdpartySdncRegisterProvider implements MessageBodyWriter{ - - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrThirdpartySdncDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrThirdpartySdncDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrThirdpartySdncDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrThirdpartySdncDetail.class); - logger.info("the param to register VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class ThirdpartySdncRegisterProvider implements MessageBodyWriter { + + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrThirdpartySdncDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrThirdpartySdncDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrThirdpartySdncDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrThirdpartySdncDetail.class); + logger.info("the param to register VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java index 58a0c72..59b2253 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VimRegisterProvider.java @@ -19,39 +19,35 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VimRegisterProvider implements MessageBodyWriter{ - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return CloudRegionDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(CloudRegionDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(CloudRegionDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, CloudRegionDetail.class); - logger.info("the param to register VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VimRegisterProvider implements MessageBodyWriter { + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return CloudRegionDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(CloudRegionDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(CloudRegionDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, CloudRegionDetail.class); + logger.info("the param to register VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java index d72b073..26709d7 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/aai/VnfmRegisterProvider.java @@ -19,40 +19,36 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VnfmRegisterProvider implements MessageBodyWriter{ - - private static final Logger logger = LoggerFactory.getLogger(VnfmRegisterProvider.class); - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return EsrVnfmDetail.class.isAssignableFrom(type); - } - - @Override - public long getSize(EsrVnfmDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(EsrVnfmDetail t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, EsrVnfmDetail.class); - logger.info("the param to register VNFM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VnfmRegisterProvider implements MessageBodyWriter { + + private static final Logger logger = LoggerFactory.getLogger(VnfmRegisterProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return EsrVnfmDetail.class.isAssignableFrom(type); + } + + @Override + public long getSize(EsrVnfmDetail t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(EsrVnfmDetail t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, EsrVnfmDetail.class); + logger.info("the param to register VNFM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java index 6c7bb31..8d5ead6 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/IVimManage.java @@ -21,16 +21,15 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; - import org.onap.aai.esr.exception.ExtsysException; @Path("/") public interface IVimManage { - @POST - @Path("/{cloud_owner}_{cloud_region_id}/registry") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - public void updateVIM(@PathParam("cloud_owner") String cloud_owner, - @PathParam("cloud_region_id") String cloud_region_id, Tenant tenant) throws ExtsysException; + @POST + @Path("/{cloud_owner}_{cloud_region_id}/registry") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public void updateVIM(@PathParam("cloud_owner") String cloud_owner, + @PathParam("cloud_region_id") String cloud_region_id, Tenant tenant) throws ExtsysException; } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java index 947480f..2937862 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/Tenant.java @@ -16,20 +16,19 @@ package org.onap.aai.esr.externalservice.cloud; import java.io.Serializable; - import com.google.gson.annotations.SerializedName; public class Tenant implements Serializable { - public static final long serialVersionUID = 1L; + public static final long serialVersionUID = 1L; - @SerializedName("defaultTenant") - private String defaultTenant; + @SerializedName("defaultTenant") + private String defaultTenant; - public String getDefaultTenant() { - return defaultTenant; - } + public String getDefaultTenant() { + return defaultTenant; + } - public void setDefaultTenant(String defaultTenant) { - this.defaultTenant = defaultTenant; - } + public void setDefaultTenant(String defaultTenant) { + this.defaultTenant = defaultTenant; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java index a976937..8d4aabd 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxy.java @@ -18,20 +18,18 @@ package org.onap.aai.esr.externalservice.cloud; import org.glassfish.jersey.client.ClientConfig; import org.onap.aai.esr.common.MsbConfig; import org.onap.aai.esr.exception.ExtsysException; - import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class VimManagerProxy { - - public static void updateVim(String cloudOwner, String cloudRegionId, - Tenant tenant) throws ExtsysException { - ClientConfig config = new ClientConfig(new VimUpdateProvider()); - IVimManage updateVimServiceproxy = ConsumerFactory - .createConsumer(MsbConfig.getMultiCloudAddr(), config, IVimManage.class); - try { - updateVimServiceproxy.updateVIM(cloudOwner, cloudRegionId, tenant); - } catch (Exception e) { - throw new ExtsysException("Update cloud region to A&AI by Multi-Cloud failed.", e); + + public static void updateVim(String cloudOwner, String cloudRegionId, Tenant tenant) throws ExtsysException { + ClientConfig config = new ClientConfig(new VimUpdateProvider()); + IVimManage updateVimServiceproxy = + ConsumerFactory.createConsumer(MsbConfig.getMultiCloudAddr(), config, IVimManage.class); + try { + updateVimServiceproxy.updateVIM(cloudOwner, cloudRegionId, tenant); + } catch (Exception e) { + throw new ExtsysException("Update cloud region to A&AI by Multi-Cloud failed.", e); + } } - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java index 9526ac7..1a05993 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/cloud/VimUpdateProvider.java @@ -19,39 +19,34 @@ import java.io.IOException; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.ext.MessageBodyWriter; - import org.onap.aai.esr.externalservice.aai.VimRegisterProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; -public class VimUpdateProvider implements MessageBodyWriter{ - private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); - - @Override - public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, - MediaType mediaType) { - return Tenant.class.isAssignableFrom(type); - } - - @Override - public long getSize(Tenant t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType) { - return -1; - } - - @Override - public void writeTo(Tenant t, Class type, Type genericType, - Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, - OutputStream entityStream) throws IOException, WebApplicationException { - String json = new Gson().toJson(t, Tenant.class); - logger.info("the param to update VIM input is:" + json); - entityStream.write(json.getBytes("UTF-8")); - } +public class VimUpdateProvider implements MessageBodyWriter { + private static final Logger logger = LoggerFactory.getLogger(VimRegisterProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return Tenant.class.isAssignableFrom(type); + } + + @Override + public long getSize(Tenant t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return -1; + } + + @Override + public void writeTo(Tenant t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + String json = new Gson().toJson(t, Tenant.class); + logger.info("the param to update VIM input is:" + json); + entityStream.write(json.getBytes("UTF-8")); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java index 5f0d6b9..7452937 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/externalservice/msb/MsbHelper.java @@ -18,39 +18,38 @@ package org.onap.aai.esr.externalservice.msb; import java.net.InetAddress; import java.util.HashSet; import java.util.Set; - import org.onap.msb.sdk.discovery.entity.MicroServiceInfo; import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.onap.msb.sdk.discovery.entity.Node; public class MsbHelper { - private MSBServiceClient msbClient; + private MSBServiceClient msbClient; + + public MsbHelper(MSBServiceClient msbClient) { + super(); + this.msbClient = msbClient; + } - public MsbHelper(MSBServiceClient msbClient) { - super(); - this.msbClient = msbClient; - } + public void registerMsb() throws Exception { - public void registerMsb() throws Exception { + MicroServiceInfo msinfo = new MicroServiceInfo(); - MicroServiceInfo msinfo = new MicroServiceInfo(); + msinfo.setServiceName("aai-esr-server"); + msinfo.setVersion("v1"); + msinfo.setUrl("/api/aai-esr-server/v1"); + msinfo.setProtocol("REST"); + msinfo.setVisualRange("0|1"); - msinfo.setServiceName("aai-esr-server"); - msinfo.setVersion("v1"); - msinfo.setUrl("/api/aai-esr-server/v1"); - msinfo.setProtocol("REST"); - msinfo.setVisualRange("0|1"); - - Set nodes = new HashSet<>(); - Node node1 = new Node(); - node1.setIp(InetAddress.getLocalHost().getHostAddress()); - node1.setPort("9518"); - nodes.add(node1); - msinfo.setNodes(nodes); - msbClient.registerMicroServiceInfo(msinfo, false); - } + Set nodes = new HashSet<>(); + Node node1 = new Node(); + node1.setIp(InetAddress.getLocalHost().getHostAddress()); + node1.setPort("9518"); + nodes.add(node1); + msinfo.setNodes(nodes); + msbClient.registerMicroServiceInfo(msinfo, false); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java index 11fba23..3c18353 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/EmsManager.java @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.EmsManagerWrapper; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import org.slf4j.LoggerFactory; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,107 +44,102 @@ import javax.ws.rs.core.Response; @Api(tags = {" ems Management "}) public class EmsManager { - private static final Logger LOGGER = LoggerFactory.getLogger(EmsManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(EmsManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all ems. + */ + @GET + @ApiOperation(value = "get all ems ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryEmsList() { + LOGGER.info("start query all ems!"); + return EmsManagerWrapper.getInstance().queryEmsList(); + } + + /** + * query ems info by id. + */ + @Path("/{emsId}") + @GET + @ApiOperation(value = "get ems by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryemsById(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start query ems by id." + emsId); + return EmsManagerWrapper.getInstance().queryEmsById(emsId); + } + + /** + * delete ems by id. + */ + @Path("/{emsId}") + @DELETE + @ApiOperation(value = "delete a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delems(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { + LOGGER.info("start delete ems .id:" + emsId); + return EmsManagerWrapper.getInstance().delEms(emsId); + } + + /** + * update ems by id. + */ + @PUT + @Path("/{emsId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems, + @ApiParam(value = "ems id", required = true) @PathParam("emsId") String emsId) { + LOGGER.info("start update ems .id:" + emsId + " info:" + extsysUtil.objectToString(ems)); + return EmsManagerWrapper.getInstance().updateEms(ems, emsId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all ems. - */ - @GET - @ApiOperation(value = "get all ems ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryEmsList() { - LOGGER.info("start query all ems!"); - return EmsManagerWrapper.getInstance().queryEmsList(); - } - - /** - * query ems info by id. - */ - @Path("/{emsId}") - @GET - @ApiOperation(value = "get ems by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryemsById(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { - LOGGER.info("start query ems by id." + emsId); - return EmsManagerWrapper.getInstance().queryEmsById(emsId); - } - - /** - * delete ems by id. - */ - @Path("/{emsId}") - @DELETE - @ApiOperation(value = "delete a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delems(@ApiParam(value = "ems id") @PathParam("emsId") String emsId) { - LOGGER.info("start delete ems .id:" + emsId); - return EmsManagerWrapper.getInstance().delEms(emsId); - } - - /** - * update ems by id. - */ - @PUT - @Path("/{emsId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems, - @ApiParam(value = "ems id", required = true) @PathParam("emsId") String emsId) { - LOGGER.info("start update ems .id:" + emsId + " info:" + extsysUtil.objectToString(ems)); - return EmsManagerWrapper.getInstance().updateEms(ems, emsId); - } - - /** - * register ems. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a ems") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems) { - LOGGER.info("start add ems" + " info:" + extsysUtil.objectToString(ems)); - return EmsManagerWrapper.getInstance().registerEms(ems); - } + /** + * register ems. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a ems") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerEms(@ApiParam(value = "ems", required = true) EmsRegisterInfo ems) { + LOGGER.info("start add ems" + " info:" + extsysUtil.objectToString(ems)); + return EmsManagerWrapper.getInstance().registerEms(ems); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java index d92d40b..cee2dc6 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ServiceTest.java @@ -20,11 +20,8 @@ import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.eclipse.jetty.http.HttpStatus; - import com.codahale.metrics.annotation.Timed; - import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; @@ -34,18 +31,17 @@ import io.swagger.annotations.ApiResponses; @Api(tags = {" service test "}) public class ServiceTest { - @GET - @ApiOperation(value = " service test ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryEmsList() { - return Response.ok("hello world !").build(); - } + @GET + @ApiOperation(value = " service test ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryEmsList() { + return Response.ok("hello world !").build(); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java index 93edffb..b633b8c 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.ThirdpartySdncWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,106 +44,106 @@ import javax.ws.rs.core.Response; @Api(tags = {"ThirdParty sdnc Management "}) public class ThirdpartySdncManager { - private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpartySdncManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpartySdncManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all thirdParty sdnc. + */ + @GET + @ApiOperation(value = "get all thirdParty sdnc ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncList() { + LOGGER.info("start query all thirdParty sdnc!"); + return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncList(); + } + + /** + * query thirdParty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @GET + @ApiOperation(value = "get thirdParty sdnc by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryThirdpartySdncById( + @ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start query thirdparty sdnc by id." + thirdPartySdncId); + return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncById(thirdPartySdncId); + } + + /** + * delete thirdparty sdnc by id. + */ + @Path("/{thirdPartySdncId}") + @DELETE + @ApiOperation(value = "delete a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delThirdpartySdnc( + @ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start delete thirdparty sdnc .id:" + thirdPartySdncId); + return ThirdpartySdncWrapper.getInstance().delThirdpartySdnc(thirdPartySdncId); + } + + /** + * update thirdParty sdnc by id. + */ + @PUT + @Path("/{thirdPartySdncId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a thirdParty Sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateThirdpartySdnc( + @ApiParam(value = "thirdpartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc, + @ApiParam(value = "sdnc id", required = true) @PathParam("thirdPartySdncId") String thirdPartySdncId) { + LOGGER.info("start update sdnc .id:" + thirdPartySdncId + " info:" + extsysUtil.objectToString(thirdPartySdnc)); + return ThirdpartySdncWrapper.getInstance().updateThirdpartySdnc(thirdPartySdnc, thirdPartySdncId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - /** - *query all thirdParty sdnc. - */ - @GET - @ApiOperation(value = "get all thirdParty sdnc ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryThirdpartySdncList() { - LOGGER.info("start query all thirdParty sdnc!"); - return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncList(); - } - - /** - *query thirdParty sdnc by id. - */ - @Path("/{thirdPartySdncId}") - @GET - @ApiOperation(value = "get thirdParty sdnc by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryThirdpartySdncById(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start query thirdparty sdnc by id." + thirdPartySdncId); - return ThirdpartySdncWrapper.getInstance().queryThirdpartySdncById(thirdPartySdncId); - } - - /** - *delete thirdparty sdnc by id. - */ - @Path("/{thirdPartySdncId}") - @DELETE - @ApiOperation(value = "delete a thirdparty sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delThirdpartySdnc(@ApiParam(value = "thirdparty sdnc id") @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start delete thirdparty sdnc .id:" + thirdPartySdncId); - return ThirdpartySdncWrapper.getInstance().delThirdpartySdnc(thirdPartySdncId); - } - - /** - *update thirdParty sdnc by id. - */ - @PUT - @Path("/{thirdPartySdncId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a thirdParty Sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateThirdpartySdnc(@ApiParam(value = "thirdpartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc, - @ApiParam(value = "sdnc id", required = true) @PathParam("thirdPartySdncId") String thirdPartySdncId) { - LOGGER.info("start update sdnc .id:" + thirdPartySdncId + " info:" + extsysUtil.objectToString(thirdPartySdnc)); - return ThirdpartySdncWrapper.getInstance().updateThirdpartySdnc(thirdPartySdnc, thirdPartySdncId); - } - - /** - *thirdParty sdnc register. - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "register a thirdparty sdnc") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerThirdpatySdnc(@ApiParam(value = "thirdPartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc) { - LOGGER.info("start register sdnc" + " info:" + extsysUtil.objectToString(thirdPartySdnc)); - return ThirdpartySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc); - } + /** + * thirdParty sdnc register. + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "register a thirdparty sdnc") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerThirdpatySdnc( + @ApiParam(value = "thirdPartySdnc", required = true) ThirdpartySdncRegisterInfo thirdPartySdnc) { + LOGGER.info("start register sdnc" + " info:" + extsysUtil.objectToString(thirdPartySdnc)); + return ThirdpartySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java index aa7d34d..b408f62 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VimManager.java @@ -21,14 +21,12 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VimRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.VimManagerWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -45,105 +43,103 @@ import javax.ws.rs.core.Response; @Api(tags = {" vim Management "}) public class VimManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VimManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VimManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all VIM. + */ + @GET + @ApiOperation(value = "get all vim ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimList() { + return VimManagerWrapper.getInstance().queryVimListDetails(); + } + + /** + * query vim by id. + */ + @Path("/{cloudOwner}/{cloudRegionId}") + @GET + @ApiOperation(value = "get vim by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVimById(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId) { + LOGGER.info("start query vim by cloud owner and cloud region id." + cloudOwner + "," + cloudRegionId); + return VimManagerWrapper.getInstance().queryVimById(cloudOwner, cloudRegionId); + } + + /** + * delete vim by id. + */ + @Path("/{cloudOwner}/{cloudRegionId}") + @DELETE + @ApiOperation(value = "delete a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delvim(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId) { + LOGGER.info("start delete cloud-owner :" + cloudOwner + ", cloud-region-id: " + cloudRegionId); + return VimManagerWrapper.getInstance().delVim(cloudOwner, cloudRegionId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all VIM. - */ - @GET - @ApiOperation(value = "get all vim ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVimList() { - return VimManagerWrapper.getInstance().queryVimListDetails(); - } + /** + * update vim by id. + */ + @PUT + @Path("/{cloudOwner}/{cloudRegionId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @ApiOperation(value = "update a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updatevims(@PathParam("cloudOwner") String cloudOwner, + @PathParam("cloudRegionId") String cloudRegionId, VimRegisterInfo vim) { + LOGGER.info("start update vim info:" + extsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().updateVim(cloudOwner, cloudRegionId, vim); + } - /** - * query vim by id. - */ - @Path("/{cloudOwner}/{cloudRegionId}") - @GET - @ApiOperation(value = "get vim by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVimById(@PathParam("cloudOwner") String cloudOwner, @PathParam("cloudRegionId") String cloudRegionId) { - LOGGER.info("start query vim by cloud owner and cloud region id." + cloudOwner +"," + cloudRegionId); - return VimManagerWrapper.getInstance().queryVimById(cloudOwner, cloudRegionId); - } - - /** - * delete vim by id. - */ - @Path("/{cloudOwner}/{cloudRegionId}") - @DELETE - @ApiOperation(value = "delete a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delvim(@PathParam("cloudOwner") String cloudOwner,@PathParam("cloudRegionId") String cloudRegionId) { - LOGGER.info("start delete cloud-owner :" + cloudOwner +", cloud-region-id: " + cloudRegionId); - return VimManagerWrapper.getInstance().delVim(cloudOwner, cloudRegionId); - } - - /** - * update vim by id. - */ - @PUT - @Path("/{cloudOwner}/{cloudRegionId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "update a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updatevims(@PathParam("cloudOwner") String cloudOwner, @PathParam("cloudRegionId") String cloudRegionId, VimRegisterInfo vim) { - LOGGER.info("start update vim info:" + extsysUtil.objectToString(vim)); - return VimManagerWrapper.getInstance().updateVim(cloudOwner, cloudRegionId, vim); - } - - /** - * register vim . - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a vim") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerVims(VimRegisterInfo vim) { - LOGGER.info("start add vim" + " info:" + extsysUtil.objectToString(vim)); - return VimManagerWrapper.getInstance().registerVim(vim); - } + /** + * register vim . + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vim") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVims(VimRegisterInfo vim) { + LOGGER.info("start add vim" + " info:" + extsysUtil.objectToString(vim)); + return VimManagerWrapper.getInstance().registerVim(vim); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java index 893b5b5..f86fd57 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/VnfmManager.java @@ -22,14 +22,12 @@ import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.SwaggerDefinition; - import org.eclipse.jetty.http.HttpStatus; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.wrapper.VnfmManagerWrapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -46,106 +44,101 @@ import javax.ws.rs.core.Response; @Api(tags = {" vnfm Management "}) public class VnfmManager { - private static final Logger LOGGER = LoggerFactory.getLogger(VnfmManager.class); + private static final Logger LOGGER = LoggerFactory.getLogger(VnfmManager.class); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * query all vnfm. + */ + @GET + @ApiOperation(value = "get all vnfm ") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmList() { + LOGGER.info("start query all vnfm!"); + return VnfmManagerWrapper.getInstance().queryVnfmList(); + } + + /** + * query vnfm by id. + */ + @Path("/{vnfmId}") + @GET + @ApiOperation(value = "get vnfm by id") + @Produces(MediaType.APPLICATION_JSON) + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response queryVnfmById(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start query vnfm by id." + vnfmId); + return VnfmManagerWrapper.getInstance().queryVnfmById(vnfmId); + } + + /** + * delete vnfm by id. + */ + @Path("/{vnfmId}") + @DELETE + @ApiOperation(value = "delete a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response delVnfm(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start delete vnfm .id:" + vnfmId); + return VnfmManagerWrapper.getInstance().delVnfm(vnfmId); + } + + /** + * update vnfm by id. + */ + @PUT + @Path("/{vnfmId}") + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "update a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response updateVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm, + @ApiParam(value = "vnfm id", required = true) @PathParam("vnfmId") String vnfmId) { + LOGGER.info("start update vnfm .id:" + vnfmId + " info:" + extsysUtil.objectToString(vnfm)); + return VnfmManagerWrapper.getInstance().updateVnfm(vnfm, vnfmId); + } - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * query all vnfm. - */ - @GET - @ApiOperation(value = "get all vnfm ") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVnfmList() { - LOGGER.info("start query all vnfm!"); - return VnfmManagerWrapper.getInstance().queryVnfmList(); - } - - /** - * query vnfm by id. - */ - @Path("/{vnfmId}") - @GET - @ApiOperation(value = "get vnfm by id") - @Produces(MediaType.APPLICATION_JSON) - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response queryVnfmById(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start query vnfm by id." + vnfmId); - return VnfmManagerWrapper.getInstance().queryVnfmById(vnfmId); - } - - /** - * delete vnfm by id. - */ - @Path("/{vnfmId}") - @DELETE - @ApiOperation(value = "delete a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response delVnfm(@ApiParam(value = "vnfm id") @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start delete vnfm .id:" + vnfmId); - return VnfmManagerWrapper.getInstance().delVnfm(vnfmId); - } - - /** - * update vnfm by id. - */ - @PUT - @Path("/{vnfmId}") - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "update a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response updateVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm, - @ApiParam(value = "vnfm id", required = true) @PathParam("vnfmId") String vnfmId) { - LOGGER.info("start update vnfm .id:" + vnfmId + " info:" + extsysUtil.objectToString(vnfm)); - return VnfmManagerWrapper.getInstance().updateVnfm(vnfm, vnfmId); - } - - /** - * add vnfm . - */ - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "create a vnfm") - @ApiResponses(value = { - @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", - response = String.class), - @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, - message = "Unprocessable MicroServiceInfo Entity ", response = String.class), - @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", - response = String.class)}) - @Timed - public Response registerVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm) { - return VnfmManagerWrapper.getInstance().registerVnfm(vnfm); - } + /** + * add vnfm . + */ + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces({MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON}) + @ApiOperation(value = "create a vnfm") + @ApiResponses(value = { + @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "microservice not found", response = String.class), + @ApiResponse(code = HttpStatus.UNSUPPORTED_MEDIA_TYPE_415, + message = "Unprocessable MicroServiceInfo Entity ", response = String.class), + @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500, message = "internal server error", + response = String.class)}) + @Timed + public Response registerVnfm(@ApiParam(value = "vnfm", required = true) VnfmRegisterInfo vnfm) { + return VnfmManagerWrapper.getInstance().registerVnfm(vnfm); + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java index 404b118..4b6aca4 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java @@ -17,7 +17,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrEmsDetail; @@ -26,111 +25,112 @@ import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.entity.rest.FtpAddr; public class EmsManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) { - EsrEmsDetail esrEms = new EsrEmsDetail(); - esrEms.setEmsId(extsysUtil.generateId()); - List authInfos = getAuthInfosFromRegisterData(emsRegisterInfo); - esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos)); - return esrEms; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) { + EsrEmsDetail esrEms = new EsrEmsDetail(); + esrEms.setEmsId(extsysUtil.generateId()); + List authInfos = getAuthInfosFromRegisterData(emsRegisterInfo); + esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos)); + return esrEms; + } + + private List getAuthInfosFromRegisterData(EmsRegisterInfo emsRegisterInfo) { + List authInfos = new ArrayList<>(); + EsrSystemInfo resouceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_RESOUCE.toString()); + EsrSystemInfo performanceAuthInfo = + getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_PERFORMANCE.toString()); + EsrSystemInfo alarmAuthInfo = getAuthInfoFromAlarmAddr(emsRegisterInfo); + authInfos.add(resouceAuthInfo); + authInfos.add(performanceAuthInfo); + authInfos.add(alarmAuthInfo); + return authInfos; + } + + private EsrSystemInfo getAuthInfoFromFtpAddr(EmsRegisterInfo emsRegisterInfo, String systemType) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + FtpAddr ftpAddr = new FtpAddr(); + if (systemType.equals(SystemType.EMS_RESOUCE.toString())) { + ftpAddr = emsRegisterInfo.getResourceAddr(); + } else if (systemType.equals(SystemType.EMS_PERFORMANCE.toString())) { + ftpAddr = emsRegisterInfo.getPerformanceAddr(); + } + authInfo.setType(ftpAddr.getFtptype()); + authInfo.setIpAddress(ftpAddr.getIp()); + authInfo.setPort(ftpAddr.getPort()); + authInfo.setUserName(ftpAddr.getUser()); + authInfo.setPassword(ftpAddr.getPassword()); + authInfo.setRemotePath(ftpAddr.getRemotepath()); + authInfo.setPassive(ftpAddr.getPassive()); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setSystemType(systemType); + authInfo.setSystemName(emsRegisterInfo.getName()); + authInfo.setVendor(emsRegisterInfo.getVendor()); + authInfo.setVersion(emsRegisterInfo.getVersion()); + return authInfo; + } - private List getAuthInfosFromRegisterData(EmsRegisterInfo emsRegisterInfo) { - List authInfos = new ArrayList<>(); - EsrSystemInfo resouceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_RESOUCE.toString()); - EsrSystemInfo performanceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_PERFORMANCE.toString()); - EsrSystemInfo alarmAuthInfo = getAuthInfoFromAlarmAddr(emsRegisterInfo); - authInfos.add(resouceAuthInfo); - authInfos.add(performanceAuthInfo); - authInfos.add(alarmAuthInfo); - return authInfos; - } - - private EsrSystemInfo getAuthInfoFromFtpAddr(EmsRegisterInfo emsRegisterInfo, String systemType) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - FtpAddr ftpAddr = new FtpAddr(); - if(systemType.equals(SystemType.EMS_RESOUCE.toString())) { - ftpAddr = emsRegisterInfo.getResourceAddr(); - } else if(systemType.equals(SystemType.EMS_PERFORMANCE.toString())) { - ftpAddr = emsRegisterInfo.getPerformanceAddr(); + private EsrSystemInfo getAuthInfoFromAlarmAddr(EmsRegisterInfo emsRegisterInfo) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + AlarmAddr alarmAddr = emsRegisterInfo.getAlarmAddr(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setIpAddress(alarmAddr.getIp()); + authInfo.setPort(alarmAddr.getPort()); + authInfo.setUserName(alarmAddr.getUser()); + authInfo.setPassword(alarmAddr.getPassword()); + authInfo.setSystemType(SystemType.EMS_ALARM.toString()); + authInfo.setSystemName(emsRegisterInfo.getName()); + authInfo.setVendor(emsRegisterInfo.getVendor()); + authInfo.setVersion(emsRegisterInfo.getVersion()); + return authInfo; } - authInfo.setType(ftpAddr.getFtptype()); - authInfo.setIpAddress(ftpAddr.getIp()); - authInfo.setPort(ftpAddr.getPort()); - authInfo.setUserName(ftpAddr.getUser()); - authInfo.setPassword(ftpAddr.getPassword()); - authInfo.setRemotePath(ftpAddr.getRemotepath()); - authInfo.setPassive(ftpAddr.getPassive()); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setSystemType(systemType); - authInfo.setSystemName(emsRegisterInfo.getName()); - authInfo.setVendor(emsRegisterInfo.getVendor()); - authInfo.setVersion(emsRegisterInfo.getVersion()); - return authInfo; - } - - private EsrSystemInfo getAuthInfoFromAlarmAddr(EmsRegisterInfo emsRegisterInfo) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - AlarmAddr alarmAddr = emsRegisterInfo.getAlarmAddr(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setIpAddress(alarmAddr.getIp()); - authInfo.setPort(alarmAddr.getPort()); - authInfo.setUserName(alarmAddr.getUser()); - authInfo.setPassword(alarmAddr.getPassword()); - authInfo.setSystemType(SystemType.EMS_ALARM.toString()); - authInfo.setSystemName(emsRegisterInfo.getName()); - authInfo.setVendor(emsRegisterInfo.getVendor()); - authInfo.setVersion(emsRegisterInfo.getVersion()); - return authInfo; - } - - public EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEmsDetail esrEms) { - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - List esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo(); - emsRegisterInfo.setEmsId(esrEms.getEmsId()); - - for(int i=0; i esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo(); + emsRegisterInfo.setEmsId(esrEms.getEmsId()); + + for (int i = 0; i < esrSystemInfo.size(); i++) { + authInfo = esrSystemInfo.get(i); + if (authInfo.getSystemType().equals(SystemType.EMS_RESOUCE.toString())) { + FtpAddr resourceAddr = new FtpAddr(); + resourceAddr = getFtpAddrFromAuthInfo(authInfo); + emsRegisterInfo.setResourceAddr(resourceAddr); + } else if (authInfo.getSystemType().equals(SystemType.EMS_PERFORMANCE.toString())) { + FtpAddr performanceAddr = new FtpAddr(); + performanceAddr = getFtpAddrFromAuthInfo(authInfo); + emsRegisterInfo.setPerformanceAddr(performanceAddr); + } else if (authInfo.getSystemType().equals(SystemType.EMS_ALARM.toString())) { + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr = getAlarmAddrFromAuthInfo(authInfo); + emsRegisterInfo.setAlarmAddr(alarmAddr); + } + } + emsRegisterInfo.setName(authInfo.getSystemName()); + emsRegisterInfo.setVendor(authInfo.getVendor()); + emsRegisterInfo.setVersion(authInfo.getVersion()); + return emsRegisterInfo; + } + + private FtpAddr getFtpAddrFromAuthInfo(EsrSystemInfo authInfo) { + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setFtptype(authInfo.getType()); + ftpAddr.setIp(authInfo.getIpAddress()); + ftpAddr.setPassive(authInfo.getPassive()); + ftpAddr.setPassword(authInfo.getPassword()); + ftpAddr.setPort(authInfo.getPort()); + ftpAddr.setRemotepath(authInfo.getRemotePath()); + ftpAddr.setUser(authInfo.getUserName()); + return ftpAddr; + } + + private AlarmAddr getAlarmAddrFromAuthInfo(EsrSystemInfo authInfo) { AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr = getAlarmAddrFromAuthInfo(authInfo); - emsRegisterInfo.setAlarmAddr(alarmAddr); - } + alarmAddr.setIp(authInfo.getIpAddress()); + alarmAddr.setPassword(authInfo.getPassword()); + alarmAddr.setPort(authInfo.getPort()); + alarmAddr.setUser(authInfo.getUserName()); + return alarmAddr; } - emsRegisterInfo.setName(authInfo.getSystemName()); - emsRegisterInfo.setVendor(authInfo.getVendor()); - emsRegisterInfo.setVersion(authInfo.getVersion()); - return emsRegisterInfo; - } - - private FtpAddr getFtpAddrFromAuthInfo(EsrSystemInfo authInfo) { - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setFtptype(authInfo.getType()); - ftpAddr.setIp(authInfo.getIpAddress()); - ftpAddr.setPassive(authInfo.getPassive()); - ftpAddr.setPassword(authInfo.getPassword()); - ftpAddr.setPort(authInfo.getPort()); - ftpAddr.setRemotepath(authInfo.getRemotePath()); - ftpAddr.setUser(authInfo.getUserName()); - return ftpAddr; - } - - private AlarmAddr getAlarmAddrFromAuthInfo(EsrSystemInfo authInfo) { - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setIp(authInfo.getIpAddress()); - alarmAddr.setPassword(authInfo.getPassword()); - alarmAddr.setPort(authInfo.getPort()); - alarmAddr.setUser(authInfo.getUserName()); - return alarmAddr; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java index c3814e3..3bd0177 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java @@ -16,7 +16,6 @@ package org.onap.aai.esr.util; import com.google.gson.Gson; - import java.util.ArrayList; import java.util.List; import java.util.UUID; @@ -25,33 +24,33 @@ import org.onap.aai.esr.entity.aai.EsrSystemInfoList; public class ExtsysUtil { - public String generateId() { - return UUID.randomUUID().toString(); - } + public String generateId() { + return UUID.randomUUID().toString(); + } - /** - * change object to str. - */ - public String objectToString(Object obj) { - Gson gson = new Gson(); - if (obj != null) { - return gson.toJson(obj); - } else { - return null; + /** + * change object to str. + */ + public String objectToString(Object obj) { + Gson gson = new Gson(); + if (obj != null) { + return gson.toJson(obj); + } else { + return null; + } } - } - public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - esrSystemInfo.add(esrSystemInfoObj); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - return esrSystemInfoList; - } - - public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(List esrSystemInfo) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);; - return esrSystemInfoList; - } + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + return esrSystemInfoList; + } + + public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(List esrSystemInfo) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);; + return esrSystemInfoList; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java index 2a01ddc..19448af 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtil.java @@ -17,7 +17,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrSystemInfoList; @@ -25,51 +24,51 @@ import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; public class ThirdpartySdncManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrThirdpartySdncDetail sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) { - EsrThirdpartySdncDetail esrThirdpartySdnc = new EsrThirdpartySdncDetail(); - sdncRegisterInfo.setThirdpartySdncId(extsysUtil.generateId()); - esrThirdpartySdnc.setThirdpartySdncId(sdncRegisterInfo.getThirdpartySdncId()); - esrThirdpartySdnc.setLocation(sdncRegisterInfo.getLocation()); - esrThirdpartySdnc.setProductName(sdncRegisterInfo.getProductName()); - esrThirdpartySdnc.setEsrSystemInfoList(getEsrSystemInfoList(sdncRegisterInfo)); - return esrThirdpartySdnc; - } - - private EsrSystemInfoList getEsrSystemInfoList(ThirdpartySdncRegisterInfo sdncRegisterInfo) { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setVersion(sdncRegisterInfo.getVersion()); - authInfo.setSystemName(sdncRegisterInfo.getName()); - authInfo.setServiceUrl(sdncRegisterInfo.getUrl()); - authInfo.setVendor(sdncRegisterInfo.getVendor()); - authInfo.setType(sdncRegisterInfo.getType()); - authInfo.setUserName(sdncRegisterInfo.getUserName()); - authInfo.setPassword(sdncRegisterInfo.getPassword()); - authInfo.setProtocol(sdncRegisterInfo.getProtocol()); - authInfo.setSystemType(SystemType.thirdparty_SDNC.toString()); - esrSystemInfo.add(authInfo); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - return esrSystemInfoList; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public EsrThirdpartySdncDetail sdncRegisterInfo2EsrSdnc(ThirdpartySdncRegisterInfo sdncRegisterInfo) { + EsrThirdpartySdncDetail esrThirdpartySdnc = new EsrThirdpartySdncDetail(); + sdncRegisterInfo.setThirdpartySdncId(extsysUtil.generateId()); + esrThirdpartySdnc.setThirdpartySdncId(sdncRegisterInfo.getThirdpartySdncId()); + esrThirdpartySdnc.setLocation(sdncRegisterInfo.getLocation()); + esrThirdpartySdnc.setProductName(sdncRegisterInfo.getProductName()); + esrThirdpartySdnc.setEsrSystemInfoList(getEsrSystemInfoList(sdncRegisterInfo)); + return esrThirdpartySdnc; + } + + private EsrSystemInfoList getEsrSystemInfoList(ThirdpartySdncRegisterInfo sdncRegisterInfo) { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setVersion(sdncRegisterInfo.getVersion()); + authInfo.setSystemName(sdncRegisterInfo.getName()); + authInfo.setServiceUrl(sdncRegisterInfo.getUrl()); + authInfo.setVendor(sdncRegisterInfo.getVendor()); + authInfo.setType(sdncRegisterInfo.getType()); + authInfo.setUserName(sdncRegisterInfo.getUserName()); + authInfo.setPassword(sdncRegisterInfo.getPassword()); + authInfo.setProtocol(sdncRegisterInfo.getProtocol()); + authInfo.setSystemType(SystemType.thirdparty_SDNC.toString()); + esrSystemInfo.add(authInfo); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + return esrSystemInfoList; + } - public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdncDetail esrSdnc) { - ThirdpartySdncRegisterInfo registerSdncInfo = new ThirdpartySdncRegisterInfo(); - EsrSystemInfo esrSystemInfo = esrSdnc.getEsrSystemInfoList().getEsrSystemInfo().get(0); - registerSdncInfo.setThirdpartySdncId(esrSdnc.getThirdpartySdncId()); - registerSdncInfo.setLocation(esrSdnc.getLocation()); - registerSdncInfo.setProductName(esrSdnc.getProductName()); - registerSdncInfo.setName(esrSystemInfo.getSystemName()); - registerSdncInfo.setPassword(esrSystemInfo.getPassword()); - registerSdncInfo.setProtocol(esrSystemInfo.getProtocol()); - registerSdncInfo.setType(esrSystemInfo.getType()); - registerSdncInfo.setUrl(esrSystemInfo.getServiceUrl()); - registerSdncInfo.setUserName(esrSystemInfo.getUserName()); - registerSdncInfo.setVendor(esrSystemInfo.getVendor()); - registerSdncInfo.setVersion(esrSystemInfo.getVersion()); - return registerSdncInfo; - } + public ThirdpartySdncRegisterInfo esrSdnc2SdncRegisterInfo(EsrThirdpartySdncDetail esrSdnc) { + ThirdpartySdncRegisterInfo registerSdncInfo = new ThirdpartySdncRegisterInfo(); + EsrSystemInfo esrSystemInfo = esrSdnc.getEsrSystemInfoList().getEsrSystemInfo().get(0); + registerSdncInfo.setThirdpartySdncId(esrSdnc.getThirdpartySdncId()); + registerSdncInfo.setLocation(esrSdnc.getLocation()); + registerSdncInfo.setProductName(esrSdnc.getProductName()); + registerSdncInfo.setName(esrSystemInfo.getSystemName()); + registerSdncInfo.setPassword(esrSystemInfo.getPassword()); + registerSdncInfo.setProtocol(esrSystemInfo.getProtocol()); + registerSdncInfo.setType(esrSystemInfo.getType()); + registerSdncInfo.setUrl(esrSystemInfo.getServiceUrl()); + registerSdncInfo.setUserName(esrSystemInfo.getUserName()); + registerSdncInfo.setVendor(esrSystemInfo.getVendor()); + registerSdncInfo.setVersion(esrSystemInfo.getVersion()); + return registerSdncInfo; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java index 0a69f40..b37e319 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java @@ -18,7 +18,6 @@ package org.onap.aai.esr.util; import java.util.ArrayList; import java.util.List; - import org.onap.aai.esr.common.SystemType; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.CloudRegionDetail; @@ -27,72 +26,73 @@ import org.onap.aai.esr.entity.rest.VimAuthInfo; import org.onap.aai.esr.entity.rest.VimRegisterInfo; public class VimManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) { - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - - cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner()); - cloudRegion.setCloudRegionId(vimRegisterInfo.getCloudRegionId()); - cloudRegion.setCloudType(vimRegisterInfo.getCloudType()); - cloudRegion.setCloudRegionVersion(vimRegisterInfo.getCloudRegionVersion()); - cloudRegion.setCloudZone(vimRegisterInfo.getCloudZone()); - cloudRegion.setComplexName(vimRegisterInfo.getComplexName()); - cloudRegion.setOwnerDefinedType(vimRegisterInfo.getOwnerDefinedType()); - cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo()); - - EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); - esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus()); - EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); - cloudRegion.setEsrSystemInfoList(esrSystemInfoList); - return cloudRegion; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) { + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + + cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner()); + cloudRegion.setCloudRegionId(vimRegisterInfo.getCloudRegionId()); + cloudRegion.setCloudType(vimRegisterInfo.getCloudType()); + cloudRegion.setCloudRegionVersion(vimRegisterInfo.getCloudRegionVersion()); + cloudRegion.setCloudZone(vimRegisterInfo.getCloudZone()); + cloudRegion.setComplexName(vimRegisterInfo.getComplexName()); + cloudRegion.setOwnerDefinedType(vimRegisterInfo.getOwnerDefinedType()); + cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo()); + + EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos()); + esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus()); + EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); + cloudRegion.setEsrSystemInfoList(esrSystemInfoList); + return cloudRegion; + } + + private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List vimAuthInfos) { + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + VimAuthInfo vimAuthInfo = vimAuthInfos.get(0); + esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain()); + esrSystemInfoObj.setUserName(vimAuthInfo.getUserName()); + esrSystemInfoObj.setPassword(vimAuthInfo.getPassword()); + esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl()); + esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert()); + esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure()); + esrSystemInfoObj.setDefaultTenant(vimAuthInfo.getDefaultTenant()); + esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId()); + esrSystemInfoObj.setSystemType(SystemType.VIM.toString()); + // esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString()); + return esrSystemInfoObj; + } + + private VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo authInfo) { + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setAuthUrl(authInfo.getServiceUrl()); + vimAuthInfo.setCloudDomain(authInfo.getCloudDomain()); + vimAuthInfo.setPassword(authInfo.getPassword()); + vimAuthInfo.setSslCacert(authInfo.getSslCassert()); + vimAuthInfo.setSslInsecure(authInfo.getSslInsecure()); + vimAuthInfo.setUserName(authInfo.getUserName()); + vimAuthInfo.setDefaultTenant(authInfo.getDefaultTenant()); + return vimAuthInfo; + } - private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List vimAuthInfos) { - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - VimAuthInfo vimAuthInfo = vimAuthInfos.get(0); - esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain()); - esrSystemInfoObj.setUserName(vimAuthInfo.getUserName()); - esrSystemInfoObj.setPassword(vimAuthInfo.getPassword()); - esrSystemInfoObj.setServiceUrl(vimAuthInfo.getAuthUrl()); - esrSystemInfoObj.setSslCassert(vimAuthInfo.getSslCacert()); - esrSystemInfoObj.setSslInsecure(vimAuthInfo.getSslInsecure()); - esrSystemInfoObj.setDefaultTenant(vimAuthInfo.getDefaultTenant()); - esrSystemInfoObj.setEsrSystemInfoId(extsysUtil.generateId()); - esrSystemInfoObj.setSystemType(SystemType.VIM.toString()); -// esrSystemInfoObj.setSystemStatus(SystemStatus.normal.toString()); - return esrSystemInfoObj; - } - - private VimAuthInfo authInfo2VimAuthInfo(EsrSystemInfo authInfo) { - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setAuthUrl(authInfo.getServiceUrl()); - vimAuthInfo.setCloudDomain(authInfo.getCloudDomain()); - vimAuthInfo.setPassword(authInfo.getPassword()); - vimAuthInfo.setSslCacert(authInfo.getSslCassert()); - vimAuthInfo.setSslInsecure(authInfo.getSslInsecure()); - vimAuthInfo.setUserName(authInfo.getUserName()); - vimAuthInfo.setDefaultTenant(authInfo.getDefaultTenant()); - return vimAuthInfo; - } - - public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) { - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - List vimAuthInfos = new ArrayList<>(); - if(cloudRegion.getEsrSystemInfoList()!=null){ - VimAuthInfo vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); - vimAuthInfos.add(vimAuthInfo); - vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); + public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) { + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + List vimAuthInfos = new ArrayList<>(); + if (cloudRegion.getEsrSystemInfoList() != null) { + VimAuthInfo vimAuthInfo = + authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0)); + vimAuthInfos.add(vimAuthInfo); + vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus()); + } + vimRegisterInfo.setVimAuthInfos(vimAuthInfos); + vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo()); + vimRegisterInfo.setCloudOwner(cloudRegion.getCloudOwner()); + vimRegisterInfo.setCloudRegionId(cloudRegion.getCloudRegionId()); + vimRegisterInfo.setCloudType(cloudRegion.getCloudType()); + vimRegisterInfo.setCloudZone(cloudRegion.getCloudZone()); + vimRegisterInfo.setComplexName(cloudRegion.getComplexName()); + vimRegisterInfo.setCloudRegionVersion(cloudRegion.getCloudRegionVersion()); + vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType()); + return vimRegisterInfo; } - vimRegisterInfo.setVimAuthInfos(vimAuthInfos); - vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo()); - vimRegisterInfo.setCloudOwner(cloudRegion.getCloudOwner()); - vimRegisterInfo.setCloudRegionId(cloudRegion.getCloudRegionId()); - vimRegisterInfo.setCloudType(cloudRegion.getCloudType()); - vimRegisterInfo.setCloudZone(cloudRegion.getCloudZone()); - vimRegisterInfo.setComplexName(cloudRegion.getComplexName()); - vimRegisterInfo.setCloudRegionVersion(cloudRegion.getCloudRegionVersion()); - vimRegisterInfo.setOwnerDefinedType(cloudRegion.getOwnerDefinedType()); - return vimRegisterInfo; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java index f1f33a7..14da20e 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java @@ -22,54 +22,54 @@ import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; public class VnfmManagerUtil { - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - public EsrVnfmDetail vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) { - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl()); - esrVnfm.setVimId(vnfmRegisterInfo.getVimId()); - esrVnfm.setVnfmId(extsysUtil.generateId()); - authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo); - esrSystemInfo = extsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo); - esrVnfm.setEsrSystemInfoList(esrSystemInfo); - return esrVnfm; - } + private static ExtsysUtil extsysUtil = new ExtsysUtil(); - /** - * @param vnfmRegisterInfo vnfm register informantion from portal - * @return - */ - private EsrSystemInfo getAuthInfoFromVnfmRegisterInfo(VnfmRegisterInfo vnfmRegisterInfo) { - EsrSystemInfo authInfo = new EsrSystemInfo(); - authInfo.setEsrSystemInfoId(extsysUtil.generateId()); - authInfo.setSystemName(vnfmRegisterInfo.getName()); - authInfo.setType(vnfmRegisterInfo.getType()); - authInfo.setVendor(vnfmRegisterInfo.getVendor()); - authInfo.setVersion(vnfmRegisterInfo.getVersion()); - authInfo.setServiceUrl(vnfmRegisterInfo.getUrl()); - authInfo.setUserName(vnfmRegisterInfo.getUserName()); - authInfo.setPassword(vnfmRegisterInfo.getPassword()); - authInfo.setSystemType(SystemType.VNFM.toString()); - return authInfo; - } - - public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfmDetail esrVnfm) { - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - EsrSystemInfo authInfo = new EsrSystemInfo(); - vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId()); - vnfmRegisterInfo.setCertificateUrl(esrVnfm.getCertificateUrl()); - vnfmRegisterInfo.setVimId(esrVnfm.getVimId()); - authInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo().get(0); - vnfmRegisterInfo.setName(authInfo.getSystemName()); - vnfmRegisterInfo.setPassword(authInfo.getPassword()); - vnfmRegisterInfo.setType(authInfo.getType()); - vnfmRegisterInfo.setUrl(authInfo.getServiceUrl()); - vnfmRegisterInfo.setUserName(authInfo.getUserName()); - vnfmRegisterInfo.setVendor(authInfo.getVendor()); - vnfmRegisterInfo.setVersion(authInfo.getVersion()); - return vnfmRegisterInfo; - } + public EsrVnfmDetail vnfmRegisterInfo2EsrVnfm(VnfmRegisterInfo vnfmRegisterInfo) { + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + EsrSystemInfoList esrSystemInfo = new EsrSystemInfoList(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + esrVnfm.setCertificateUrl(vnfmRegisterInfo.getCertificateUrl()); + esrVnfm.setVimId(vnfmRegisterInfo.getVimId()); + esrVnfm.setVnfmId(extsysUtil.generateId()); + authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo); + esrSystemInfo = extsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo); + esrVnfm.setEsrSystemInfoList(esrSystemInfo); + return esrVnfm; + } + + /** + * @param vnfmRegisterInfo vnfm register informantion from portal + * @return + */ + private EsrSystemInfo getAuthInfoFromVnfmRegisterInfo(VnfmRegisterInfo vnfmRegisterInfo) { + EsrSystemInfo authInfo = new EsrSystemInfo(); + authInfo.setEsrSystemInfoId(extsysUtil.generateId()); + authInfo.setSystemName(vnfmRegisterInfo.getName()); + authInfo.setType(vnfmRegisterInfo.getType()); + authInfo.setVendor(vnfmRegisterInfo.getVendor()); + authInfo.setVersion(vnfmRegisterInfo.getVersion()); + authInfo.setServiceUrl(vnfmRegisterInfo.getUrl()); + authInfo.setUserName(vnfmRegisterInfo.getUserName()); + authInfo.setPassword(vnfmRegisterInfo.getPassword()); + authInfo.setSystemType(SystemType.VNFM.toString()); + return authInfo; + } + + public VnfmRegisterInfo esrVnfm2VnfmRegisterInfo(EsrVnfmDetail esrVnfm) { + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + EsrSystemInfo authInfo = new EsrSystemInfo(); + vnfmRegisterInfo.setVnfmId(esrVnfm.getVnfmId()); + vnfmRegisterInfo.setCertificateUrl(esrVnfm.getCertificateUrl()); + vnfmRegisterInfo.setVimId(esrVnfm.getVimId()); + authInfo = esrVnfm.getEsrSystemInfoList().getEsrSystemInfo().get(0); + vnfmRegisterInfo.setName(authInfo.getSystemName()); + vnfmRegisterInfo.setPassword(authInfo.getPassword()); + vnfmRegisterInfo.setType(authInfo.getType()); + vnfmRegisterInfo.setUrl(authInfo.getServiceUrl()); + vnfmRegisterInfo.setUserName(authInfo.getUserName()); + vnfmRegisterInfo.setVendor(authInfo.getVendor()); + vnfmRegisterInfo.setVersion(authInfo.getVersion()); + return vnfmRegisterInfo; + } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java index 8acc825..571afbc 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/EmsManagerWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.exception.ExceptionUtil; import org.onap.aai.esr.exception.ExtsysException; @@ -31,161 +29,159 @@ import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.rest.CommonRegisterResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class EmsManagerWrapper { - private static EmsManagerWrapper emsManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(EmsManagerWrapper.class); - private static EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); + private static EmsManagerWrapper emsManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(EmsManagerWrapper.class); + private static EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); - /** - * get VnfmManagerWrapper instance. - * @return ems manager wrapper instance - */ - public static EmsManagerWrapper getInstance() { - if (emsManagerWrapper == null) { - emsManagerWrapper = new EmsManagerWrapper(); + /** + * get VnfmManagerWrapper instance. + * + * @return ems manager wrapper instance + */ + public static EmsManagerWrapper getInstance() { + if (emsManagerWrapper == null) { + emsManagerWrapper = new EmsManagerWrapper(); + } + return emsManagerWrapper; } - return emsManagerWrapper; - } - - public Response registerEms(EmsRegisterInfo emsRegisterInfo) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); - String emsId = esrEmsDetail.getEmsId(); - try { - ExternalSystemProxy.registerEms(emsId, esrEmsDetail); - result.setId(emsId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register EMS failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response registerEms(EmsRegisterInfo emsRegisterInfo) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + String emsId = esrEmsDetail.getEmsId(); + try { + ExternalSystemProxy.registerEms(emsId, esrEmsDetail); + result.setId(emsId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register EMS failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response updateEms(EmsRegisterInfo emsRegisterInfo, String emsId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); - try { - ExternalSystemProxy.registerEms(emsId, esrEmsDetail); - result.setId(emsId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateEms(EmsRegisterInfo emsRegisterInfo, String emsId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = getNewEsrEmsDetail(emsRegisterInfo, emsId); + try { + ExternalSystemProxy.registerEms(emsId, esrEmsDetail); + result.setId(emsId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryEmsList() { - List emsList = new ArrayList<>(); - EsrEmsList esrEms = new EsrEmsList(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsList(); - esrEms = new Gson().fromJson(esrEmsStr, EsrEmsList.class); - LOG.info("Response from AAI by query EMS list: " + esrEms); - emsList = getEmsDetailList(esrEms); - return Response.ok(emsList).build(); - } catch (ExtsysException e) { - LOG.error("Query EMS list failed !", e); - return Response.ok(emsList).build(); + + public Response queryEmsList() { + List emsList = new ArrayList<>(); + EsrEmsList esrEms = new EsrEmsList(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsList(); + esrEms = new Gson().fromJson(esrEmsStr, EsrEmsList.class); + LOG.info("Response from AAI by query EMS list: " + esrEms); + emsList = getEmsDetailList(esrEms); + return Response.ok(emsList).build(); + } catch (ExtsysException e) { + LOG.error("Query EMS list failed !", e); + return Response.ok(emsList).build(); + } } - } - - public Response queryEmsById(String emsId) { - EmsRegisterInfo ems; - ems = queryEmsDetail(emsId); - if (ems != null) { - return Response.ok(ems).build(); - } else { - return Response.ok(ems).build(); + + public Response queryEmsById(String emsId) { + EmsRegisterInfo ems; + ems = queryEmsDetail(emsId); + if (ems != null) { + return Response.ok(ems).build(); + } else { + return Response.ok(ems).build(); + } } - } - - public Response delEms(String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail = queryEsrEmsDetail(emsId); - String resourceVersion = esrEmsDetail.getResourceVersion(); - try { - ExternalSystemProxy.deleteEms(emsId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error( - "Delete EMS from A&AI failed! EMS ID: " + emsId + "resouce-version:" + resourceVersion, - e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delEms(String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail = queryEsrEmsDetail(emsId); + String resourceVersion = esrEmsDetail.getResourceVersion(); + try { + ExternalSystemProxy.deleteEms(emsId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete EMS from A&AI failed! EMS ID: " + emsId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - private EmsRegisterInfo queryEmsDetail(String emsId) { - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); - LOG.info("Response from AAI by query EMS: " + esrEmsStr); - esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); - emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEmsDetail); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + private EmsRegisterInfo queryEmsDetail(String emsId) { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); + LOG.info("Response from AAI by query EMS: " + esrEmsStr); + esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEmsDetail); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + } + return emsRegisterInfo; } - return emsRegisterInfo; - } - - private List getEmsDetailList(EsrEmsList esrEms) { - List emsInfoList = new ArrayList<>(); - EmsRegisterInfo emsInfo = new EmsRegisterInfo(); - for (int i = 0; i < esrEms.getEsrEms().size(); i++) { - String emsId = esrEms.getEsrEms().get(i).getEmsId(); - emsInfo = queryEmsDetail(emsId); - if (emsInfo != null) { - emsInfoList.add(emsInfo); - } + + private List getEmsDetailList(EsrEmsList esrEms) { + List emsInfoList = new ArrayList<>(); + EmsRegisterInfo emsInfo = new EmsRegisterInfo(); + for (int i = 0; i < esrEms.getEsrEms().size(); i++) { + String emsId = esrEms.getEsrEms().get(i).getEmsId(); + emsInfo = queryEmsDetail(emsId); + if (emsInfo != null) { + emsInfoList.add(emsInfo); + } + } + return emsInfoList; } - return emsInfoList; - } - - private EsrEmsDetail queryEsrEmsDetail (String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - try { - String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); - LOG.info("Response from AAI by query EMS: " + esrEmsStr); - esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + + private EsrEmsDetail queryEsrEmsDetail(String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + try { + String esrEmsStr = ExternalSystemProxy.queryEmsDetail(emsId); + LOG.info("Response from AAI by query EMS: " + esrEmsStr); + esrEmsDetail = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! EMS ID: " + emsId, e); + } + return esrEmsDetail; } - return esrEmsDetail; - } - - private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) { - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - List newEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo(); - EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail(); - List oriEsrSysInfoList = new ArrayList<>(); - EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo(); - - oriEsrEmsDetail = queryEsrEmsDetail(emsId); - esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); - String emsResourceVersion = oriEsrEmsDetail.getResourceVersion(); - esrEmsDetail.setResourceVersion(emsResourceVersion); - esrEmsDetail.setEmsId(emsId); - newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); - oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); - for (int i = 0; i < oriEsrSysInfoList.size(); i++) { - originalEsrSystemInfo = oriEsrSysInfoList.get(i); - for (int j = 0; j < newEsrSysInfoList.size(); j++) { - newEsrSystemInfo = newEsrSysInfoList.get(j); - if (originalEsrSystemInfo.getSystemType().equals(newEsrSystemInfo.getSystemType())) { - esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - break; + + private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) { + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + List newEsrSysInfoList = new ArrayList<>(); + EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo(); + EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail(); + List oriEsrSysInfoList = new ArrayList<>(); + EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo(); + + oriEsrEmsDetail = queryEsrEmsDetail(emsId); + esrEmsDetail = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + String emsResourceVersion = oriEsrEmsDetail.getResourceVersion(); + esrEmsDetail.setResourceVersion(emsResourceVersion); + esrEmsDetail.setEmsId(emsId); + newEsrSysInfoList = esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + oriEsrSysInfoList = oriEsrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo(); + for (int i = 0; i < oriEsrSysInfoList.size(); i++) { + originalEsrSystemInfo = oriEsrSysInfoList.get(i); + for (int j = 0; j < newEsrSysInfoList.size(); j++) { + newEsrSystemInfo = newEsrSysInfoList.get(j); + if (originalEsrSystemInfo.getSystemType().equals(newEsrSystemInfo.getSystemType())) { + esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + esrEmsDetail.getEsrSystemInfoList().getEsrSystemInfo().get(j) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + break; + } + } } - } + return esrEmsDetail; } - return esrEmsDetail; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java index a36d0ba..0979ec0 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncList; @@ -31,133 +29,133 @@ import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; import org.onap.aai.esr.util.ThirdpartySdncManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class ThirdpartySdncWrapper { - private static ThirdpartySdncWrapper thirdpatySdncWrapper; - private static final Logger LOG = LoggerFactory.getLogger(ThirdpartySdncWrapper.class); - private static ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); + private static ThirdpartySdncWrapper thirdpatySdncWrapper; + private static final Logger LOG = LoggerFactory.getLogger(ThirdpartySdncWrapper.class); + private static ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); - /** - * get ThirdpatySdncWrapper instance. - * @return ThirdpatySdnc manager wrapper instance - */ - public static ThirdpartySdncWrapper getInstance() { - if (thirdpatySdncWrapper == null) { - thirdpatySdncWrapper = new ThirdpartySdncWrapper(); + /** + * get ThirdpatySdncWrapper instance. + * + * @return ThirdpatySdnc manager wrapper instance + */ + public static ThirdpartySdncWrapper getInstance() { + if (thirdpatySdncWrapper == null) { + thirdpatySdncWrapper = new ThirdpartySdncWrapper(); + } + return thirdpatySdncWrapper; } - return thirdpatySdncWrapper; - } - - public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); - String sdncId = esrSdncDetail.getThirdpartySdncId(); - try { - ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); - result.setId(sdncId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register thirdParty SDNC failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); + String sdncId = esrSdncDetail.getThirdpartySdncId(); + try { + ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); + result.setId(sdncId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register thirdParty SDNC failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + } - - } - public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc, String sdncId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrThirdpartySdncDetail originalEsrSdncDetail = queryEsrThirdpartySdncDetail(sdncId); - EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); - String resourceVersion = originalEsrSdncDetail.getResourceVersion(); - esrSdncDetail.setResourceVersion(resourceVersion); - esrSdncDetail.setThirdpartySdncId(sdncId); - EsrSystemInfo originalEsrSystemInfo = originalEsrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - try { - ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); - result.setId(sdncId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc, String sdncId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrThirdpartySdncDetail originalEsrSdncDetail = queryEsrThirdpartySdncDetail(sdncId); + EsrThirdpartySdncDetail esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc); + String resourceVersion = originalEsrSdncDetail.getResourceVersion(); + esrSdncDetail.setResourceVersion(resourceVersion); + esrSdncDetail.setThirdpartySdncId(sdncId); + EsrSystemInfo originalEsrSystemInfo = originalEsrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + try { + ExternalSystemProxy.registerSdnc(sdncId, esrSdncDetail); + result.setId(sdncId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryThirdpartySdncList() { - List sdncList = new ArrayList<>(); - EsrThirdpartySdncList esrSdnc = new EsrThirdpartySdncList(); - try { - String esrSdncStr = ExternalSystemProxy.querySdncList(); - esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncList.class); - LOG.info("Response from AAI by query thirdparty SDNC list: " + esrSdnc); - sdncList = getSdncDetailList(esrSdnc); - } catch (ExtsysException e) { - LOG.error("Query thirdparty SDNC list failed !", e); + + public Response queryThirdpartySdncList() { + List sdncList = new ArrayList<>(); + EsrThirdpartySdncList esrSdnc = new EsrThirdpartySdncList(); + try { + String esrSdncStr = ExternalSystemProxy.querySdncList(); + esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncList.class); + LOG.info("Response from AAI by query thirdparty SDNC list: " + esrSdnc); + sdncList = getSdncDetailList(esrSdnc); + } catch (ExtsysException e) { + LOG.error("Query thirdparty SDNC list failed !", e); + } + return Response.ok(sdncList).build(); } - return Response.ok(sdncList).build(); - } - - public Response queryThirdpartySdncById(String thirdpartySdncId) { - ThirdpartySdncRegisterInfo thirdpartySdnc = querySdncDetail(thirdpartySdncId); - return Response.ok(thirdpartySdnc).build(); - } - - public Response delThirdpartySdnc(String thirdpartySdncId) { - EsrThirdpartySdncDetail thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId); - String resourceVersion = thirdpartySdncDetail.getResourceVersion(); - try { - ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId - + "resouce-version:" + resourceVersion, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response queryThirdpartySdncById(String thirdpartySdncId) { + ThirdpartySdncRegisterInfo thirdpartySdnc = querySdncDetail(thirdpartySdncId); + return Response.ok(thirdpartySdnc).build(); } - } - - private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) { - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); - try { - String esrSdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); - LOG.info("Response from AAI by query thirdparty SDNC: " + esrSdncStr); - esrSdncDetail = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); - sdncRegisterInfo = thirdpartySdncManagerUtil.esrSdnc2SdncRegisterInfo(esrSdncDetail); - return sdncRegisterInfo; - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! thirdpaty SDNC ID: " + sdncId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delThirdpartySdnc(String thirdpartySdncId) { + EsrThirdpartySdncDetail thirdpartySdncDetail = queryEsrThirdpartySdncDetail(thirdpartySdncId); + String resourceVersion = thirdpartySdncDetail.getResourceVersion(); + try { + ExternalSystemProxy.deleteThirdpartySdnc(thirdpartySdncId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete VNFM from A&AI failed! thirdparty SDNC ID: " + thirdpartySdncId + "resouce-version:" + + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + } + + private ThirdpartySdncRegisterInfo querySdncDetail(String sdncId) { + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + try { + String esrSdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); + LOG.info("Response from AAI by query thirdparty SDNC: " + esrSdncStr); + esrSdncDetail = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); + sdncRegisterInfo = thirdpartySdncManagerUtil.esrSdnc2SdncRegisterInfo(esrSdncDetail); + return sdncRegisterInfo; + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! thirdpaty SDNC ID: " + sdncId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - private List getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) { - List sdncInfoList = new ArrayList<>(); - for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) { - String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId(); - ThirdpartySdncRegisterInfo sdncInfo = querySdncDetail(sdncId); - if (sdncInfo != null) { - sdncInfoList.add(sdncInfo); - } + + private List getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) { + List sdncInfoList = new ArrayList<>(); + for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) { + String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId(); + ThirdpartySdncRegisterInfo sdncInfo = querySdncDetail(sdncId); + if (sdncInfo != null) { + sdncInfoList.add(sdncInfo); + } + } + return sdncInfoList; } - return sdncInfoList; - } - - private EsrThirdpartySdncDetail queryEsrThirdpartySdncDetail (String sdncId) { - EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); - try { - String esrThirdpartySdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); - LOG.info("Response from AAI by query thirdparty SDNC: " + esrThirdpartySdncStr); - esrSdncDetail = new Gson().fromJson(esrThirdpartySdncStr, EsrThirdpartySdncDetail.class); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + sdncId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private EsrThirdpartySdncDetail queryEsrThirdpartySdncDetail(String sdncId) { + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + try { + String esrThirdpartySdncStr = ExternalSystemProxy.queryThirdpartySdncDetail(sdncId); + LOG.info("Response from AAI by query thirdparty SDNC: " + esrThirdpartySdncStr); + esrSdncDetail = new Gson().fromJson(esrThirdpartySdncStr, EsrThirdpartySdncDetail.class); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + sdncId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return esrSdncDetail; } - return esrSdncDetail; - } - + } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java index fa52166..e34217d 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VimManagerWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.entity.aai.CloudRegionList; import org.onap.aai.esr.entity.aai.EsrSystemInfo; @@ -34,190 +32,190 @@ import org.onap.aai.esr.util.ExtsysUtil; import org.onap.aai.esr.util.VimManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class VimManagerWrapper { - private static VimManagerWrapper vimManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(VimManagerWrapper.class); - - private static VimManagerUtil vimManagerUtil = new VimManagerUtil(); - - private static CloudRegionProxy cloudRegionProxy = new CloudRegionProxy(); - - private static ExtsysUtil extsysUtil = new ExtsysUtil(); - - /** - * get VimManagerWrapper instance. - * - * @return vim manager wrapper instance - */ - public static VimManagerWrapper getInstance() { - if (vimManagerWrapper == null) { - vimManagerWrapper = new VimManagerWrapper(); + private static VimManagerWrapper vimManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VimManagerWrapper.class); + + private static VimManagerUtil vimManagerUtil = new VimManagerUtil(); + + private static CloudRegionProxy cloudRegionProxy = new CloudRegionProxy(); + + private static ExtsysUtil extsysUtil = new ExtsysUtil(); + + /** + * get VimManagerWrapper instance. + * + * @return vim manager wrapper instance + */ + public static VimManagerWrapper getInstance() { + if (vimManagerWrapper == null) { + vimManagerWrapper = new VimManagerWrapper(); + } + return vimManagerWrapper; + } - return vimManagerWrapper; - - } - - public Response registerVim(VimRegisterInfo vimRegisterInfo) { - LOG.info( - "Start register VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - VimRegisterResponse result = new VimRegisterResponse(); - cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); - String cloudOwner = vimRegisterInfo.getCloudOwner(); - String cloudRegionId = vimRegisterInfo.getCloudRegionId(); - try { - cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegion); - result.setCloudOwner(cloudOwner); - result.setCloudRegionId(cloudRegionId); - Tenant tenant = new Tenant(); - tenant.setDefaultTenant(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getDefaultTenant()); - try { - VimManagerProxy.updateVim(cloudOwner, cloudRegionId, tenant); - } catch (ExtsysException e) { - LOG.error("Update VIM by Multi-cloud failed !", e); - } - return Response.ok(result).build(); - } catch (ExtsysException error) { - LOG.error("Register VIM failed !", error); - throw ExceptionUtil.buildExceptionResponse(error.getMessage()); + + public Response registerVim(VimRegisterInfo vimRegisterInfo) { + LOG.info("Start register VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + VimRegisterResponse result = new VimRegisterResponse(); + cloudRegion = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + String cloudOwner = vimRegisterInfo.getCloudOwner(); + String cloudRegionId = vimRegisterInfo.getCloudRegionId(); + try { + cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegion); + result.setCloudOwner(cloudOwner); + result.setCloudRegionId(cloudRegionId); + Tenant tenant = new Tenant(); + tenant.setDefaultTenant(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getDefaultTenant()); + try { + VimManagerProxy.updateVim(cloudOwner, cloudRegionId, tenant); + } catch (ExtsysException e) { + LOG.error("Update VIM by Multi-cloud failed !", e); + } + return Response.ok(result).build(); + } catch (ExtsysException error) { + LOG.error("Register VIM failed !", error); + throw ExceptionUtil.buildExceptionResponse(error.getMessage()); + } } - } - - public Response updateVim(String cloudOwner, String cloudRegionId,VimRegisterInfo vimRegisterInfo) { - LOG.info("Start update VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterResponse result = new VimRegisterResponse(); - - cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); - try { - cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail); - result.setCloudOwner(cloudOwner); - result.setCloudRegionId(cloudRegionId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VIM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response updateVim(String cloudOwner, String cloudRegionId, VimRegisterInfo vimRegisterInfo) { + LOG.info("Start update VIM, input VIM info is: " + extsysUtil.objectToString(vimRegisterInfo)); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterResponse result = new VimRegisterResponse(); + + cloudRegionDetail = getVimUpdateInfo(vimRegisterInfo); + try { + cloudRegionProxy.registerVim(cloudOwner, cloudRegionId, cloudRegionDetail); + result.setCloudOwner(cloudOwner); + result.setCloudRegionId(cloudRegionId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VIM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - public Response queryVimListDetails() { - List vimRegisterInfos = new ArrayList<>(); - CloudRegionList cloudRegionList = new CloudRegionList(); - try { - String aaiVimList = cloudRegionProxy.qureyVimList(); - cloudRegionList = new Gson().fromJson(aaiVimList, CloudRegionList.class); - vimRegisterInfos = getVimDetailList(cloudRegionList); - return Response.ok(vimRegisterInfos).build(); - } catch (ExtsysException error) { - LOG.error("Query vim list details failed !", error); - return Response.ok(vimRegisterInfos).build(); + + public Response queryVimListDetails() { + List vimRegisterInfos = new ArrayList<>(); + CloudRegionList cloudRegionList = new CloudRegionList(); + try { + String aaiVimList = cloudRegionProxy.qureyVimList(); + cloudRegionList = new Gson().fromJson(aaiVimList, CloudRegionList.class); + vimRegisterInfos = getVimDetailList(cloudRegionList); + return Response.ok(vimRegisterInfos).build(); + } catch (ExtsysException error) { + LOG.error("Query vim list details failed !", error); + return Response.ok(vimRegisterInfos).build(); + } + } - } - - public Response queryVimById(String cloudOwner, String cloudRegionId) { - VimRegisterInfo vim = new VimRegisterInfo(); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - LOG.info("Response from AAI by query VIM: " + cloudRegionstr); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - vim = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); - return Response.ok(vim).build(); - } catch (ExtsysException e) { - LOG.error("Query vim details by ID failed !", e); - return Response.ok(vim).build(); + public Response queryVimById(String cloudOwner, String cloudRegionId) { + VimRegisterInfo vim = new VimRegisterInfo(); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + LOG.info("Response from AAI by query VIM: " + cloudRegionstr); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + vim = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); + return Response.ok(vim).build(); + } catch (ExtsysException e) { + LOG.error("Query vim details by ID failed !", e); + return Response.ok(vim).build(); + } + } - } - - private List getVimDetailList(CloudRegionList cloudRegionList) { - List vimRegisterInfos = new ArrayList<>(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - int cloudRegionNum = cloudRegionList.getCloudRegion().size(); - for (int i = 0; i < cloudRegionNum; i++) { - String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner(); - String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId(); - vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); - vimRegisterInfos.add(vimRegisterInfo); + private List getVimDetailList(CloudRegionList cloudRegionList) { + List vimRegisterInfos = new ArrayList<>(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + int cloudRegionNum = cloudRegionList.getCloudRegion().size(); + for (int i = 0; i < cloudRegionNum; i++) { + String cloudOwner = cloudRegionList.getCloudRegion().get(i).getCloudOwner(); + String cloudRegionId = cloudRegionList.getCloudRegion().get(i).getCloudRegionId(); + vimRegisterInfo = getVimDetail(cloudOwner, cloudRegionId); + vimRegisterInfos.add(vimRegisterInfo); + } + return vimRegisterInfos; } - return vimRegisterInfos; - } - - private VimRegisterInfo getVimDetail(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterInfo registeredVimInfo = new VimRegisterInfo(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - registeredVimInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); - } catch (ExtsysException error) { - LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " - + cloudRegionId, error); + + private VimRegisterInfo getVimDetail(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterInfo registeredVimInfo = new VimRegisterInfo(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + registeredVimInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); + } catch (ExtsysException error) { + LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + error); + } + return registeredVimInfo; } - return registeredVimInfo; - } - - private CloudRegionDetail getOriginalCloudRegion(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); - return cloudRegionDetail; - } catch (ExtsysException error) { - LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " - + cloudRegionId, error); - return null; + + private CloudRegionDetail getOriginalCloudRegion(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionstr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + cloudRegionDetail = new Gson().fromJson(cloudRegionstr, CloudRegionDetail.class); + return cloudRegionDetail; + } catch (ExtsysException error) { + LOG.error("query VIM detail failed ! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + error); + return null; + } } - } - - private CloudRegionDetail getVimUpdateInfo(VimRegisterInfo vimRegisterInfo) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - CloudRegionDetail originalCloudRegionDetail = new CloudRegionDetail(); - EsrSystemInfo originalSystemInfo = new EsrSystemInfo(); - String cloudOwner = vimRegisterInfo.getCloudOwner(); - String cloudRegionId = vimRegisterInfo.getCloudRegionId(); - originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); - String resourceVersion = originalCloudRegionDetail.getResourceVersion(); - cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); - if(resourceVersion != null) { - cloudRegionDetail.setResourceVersion(resourceVersion); - originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId(originalSystemInfo.getEsrSystemInfoId()); - cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setResouceVersion(originalSystemInfo.getResouceVersion()); + + private CloudRegionDetail getVimUpdateInfo(VimRegisterInfo vimRegisterInfo) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + CloudRegionDetail originalCloudRegionDetail = new CloudRegionDetail(); + EsrSystemInfo originalSystemInfo = new EsrSystemInfo(); + String cloudOwner = vimRegisterInfo.getCloudOwner(); + String cloudRegionId = vimRegisterInfo.getCloudRegionId(); + originalCloudRegionDetail = getOriginalCloudRegion(cloudOwner, cloudRegionId); + String resourceVersion = originalCloudRegionDetail.getResourceVersion(); + cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + if (resourceVersion != null) { + cloudRegionDetail.setResourceVersion(resourceVersion); + originalSystemInfo = originalCloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalSystemInfo.getEsrSystemInfoId()); + cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalSystemInfo.getResouceVersion()); + } + return cloudRegionDetail; } - return cloudRegionDetail; - } - - public Response delVim(String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); - String resourceVersion = cloudRegionDetail.getResourceVersion(); - try { - cloudRegionProxy.deleteVim(cloudOwner, cloudRegionId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error("Delete cloud region from A&AI failed! cloud-owner = " + cloudOwner - + ", cloud-region-id = " + cloudRegionId + "resouce-version:" + resourceVersion, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + public Response delVim(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + cloudRegionDetail = queryCloudRegionDetail(cloudOwner, cloudRegionId); + String resourceVersion = cloudRegionDetail.getResourceVersion(); + try { + cloudRegionProxy.deleteVim(cloudOwner, cloudRegionId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete cloud region from A&AI failed! cloud-owner = " + cloudOwner + ", cloud-region-id = " + + cloudRegionId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - - private CloudRegionDetail queryCloudRegionDetail (String cloudOwner, String cloudRegionId) { - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - try { - String cloudRegionStr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); - LOG.info("Response from AAI by query cloud region: " + cloudRegionStr); - cloudRegionDetail = new Gson().fromJson(cloudRegionStr, CloudRegionDetail.class); - } catch (ExtsysException e) { - LOG.error("Query EMS detail failed! cloud-owner = " + cloudOwner - + ", cloud-region-id = " + cloudRegionId , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private CloudRegionDetail queryCloudRegionDetail(String cloudOwner, String cloudRegionId) { + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + try { + String cloudRegionStr = cloudRegionProxy.queryVimDetail(cloudOwner, cloudRegionId); + LOG.info("Response from AAI by query cloud region: " + cloudRegionStr); + cloudRegionDetail = new Gson().fromJson(cloudRegionStr, CloudRegionDetail.class); + } catch (ExtsysException e) { + LOG.error("Query EMS detail failed! cloud-owner = " + cloudOwner + ", cloud-region-id = " + cloudRegionId, + e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return cloudRegionDetail; } - return cloudRegionDetail; - } } diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java index 584a156..ee28b77 100644 --- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java +++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/VnfmManagerWrapper.java @@ -17,9 +17,7 @@ package org.onap.aai.esr.wrapper; import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.aai.EsrVnfmList; @@ -31,145 +29,142 @@ import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy; import org.onap.aai.esr.util.VnfmManagerUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import com.google.gson.Gson; public class VnfmManagerWrapper { - private static VnfmManagerWrapper vnfmManagerWrapper; - private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); + private static VnfmManagerWrapper vnfmManagerWrapper; + private static final Logger LOG = LoggerFactory.getLogger(VnfmManagerWrapper.class); - private static VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); - - /** - * get VnfmManagerWrapper instance. - * - * @return vnfm manager wrapper instance - */ - public static VnfmManagerWrapper getInstance() { - if (vnfmManagerWrapper == null) { - vnfmManagerWrapper = new VnfmManagerWrapper(); + private static VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); + + /** + * get VnfmManagerWrapper instance. + * + * @return vnfm manager wrapper instance + */ + public static VnfmManagerWrapper getInstance() { + if (vnfmManagerWrapper == null) { + vnfmManagerWrapper = new VnfmManagerWrapper(); + } + return vnfmManagerWrapper; } - return vnfmManagerWrapper; - } - public Response registerVnfm(VnfmRegisterInfo vnfm) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); - String vnfmId = esrVnfmDetail.getVnfmId(); - try { - ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); - result.setId(vnfmId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Register VNFM failed !" , e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response registerVnfm(VnfmRegisterInfo vnfm) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); + String vnfmId = esrVnfmDetail.getVnfmId(); + try { + ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); + result.setId(vnfmId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Register VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response updateVnfm(VnfmRegisterInfo vnfm, String vnfmId) { - CommonRegisterResponse result = new CommonRegisterResponse(); - EsrVnfmDetail originalEsrVnfmDetail = queryEsrVnfmDetail(vnfmId); - EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); - String resourceVersion = getResourceVersion(vnfmId); - esrVnfmDetail.setResourceVersion(resourceVersion); - esrVnfmDetail.setVnfmId(vnfmId); - EsrSystemInfo originalEsrSystemInfo = originalEsrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); - esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); - esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) - .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); - try { - ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); - result.setId(vnfmId); - return Response.ok(result).build(); - } catch (ExtsysException e) { - LOG.error("Update VNFM failed !", e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response updateVnfm(VnfmRegisterInfo vnfm, String vnfmId) { + CommonRegisterResponse result = new CommonRegisterResponse(); + EsrVnfmDetail originalEsrVnfmDetail = queryEsrVnfmDetail(vnfmId); + EsrVnfmDetail esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfm); + String resourceVersion = getResourceVersion(vnfmId); + esrVnfmDetail.setResourceVersion(resourceVersion); + esrVnfmDetail.setVnfmId(vnfmId); + EsrSystemInfo originalEsrSystemInfo = originalEsrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0); + esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setEsrSystemInfoId(originalEsrSystemInfo.getEsrSystemInfoId()); + esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0) + .setResouceVersion(originalEsrSystemInfo.getResouceVersion()); + try { + ExternalSystemProxy.registerVnfm(vnfmId, esrVnfmDetail); + result.setId(vnfmId); + return Response.ok(result).build(); + } catch (ExtsysException e) { + LOG.error("Update VNFM failed !", e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - public Response queryVnfmList() { - List vnfmList = new ArrayList<>(); - EsrVnfmList esrVnfm = new EsrVnfmList(); - try { - String esrVnfmStr = ExternalSystemProxy.queryVnfmList(); - esrVnfm = new Gson().fromJson(esrVnfmStr, EsrVnfmList.class); - LOG.info("Response from AAI by query VNFM list: " + esrVnfm); - vnfmList = getVnfmDetailList(esrVnfm); - return Response.ok(vnfmList).build(); - } catch (ExtsysException e) { - LOG.error("Query VNFM list failed !", e); - return Response.ok(vnfmList).build(); + public Response queryVnfmList() { + List vnfmList = new ArrayList<>(); + EsrVnfmList esrVnfm = new EsrVnfmList(); + try { + String esrVnfmStr = ExternalSystemProxy.queryVnfmList(); + esrVnfm = new Gson().fromJson(esrVnfmStr, EsrVnfmList.class); + LOG.info("Response from AAI by query VNFM list: " + esrVnfm); + vnfmList = getVnfmDetailList(esrVnfm); + return Response.ok(vnfmList).build(); + } catch (ExtsysException e) { + LOG.error("Query VNFM list failed !", e); + return Response.ok(vnfmList).build(); + } } - } - public Response queryVnfmById(String vnfmId) { - VnfmRegisterInfo vnfm = queryVnfmDetail(vnfmId); - if (vnfm != null) { - return Response.ok(vnfm).build(); - } else { - return Response.ok(vnfm).build(); + public Response queryVnfmById(String vnfmId) { + VnfmRegisterInfo vnfm = queryVnfmDetail(vnfmId); + if (vnfm != null) { + return Response.ok(vnfm).build(); + } else { + return Response.ok(vnfm).build(); + } } - } - public Response delVnfm(String vnfmId) { - String resourceVersion = getResourceVersion(vnfmId); - try { - ExternalSystemProxy.deleteVnfm(vnfmId, resourceVersion); - return Response.noContent().build(); - } catch (ExtsysException e) { - LOG.error( - "Delete VNFM from A&AI failed! VNFM ID: " + vnfmId + "resouce-version:" + resourceVersion, - e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + public Response delVnfm(String vnfmId) { + String resourceVersion = getResourceVersion(vnfmId); + try { + ExternalSystemProxy.deleteVnfm(vnfmId, resourceVersion); + return Response.noContent().build(); + } catch (ExtsysException e) { + LOG.error("Delete VNFM from A&AI failed! VNFM ID: " + vnfmId + "resouce-version:" + resourceVersion, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } } - } - private VnfmRegisterInfo queryVnfmDetail(String vnfmId) { - VnfmRegisterInfo vnfm = new VnfmRegisterInfo(); - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - try { - String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); - LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); - esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); - vnfm = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + private VnfmRegisterInfo queryVnfmDetail(String vnfmId) { + VnfmRegisterInfo vnfm = new VnfmRegisterInfo(); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + try { + String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); + LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); + esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); + vnfm = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + } + return vnfm; } - return vnfm; - } - private List getVnfmDetailList(EsrVnfmList esrVnfm) { - List vnfmInfoList = new ArrayList<>(); - for (int i = 0; i < esrVnfm.getEsrVnfm().size(); i++) { - String vnfmId = esrVnfm.getEsrVnfm().get(i).getVnfmId(); - VnfmRegisterInfo vnfmInfo = queryVnfmDetail(vnfmId); - if (vnfmInfo != null) { - vnfmInfoList.add(vnfmInfo); - } + private List getVnfmDetailList(EsrVnfmList esrVnfm) { + List vnfmInfoList = new ArrayList<>(); + for (int i = 0; i < esrVnfm.getEsrVnfm().size(); i++) { + String vnfmId = esrVnfm.getEsrVnfm().get(i).getVnfmId(); + VnfmRegisterInfo vnfmInfo = queryVnfmDetail(vnfmId); + if (vnfmInfo != null) { + vnfmInfoList.add(vnfmInfo); + } + } + return vnfmInfoList; } - return vnfmInfoList; - } - - private String getResourceVersion (String vnfmId) { - String resourceVersion = null; - EsrVnfmDetail esrVnfmDetail = queryEsrVnfmDetail(vnfmId); - if (esrVnfmDetail != null && esrVnfmDetail.getResourceVersion() != null) { - resourceVersion = esrVnfmDetail.getResourceVersion(); + + private String getResourceVersion(String vnfmId) { + String resourceVersion = null; + EsrVnfmDetail esrVnfmDetail = queryEsrVnfmDetail(vnfmId); + if (esrVnfmDetail != null && esrVnfmDetail.getResourceVersion() != null) { + resourceVersion = esrVnfmDetail.getResourceVersion(); + } + return resourceVersion; } - return resourceVersion; - } - - private EsrVnfmDetail queryEsrVnfmDetail (String vnfmId) { - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - try { - String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); - LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); - esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); - } catch (ExtsysException e) { - LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); - throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + + private EsrVnfmDetail queryEsrVnfmDetail(String vnfmId) { + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + try { + String esrVnfmstr = ExternalSystemProxy.queryVnfmDetail(vnfmId); + LOG.info("Response from AAI by query VNFM: " + esrVnfmstr); + esrVnfmDetail = new Gson().fromJson(esrVnfmstr, EsrVnfmDetail.class); + } catch (ExtsysException e) { + LOG.error("Query VNFM detail failed! VNFM ID: " + vnfmId, e); + throw ExceptionUtil.buildExceptionResponse(e.getMessage()); + } + return esrVnfmDetail; } - return esrVnfmDetail; - } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java index 95f7fe4..15a4e41 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java @@ -16,64 +16,63 @@ package org.onap.aai.esr; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class ExtsysAppConfigurationTest { - - @Test - public void getterAndSetter4template(){ - final String template = "Hello ESR"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setTemplate(template); - assertEquals(appConfiguration.getTemplate(), template); - } - - @Test - public void getterAndSetter4defaultName(){ - final String defaultName = "ONAP-A&AI-ESR"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setDefaultName(defaultName); - assertEquals(appConfiguration.getDefaultName(), defaultName); - } - - @Test - public void getterAndSetter4msbDiscoveryIp(){ - final String msbDiscoveryIp = "127.0.0.1"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setMsbDiscoveryIp(msbDiscoveryIp); - assertEquals(appConfiguration.getMsbDiscoveryIp(), msbDiscoveryIp); - } - - @Test - public void getterAndSetter4msbDiscoveryPort(){ - final String msbDiscoveryPort = "10081"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setMsbDiscoveryPort(msbDiscoveryPort); - assertEquals(appConfiguration.getMsbDiscoveryPort(), msbDiscoveryPort); - } - - @Test - public void getterAndSetter4registByHand(){ - final String registByHand = "true"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setRegistByHand(registByHand); - assertEquals(appConfiguration.getRegistByHand(), registByHand); - } - - @Test - public void getterAndSetter4msbServerAddr(){ - final String msbServerAddr = "http://127.0.0.1:80"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setMsbServerAddr(msbServerAddr); - assertEquals(appConfiguration.getMsbServerAddr(), msbServerAddr); - } - - @Test - public void getterAndSetter4serviceIp(){ - final String serviceIp = "true"; - ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); - appConfiguration.setServiceIp(serviceIp); - assertEquals(appConfiguration.getServiceIp(), serviceIp); - } + + @Test + public void getterAndSetter4template() { + final String template = "Hello ESR"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setTemplate(template); + assertEquals(appConfiguration.getTemplate(), template); + } + + @Test + public void getterAndSetter4defaultName() { + final String defaultName = "ONAP-A&AI-ESR"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setDefaultName(defaultName); + assertEquals(appConfiguration.getDefaultName(), defaultName); + } + + @Test + public void getterAndSetter4msbDiscoveryIp() { + final String msbDiscoveryIp = "127.0.0.1"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setMsbDiscoveryIp(msbDiscoveryIp); + assertEquals(appConfiguration.getMsbDiscoveryIp(), msbDiscoveryIp); + } + + @Test + public void getterAndSetter4msbDiscoveryPort() { + final String msbDiscoveryPort = "10081"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setMsbDiscoveryPort(msbDiscoveryPort); + assertEquals(appConfiguration.getMsbDiscoveryPort(), msbDiscoveryPort); + } + + @Test + public void getterAndSetter4registByHand() { + final String registByHand = "true"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setRegistByHand(registByHand); + assertEquals(appConfiguration.getRegistByHand(), registByHand); + } + + @Test + public void getterAndSetter4msbServerAddr() { + final String msbServerAddr = "http://127.0.0.1:80"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setMsbServerAddr(msbServerAddr); + assertEquals(appConfiguration.getMsbServerAddr(), msbServerAddr); + } + + @Test + public void getterAndSetter4serviceIp() { + final String serviceIp = "true"; + ExtsysAppConfiguration appConfiguration = new ExtsysAppConfiguration(); + appConfiguration.setServiceIp(serviceIp); + assertEquals(appConfiguration.getServiceIp(), serviceIp); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppTest.java index 7f7adb0..ef33f05 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppTest.java @@ -16,19 +16,18 @@ package org.onap.aai.esr; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.aai.esr.common.Config; public class ExtsysAppTest { - static { - ExtsysAppConfiguration configuration = new ExtsysAppConfiguration(); - Config.setConfigration(configuration); - } - - @Test - public void getName() throws Exception { - ExtsysApp app = new ExtsysApp(); - assertEquals(app.getName(),"ONAP-ESR"); - } + static { + ExtsysAppConfiguration configuration = new ExtsysAppConfiguration(); + Config.setConfigration(configuration); + } + + @Test + public void getName() throws Exception { + ExtsysApp app = new ExtsysApp(); + assertEquals(app.getName(), "ONAP-ESR"); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java index 5203ee4..b1b7b33 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/common/MsbConfigTest.java @@ -22,7 +22,7 @@ import org.onap.aai.esr.ExtsysAppConfiguration; public class MsbConfigTest { @Test - public void testAllMethods(){ + public void testAllMethods() { MsbConfig.setMsbServerAddr("msb-server"); Assert.assertEquals(MsbConfig.getMsbServerAddr(), "msb-server"); @@ -46,7 +46,7 @@ public class MsbConfigTest { } @Test - public void testConfigClass(){ + public void testConfigClass() { ExtsysAppConfiguration configur = new ExtsysAppConfiguration(); Config.setConfigration(configur); Assert.assertEquals(Config.getConfigration(), configur); diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionDetailTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionDetailTest.java index ac9de8a..82f86e2 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionDetailTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionDetailTest.java @@ -16,87 +16,85 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class CloudRegionDetailTest { - @Test - public void getterAndSetter4CloudOwner(){ - final String cloudOwner = "cloud-owner-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudOwner(cloudOwner); - assertEquals(cloudRegion.getCloudOwner(), cloudOwner); - } - - @Test - public void getterAndSetter4CloudRegionId(){ - final String cloudRegionId = "cloud-region-id-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudRegionId(cloudRegionId); - assertEquals(cloudRegion.getCloudRegionId(), cloudRegionId); - } - - @Test - public void getterAndSetter4CloudType(){ - final String cloudType = "cloud-type-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudType(cloudType); - assertEquals(cloudRegion.getCloudType(), cloudType); - } - - @Test - public void getterAndSetter4cloudRegionVersion(){ - final String cloudRegionVersion = "cloud-region-version-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudRegionVersion(cloudRegionVersion); - assertEquals(cloudRegion.getCloudRegionVersion(), cloudRegionVersion); - } - - @Test - public void getterAndSetter4ownerDefinedType(){ - final String ownerDefinedType = "owner-defined-type-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setOwnerDefinedType(ownerDefinedType); - assertEquals(cloudRegion.getOwnerDefinedType(), ownerDefinedType); - } - - @Test - public void getterAndSetter4cloudZone(){ - final String cloudZone = "cloudZone-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudZone(cloudZone); - assertEquals(cloudRegion.getCloudZone(), cloudZone); - } - - @Test - public void getterAndSetter4complexName(){ - final String complexName = "complexName-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setComplexName(complexName); - assertEquals(cloudRegion.getComplexName(), complexName); - } - - @Test - public void getterAndSetter4cloudExtraInfo(){ - final String cloudExtraInfo = "cloudExtraInfo-test"; - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setCloudExtraInfo(cloudExtraInfo); - assertEquals(cloudRegion.getCloudExtraInfo(), cloudExtraInfo); - } - - @Test - public void getterAndSetter4esrSystemInfoList(){ - final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - esrSystemInfoObj.setEsrSystemInfoId("123"); - esrSystemInfo.add(esrSystemInfoObj ); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - CloudRegionDetail cloudRegion = new CloudRegionDetail(); - cloudRegion.setEsrSystemInfoList(esrSystemInfoList); - assertEquals(cloudRegion.getEsrSystemInfoList(), esrSystemInfoList); - } + @Test + public void getterAndSetter4CloudOwner() { + final String cloudOwner = "cloud-owner-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudOwner(cloudOwner); + assertEquals(cloudRegion.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4CloudRegionId() { + final String cloudRegionId = "cloud-region-id-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudRegionId(cloudRegionId); + assertEquals(cloudRegion.getCloudRegionId(), cloudRegionId); + } + + @Test + public void getterAndSetter4CloudType() { + final String cloudType = "cloud-type-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudType(cloudType); + assertEquals(cloudRegion.getCloudType(), cloudType); + } + + @Test + public void getterAndSetter4cloudRegionVersion() { + final String cloudRegionVersion = "cloud-region-version-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudRegionVersion(cloudRegionVersion); + assertEquals(cloudRegion.getCloudRegionVersion(), cloudRegionVersion); + } + + @Test + public void getterAndSetter4ownerDefinedType() { + final String ownerDefinedType = "owner-defined-type-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setOwnerDefinedType(ownerDefinedType); + assertEquals(cloudRegion.getOwnerDefinedType(), ownerDefinedType); + } + + @Test + public void getterAndSetter4cloudZone() { + final String cloudZone = "cloudZone-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudZone(cloudZone); + assertEquals(cloudRegion.getCloudZone(), cloudZone); + } + + @Test + public void getterAndSetter4complexName() { + final String complexName = "complexName-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setComplexName(complexName); + assertEquals(cloudRegion.getComplexName(), complexName); + } + + @Test + public void getterAndSetter4cloudExtraInfo() { + final String cloudExtraInfo = "cloudExtraInfo-test"; + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setCloudExtraInfo(cloudExtraInfo); + assertEquals(cloudRegion.getCloudExtraInfo(), cloudExtraInfo); + } + + @Test + public void getterAndSetter4esrSystemInfoList() { + final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + esrSystemInfoObj.setEsrSystemInfoId("123"); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + CloudRegionDetail cloudRegion = new CloudRegionDetail(); + cloudRegion.setEsrSystemInfoList(esrSystemInfoList); + assertEquals(cloudRegion.getEsrSystemInfoList(), esrSystemInfoList); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionListTest.java index 4a3a432..3eb0004 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionListTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionListTest.java @@ -16,23 +16,21 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class CloudRegionListTest { - - @Test - public void getterAndSetter4cloudRegion() { - CloudRegionList cloudRegionList = new CloudRegionList(); - List cloudRegions = new ArrayList<>(); - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudOwner("owner"); - cloudRegion.setCloudRegionId("regionId"); - cloudRegions.add(cloudRegion); - cloudRegionList.setCloudRegion(cloudRegions); - assertEquals(cloudRegionList.getCloudRegion(), cloudRegions); - } + + @Test + public void getterAndSetter4cloudRegion() { + CloudRegionList cloudRegionList = new CloudRegionList(); + List cloudRegions = new ArrayList<>(); + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudOwner("owner"); + cloudRegion.setCloudRegionId("regionId"); + cloudRegions.add(cloudRegion); + cloudRegionList.setCloudRegion(cloudRegions); + assertEquals(cloudRegionList.getCloudRegion(), cloudRegions); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionTest.java index 90af6bc..e731571 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/CloudRegionTest.java @@ -16,72 +16,71 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class CloudRegionTest { - @Test - public void getterAndSetter4CloudOwner(){ - final String cloudOwner = "cloud-owner-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudOwner(cloudOwner); - assertEquals(cloudRegion.getCloudOwner(), cloudOwner); - } - - @Test - public void getterAndSetter4CloudRegionId(){ - final String cloudRegionId = "cloud-region-id-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudRegionId(cloudRegionId); - assertEquals(cloudRegion.getCloudRegionId(), cloudRegionId); - } - - @Test - public void getterAndSetter4CloudType(){ - final String cloudType = "cloud-type-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudType(cloudType); - assertEquals(cloudRegion.getCloudType(), cloudType); - } - - @Test - public void getterAndSetter4cloudRegionVersion(){ - final String cloudRegionVersion = "cloud-region-version-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudRegionVersion(cloudRegionVersion); - assertEquals(cloudRegion.getCloudRegionVersion(), cloudRegionVersion); - } - - @Test - public void getterAndSetter4ownerDefinedType(){ - final String ownerDefinedType = "owner-defined-type-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setOwnerDefinedType(ownerDefinedType); - assertEquals(cloudRegion.getOwnerDefinedType(), ownerDefinedType); - } - - @Test - public void getterAndSetter4cloudZone(){ - final String cloudZone = "cloudZone-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudZone(cloudZone); - assertEquals(cloudRegion.getCloudZone(), cloudZone); - } - - @Test - public void getterAndSetter4complexName(){ - final String complexName = "complexName-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setComplexName(complexName); - assertEquals(cloudRegion.getComplexName(), complexName); - } - - @Test - public void getterAndSetter4cloudExtraInfo(){ - final String cloudExtraInfo = "cloudExtraInfo-test"; - CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudExtraInfo(cloudExtraInfo); - assertEquals(cloudRegion.getCloudExtraInfo(), cloudExtraInfo); - } + @Test + public void getterAndSetter4CloudOwner() { + final String cloudOwner = "cloud-owner-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudOwner(cloudOwner); + assertEquals(cloudRegion.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4CloudRegionId() { + final String cloudRegionId = "cloud-region-id-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudRegionId(cloudRegionId); + assertEquals(cloudRegion.getCloudRegionId(), cloudRegionId); + } + + @Test + public void getterAndSetter4CloudType() { + final String cloudType = "cloud-type-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudType(cloudType); + assertEquals(cloudRegion.getCloudType(), cloudType); + } + + @Test + public void getterAndSetter4cloudRegionVersion() { + final String cloudRegionVersion = "cloud-region-version-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudRegionVersion(cloudRegionVersion); + assertEquals(cloudRegion.getCloudRegionVersion(), cloudRegionVersion); + } + + @Test + public void getterAndSetter4ownerDefinedType() { + final String ownerDefinedType = "owner-defined-type-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setOwnerDefinedType(ownerDefinedType); + assertEquals(cloudRegion.getOwnerDefinedType(), ownerDefinedType); + } + + @Test + public void getterAndSetter4cloudZone() { + final String cloudZone = "cloudZone-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudZone(cloudZone); + assertEquals(cloudRegion.getCloudZone(), cloudZone); + } + + @Test + public void getterAndSetter4complexName() { + final String complexName = "complexName-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setComplexName(complexName); + assertEquals(cloudRegion.getComplexName(), complexName); + } + + @Test + public void getterAndSetter4cloudExtraInfo() { + final String cloudExtraInfo = "cloudExtraInfo-test"; + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setCloudExtraInfo(cloudExtraInfo); + assertEquals(cloudRegion.getCloudExtraInfo(), cloudExtraInfo); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsDetailTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsDetailTest.java index 7cdbde3..f0af852 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsDetailTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsDetailTest.java @@ -16,40 +16,38 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrEmsDetailTest { - @Test - public void getterAndSetter4emsId(){ - final String emsId = "emsId-test"; - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail.setEmsId(emsId); - assertEquals(esrEmsDetail.getEmsId(), emsId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail.setResourceVersion(resourceVersion); - assertEquals(esrEmsDetail.getResourceVersion(), resourceVersion); - } - - @Test - public void getterAndSetter4esrSystemInfoList(){ - final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - esrSystemInfoObj.setEsrSystemInfoId("123"); - esrSystemInfo.add(esrSystemInfoObj ); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); - esrEmsDetail.setEsrSystemInfoList(esrSystemInfoList); - assertEquals(esrEmsDetail.getEsrSystemInfoList(), esrSystemInfoList); - } + @Test + public void getterAndSetter4emsId() { + final String emsId = "emsId-test"; + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail.setEmsId(emsId); + assertEquals(esrEmsDetail.getEmsId(), emsId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail.setResourceVersion(resourceVersion); + assertEquals(esrEmsDetail.getResourceVersion(), resourceVersion); + } + + @Test + public void getterAndSetter4esrSystemInfoList() { + final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + esrSystemInfoObj.setEsrSystemInfoId("123"); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + EsrEmsDetail esrEmsDetail = new EsrEmsDetail(); + esrEmsDetail.setEsrSystemInfoList(esrSystemInfoList); + assertEquals(esrEmsDetail.getEsrSystemInfoList(), esrSystemInfoList); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsListTest.java index 333a900..abf5954 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsListTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsListTest.java @@ -16,21 +16,19 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrEmsListTest { - @Test - public void getterAndSetter4EsrEmsList() { - EsrEmsList esrEmsList = new EsrEmsList(); - List esrEmses = new ArrayList<>(); - EsrEms esrEms = new EsrEms(); - esrEms.setEmsId("123"); - esrEmses.add(esrEms); - esrEmsList.setEsrEms(esrEmses); - assertEquals(esrEmsList.getEsrEms(), esrEmses); - } + @Test + public void getterAndSetter4EsrEmsList() { + EsrEmsList esrEmsList = new EsrEmsList(); + List esrEmses = new ArrayList<>(); + EsrEms esrEms = new EsrEms(); + esrEms.setEmsId("123"); + esrEmses.add(esrEms); + esrEmsList.setEsrEms(esrEmses); + assertEquals(esrEmsList.getEsrEms(), esrEmses); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsTest.java index 9776b2e..e2e1100 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrEmsTest.java @@ -16,23 +16,22 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class EsrEmsTest { - @Test - public void getterAndSetter4emsId(){ - final String emsId = "emsId-test"; - EsrEms esrEms = new EsrEms(); - esrEms.setEmsId(emsId); - assertEquals(esrEms.getEmsId(), emsId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrEms esrEms = new EsrEms(); - esrEms.setResourceVersion(resourceVersion); - assertEquals(esrEms.getResourceVersion(), resourceVersion); - } + @Test + public void getterAndSetter4emsId() { + final String emsId = "emsId-test"; + EsrEms esrEms = new EsrEms(); + esrEms.setEmsId(emsId); + assertEquals(esrEms.getEmsId(), emsId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrEms esrEms = new EsrEms(); + esrEms.setResourceVersion(resourceVersion); + assertEquals(esrEms.getResourceVersion(), resourceVersion); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoListTest.java index 6beb4b4..d23ee7b 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoListTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoListTest.java @@ -16,21 +16,19 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrSystemInfoListTest { - @Test - public void getterAndSetter4cloudRegion() { - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfos = new ArrayList<>(); - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setEsrSystemInfoId("123"); - esrSystemInfos.add(esrSystemInfo); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfos); - assertEquals(esrSystemInfoList.getEsrSystemInfo(), esrSystemInfos); - } + @Test + public void getterAndSetter4cloudRegion() { + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfos = new ArrayList<>(); + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setEsrSystemInfoId("123"); + esrSystemInfos.add(esrSystemInfo); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfos); + assertEquals(esrSystemInfoList.getEsrSystemInfo(), esrSystemInfos); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoTest.java index bca4ce6..3c90d36 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrSystemInfoTest.java @@ -16,168 +16,167 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class EsrSystemInfoTest { - - @Test - public void getterAndSetter4esrSystemInfoId(){ - final String esrSystemInfoId = "esrSystemInfoId-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setEsrSystemInfoId(esrSystemInfoId); - assertEquals(esrSystemInfo.getEsrSystemInfoId(), esrSystemInfoId); - } - - @Test - public void getterAndSetter4systemName(){ - final String systemName = "systemName-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setSystemName(systemName); - assertEquals(esrSystemInfo.getSystemName(), systemName); - } - - @Test - public void getterAndSetter4type(){ - final String type = "type-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setType(type); - assertEquals(esrSystemInfo.getType(), type); - } - - @Test - public void getterAndSetter4vendor(){ - final String vendor = "vendor-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setVendor(vendor); - assertEquals(esrSystemInfo.getVendor(), vendor); - } - - @Test - public void getterAndSetter4version(){ - final String version = "version-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setVersion(version); - assertEquals(esrSystemInfo.getVersion(), version); - } - - @Test - public void getterAndSetter4serviceUrl(){ - final String serviceUrl = "serviceUrl-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setServiceUrl(serviceUrl); - assertEquals(esrSystemInfo.getServiceUrl(), serviceUrl); - } - - @Test - public void getterAndSetter4userName(){ - final String userName = "userName-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setUserName(userName); - assertEquals(esrSystemInfo.getUserName(), userName); - } - - @Test - public void getterAndSetter4password(){ - final String password = "password-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setPassword(password); - assertEquals(esrSystemInfo.getPassword(), password); - } - - @Test - public void getterAndSetter4systemType(){ - final String systemType = "systemType-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setSystemType(systemType); - assertEquals(esrSystemInfo.getSystemType(), systemType); - } - - @Test - public void getterAndSetter4protocol(){ - final String protocol = "protocol-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setProtocol(protocol); - assertEquals(esrSystemInfo.getProtocol(), protocol); - } - - @Test - public void getterAndSetter4sslCassert(){ - final String sslCassert = "sslCassert-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setSslCassert(sslCassert); - assertEquals(esrSystemInfo.getSslCassert(), sslCassert); - } - - @Test - public void getterAndSetter4sslInsecure(){ - final Boolean sslInsecure = true; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setSslInsecure(sslInsecure); - assertEquals(esrSystemInfo.getSslInsecure(), sslInsecure); - } - - @Test - public void getterAndSetter4ipAddress(){ - final String ipAddress = "ipAddress-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setIpAddress(ipAddress); - assertEquals(esrSystemInfo.getIpAddress(), ipAddress); - } - - @Test - public void getterAndSetter4port(){ - final String port = "port-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setIpAddress(port); - assertEquals(esrSystemInfo.getIpAddress(), port); - } - - @Test - public void getterAndSetter4cloudDomain(){ - final String cloudDomain = "cloudDomain-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setCloudDomain(cloudDomain); - assertEquals(esrSystemInfo.getCloudDomain(), cloudDomain); - } - - @Test - public void getterAndSetter4defaultTenant(){ - final String defaultTenant = "defaultTenant-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setDefaultTenant(defaultTenant); - assertEquals(esrSystemInfo.getDefaultTenant(), defaultTenant); - } - - @Test - public void getterAndSetter4passive(){ - final Boolean passive = true; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setPassive(passive); - assertEquals(esrSystemInfo.getPassive(), passive); - } - - @Test - public void getterAndSetter4remotePath(){ - final String remotePath = "remotePath-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setRemotePath(remotePath); - assertEquals(esrSystemInfo.getRemotePath(), remotePath); - } - - @Test - public void getterAndSetter4systemStatus(){ - final String systemStatus = "defaultTenant-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setSystemStatus(systemStatus); - assertEquals(esrSystemInfo.getSystemStatus(), systemStatus); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); - esrSystemInfo.setResouceVersion(resourceVersion); - assertEquals(esrSystemInfo.getResouceVersion(), resourceVersion); - } + + @Test + public void getterAndSetter4esrSystemInfoId() { + final String esrSystemInfoId = "esrSystemInfoId-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setEsrSystemInfoId(esrSystemInfoId); + assertEquals(esrSystemInfo.getEsrSystemInfoId(), esrSystemInfoId); + } + + @Test + public void getterAndSetter4systemName() { + final String systemName = "systemName-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setSystemName(systemName); + assertEquals(esrSystemInfo.getSystemName(), systemName); + } + + @Test + public void getterAndSetter4type() { + final String type = "type-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setType(type); + assertEquals(esrSystemInfo.getType(), type); + } + + @Test + public void getterAndSetter4vendor() { + final String vendor = "vendor-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setVendor(vendor); + assertEquals(esrSystemInfo.getVendor(), vendor); + } + + @Test + public void getterAndSetter4version() { + final String version = "version-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setVersion(version); + assertEquals(esrSystemInfo.getVersion(), version); + } + + @Test + public void getterAndSetter4serviceUrl() { + final String serviceUrl = "serviceUrl-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setServiceUrl(serviceUrl); + assertEquals(esrSystemInfo.getServiceUrl(), serviceUrl); + } + + @Test + public void getterAndSetter4userName() { + final String userName = "userName-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setUserName(userName); + assertEquals(esrSystemInfo.getUserName(), userName); + } + + @Test + public void getterAndSetter4password() { + final String password = "password-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setPassword(password); + assertEquals(esrSystemInfo.getPassword(), password); + } + + @Test + public void getterAndSetter4systemType() { + final String systemType = "systemType-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setSystemType(systemType); + assertEquals(esrSystemInfo.getSystemType(), systemType); + } + + @Test + public void getterAndSetter4protocol() { + final String protocol = "protocol-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setProtocol(protocol); + assertEquals(esrSystemInfo.getProtocol(), protocol); + } + + @Test + public void getterAndSetter4sslCassert() { + final String sslCassert = "sslCassert-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setSslCassert(sslCassert); + assertEquals(esrSystemInfo.getSslCassert(), sslCassert); + } + + @Test + public void getterAndSetter4sslInsecure() { + final Boolean sslInsecure = true; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setSslInsecure(sslInsecure); + assertEquals(esrSystemInfo.getSslInsecure(), sslInsecure); + } + + @Test + public void getterAndSetter4ipAddress() { + final String ipAddress = "ipAddress-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setIpAddress(ipAddress); + assertEquals(esrSystemInfo.getIpAddress(), ipAddress); + } + + @Test + public void getterAndSetter4port() { + final String port = "port-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setIpAddress(port); + assertEquals(esrSystemInfo.getIpAddress(), port); + } + + @Test + public void getterAndSetter4cloudDomain() { + final String cloudDomain = "cloudDomain-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setCloudDomain(cloudDomain); + assertEquals(esrSystemInfo.getCloudDomain(), cloudDomain); + } + + @Test + public void getterAndSetter4defaultTenant() { + final String defaultTenant = "defaultTenant-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setDefaultTenant(defaultTenant); + assertEquals(esrSystemInfo.getDefaultTenant(), defaultTenant); + } + + @Test + public void getterAndSetter4passive() { + final Boolean passive = true; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setPassive(passive); + assertEquals(esrSystemInfo.getPassive(), passive); + } + + @Test + public void getterAndSetter4remotePath() { + final String remotePath = "remotePath-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setRemotePath(remotePath); + assertEquals(esrSystemInfo.getRemotePath(), remotePath); + } + + @Test + public void getterAndSetter4systemStatus() { + final String systemStatus = "defaultTenant-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setSystemStatus(systemStatus); + assertEquals(esrSystemInfo.getSystemStatus(), systemStatus); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrSystemInfo esrSystemInfo = new EsrSystemInfo(); + esrSystemInfo.setResouceVersion(resourceVersion); + assertEquals(esrSystemInfo.getResouceVersion(), resourceVersion); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetailTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetailTest.java index 7985d55..61fb5e7 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetailTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncDetailTest.java @@ -16,55 +16,53 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrThirdpartySdncDetailTest { - @Test - public void getterAndSetter4thirdpartySdncId(){ - final String thirdpartySdncId = "thirdpartySdncId-test"; - EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); - esrThirdpartySdncDetail.setThirdpartySdncId(thirdpartySdncId); - assertEquals(esrThirdpartySdncDetail.getThirdpartySdncId(), thirdpartySdncId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); - esrThirdpartySdncDetail.setResourceVersion(resourceVersion); - assertEquals(esrThirdpartySdncDetail.getResourceVersion(), resourceVersion); - } - - @Test - public void getterAndSetter4location(){ - final String location = "location-test"; - EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); - esrThirdpartySdncDetail.setLocation(location); - assertEquals(esrThirdpartySdncDetail.getLocation(), location); - } - - @Test - public void getterAndSetter4productName(){ - final String productName = "productName-test"; - EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); - esrThirdpartySdncDetail.setProductName(productName); - assertEquals(esrThirdpartySdncDetail.getProductName(), productName); - } - - @Test - public void getterAndSetter4esrSystemInfoList(){ - final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - esrSystemInfoObj.setEsrSystemInfoId("123"); - esrSystemInfo.add(esrSystemInfoObj ); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); - esrThirdpartySdncDetail.setEsrSystemInfoList(esrSystemInfoList); - assertEquals(esrThirdpartySdncDetail.getEsrSystemInfoList(), esrSystemInfoList); - } + @Test + public void getterAndSetter4thirdpartySdncId() { + final String thirdpartySdncId = "thirdpartySdncId-test"; + EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); + esrThirdpartySdncDetail.setThirdpartySdncId(thirdpartySdncId); + assertEquals(esrThirdpartySdncDetail.getThirdpartySdncId(), thirdpartySdncId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); + esrThirdpartySdncDetail.setResourceVersion(resourceVersion); + assertEquals(esrThirdpartySdncDetail.getResourceVersion(), resourceVersion); + } + + @Test + public void getterAndSetter4location() { + final String location = "location-test"; + EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); + esrThirdpartySdncDetail.setLocation(location); + assertEquals(esrThirdpartySdncDetail.getLocation(), location); + } + + @Test + public void getterAndSetter4productName() { + final String productName = "productName-test"; + EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); + esrThirdpartySdncDetail.setProductName(productName); + assertEquals(esrThirdpartySdncDetail.getProductName(), productName); + } + + @Test + public void getterAndSetter4esrSystemInfoList() { + final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + esrSystemInfoObj.setEsrSystemInfoId("123"); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + EsrThirdpartySdncDetail esrThirdpartySdncDetail = new EsrThirdpartySdncDetail(); + esrThirdpartySdncDetail.setEsrSystemInfoList(esrSystemInfoList); + assertEquals(esrThirdpartySdncDetail.getEsrSystemInfoList(), esrSystemInfoList); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncListTest.java index fcf5db4..aed7ab0 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncListTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncListTest.java @@ -16,21 +16,19 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrThirdpartySdncListTest { - @Test - public void getterAndSetter4EsrThirdpartySdncList() { - EsrThirdpartySdncList esrThirdpartySdncList = new EsrThirdpartySdncList(); - List esrThirdpartySdncs = new ArrayList<>(); - EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); - esrThirdpartySdnc.setThirdpartySdncId("123"); - esrThirdpartySdncs.add(esrThirdpartySdnc); - esrThirdpartySdncList.setEsrThirdpartySdnc(esrThirdpartySdncs); - assertEquals(esrThirdpartySdncList.getEsrThirdpartySdnc(), esrThirdpartySdncs); - } + @Test + public void getterAndSetter4EsrThirdpartySdncList() { + EsrThirdpartySdncList esrThirdpartySdncList = new EsrThirdpartySdncList(); + List esrThirdpartySdncs = new ArrayList<>(); + EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); + esrThirdpartySdnc.setThirdpartySdncId("123"); + esrThirdpartySdncs.add(esrThirdpartySdnc); + esrThirdpartySdncList.setEsrThirdpartySdnc(esrThirdpartySdncs); + assertEquals(esrThirdpartySdncList.getEsrThirdpartySdnc(), esrThirdpartySdncs); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncTest.java index 6f757b5..253dbba 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrThirdpartySdncTest.java @@ -16,39 +16,38 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class EsrThirdpartySdncTest { - @Test - public void getterAndSetter4thirdpartySdncId(){ - final String thirdpartySdncId = "thirdpartySdncId-test"; - EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); - esrThirdpartySdnc.setThirdpartySdncId(thirdpartySdncId); - assertEquals(esrThirdpartySdnc.getThirdpartySdncId(), thirdpartySdncId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); - esrThirdpartySdnc.setResourceVersion(resourceVersion); - assertEquals(esrThirdpartySdnc.getResourceVersion(), resourceVersion); - } - - @Test - public void getterAndSetter4location(){ - final String location = "location-test"; - EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); - esrThirdpartySdnc.setLocation(location); - assertEquals(esrThirdpartySdnc.getLocation(), location); - } - - @Test - public void getterAndSetter4productName(){ - final String productName = "productName-test"; - EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); - esrThirdpartySdnc.setProductName(productName); - assertEquals(esrThirdpartySdnc.getProductName(), productName); - } + @Test + public void getterAndSetter4thirdpartySdncId() { + final String thirdpartySdncId = "thirdpartySdncId-test"; + EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); + esrThirdpartySdnc.setThirdpartySdncId(thirdpartySdncId); + assertEquals(esrThirdpartySdnc.getThirdpartySdncId(), thirdpartySdncId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); + esrThirdpartySdnc.setResourceVersion(resourceVersion); + assertEquals(esrThirdpartySdnc.getResourceVersion(), resourceVersion); + } + + @Test + public void getterAndSetter4location() { + final String location = "location-test"; + EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); + esrThirdpartySdnc.setLocation(location); + assertEquals(esrThirdpartySdnc.getLocation(), location); + } + + @Test + public void getterAndSetter4productName() { + final String productName = "productName-test"; + EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc(); + esrThirdpartySdnc.setProductName(productName); + assertEquals(esrThirdpartySdnc.getProductName(), productName); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmDetailTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmDetailTest.java index 17991aa..fa85f5a 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmDetailTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmDetailTest.java @@ -16,55 +16,53 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrVnfmDetailTest { - @Test - public void getterAndSetter4vnfmId(){ - final String vnfmId = "vnfmId-test"; - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - esrVnfm.setVnfmId(vnfmId); - assertEquals(esrVnfm.getVnfmId(), vnfmId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - esrVnfm.setResourceVersion(resourceVersion); - assertEquals(esrVnfm.getResourceVersion(), resourceVersion); - } - - @Test - public void getterAndSetter4vimId(){ - final String vimId = "vimId-test"; - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - esrVnfm.setVimId(vimId); - assertEquals(esrVnfm.getVimId(), vimId); - } - - @Test - public void getterAndSetter4certificateUrl(){ - final String certificateUrl = "certificateUrl-test"; - EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); - esrVnfm.setCertificateUrl(certificateUrl); - assertEquals(esrVnfm.getCertificateUrl(), certificateUrl); - } - - @Test - public void getterAndSetter4esrSystemInfoList(){ - final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - List esrSystemInfo = new ArrayList<>(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - esrSystemInfoObj.setEsrSystemInfoId("123"); - esrSystemInfo.add(esrSystemInfoObj ); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - esrVnfmDetail.setEsrSystemInfoList(esrSystemInfoList); - assertEquals(esrVnfmDetail.getEsrSystemInfoList(), esrSystemInfoList); - } + @Test + public void getterAndSetter4vnfmId() { + final String vnfmId = "vnfmId-test"; + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + esrVnfm.setVnfmId(vnfmId); + assertEquals(esrVnfm.getVnfmId(), vnfmId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + esrVnfm.setResourceVersion(resourceVersion); + assertEquals(esrVnfm.getResourceVersion(), resourceVersion); + } + + @Test + public void getterAndSetter4vimId() { + final String vimId = "vimId-test"; + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + esrVnfm.setVimId(vimId); + assertEquals(esrVnfm.getVimId(), vimId); + } + + @Test + public void getterAndSetter4certificateUrl() { + final String certificateUrl = "certificateUrl-test"; + EsrVnfmDetail esrVnfm = new EsrVnfmDetail(); + esrVnfm.setCertificateUrl(certificateUrl); + assertEquals(esrVnfm.getCertificateUrl(), certificateUrl); + } + + @Test + public void getterAndSetter4esrSystemInfoList() { + final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + List esrSystemInfo = new ArrayList<>(); + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + esrSystemInfoObj.setEsrSystemInfoId("123"); + esrSystemInfo.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfo); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + esrVnfmDetail.setEsrSystemInfoList(esrSystemInfoList); + assertEquals(esrVnfmDetail.getEsrSystemInfoList(), esrSystemInfoList); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmListTest.java index 943307b..0c57470 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmListTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmListTest.java @@ -16,21 +16,19 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class EsrVnfmListTest { - @Test - public void getterAndSetter4EsrVnfmList() { - EsrVnfmList esrVnfmList = new EsrVnfmList(); - List esrVnfms = new ArrayList<>(); - EsrVnfm esrVnfm = new EsrVnfm(); - esrVnfm.setVnfmId("fadasf"); - esrVnfms.add(esrVnfm); - esrVnfmList.setEsrVnfm(esrVnfms); - assertEquals(esrVnfmList.getEsrVnfm(), esrVnfms); - } + @Test + public void getterAndSetter4EsrVnfmList() { + EsrVnfmList esrVnfmList = new EsrVnfmList(); + List esrVnfms = new ArrayList<>(); + EsrVnfm esrVnfm = new EsrVnfm(); + esrVnfm.setVnfmId("fadasf"); + esrVnfms.add(esrVnfm); + esrVnfmList.setEsrVnfm(esrVnfms); + assertEquals(esrVnfmList.getEsrVnfm(), esrVnfms); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmTest.java index efdf61d..f0f5ebf 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/EsrVnfmTest.java @@ -16,39 +16,38 @@ package org.onap.aai.esr.entity.aai; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class EsrVnfmTest { - @Test - public void getterAndSetter4vnfmId(){ - final String vnfmId = "vnfmId-test"; - EsrVnfm esrVnfm = new EsrVnfm(); - esrVnfm.setVnfmId(vnfmId); - assertEquals(esrVnfm.getVnfmId(), vnfmId); - } - - @Test - public void getterAndSetter4resourceVersion(){ - final String resourceVersion = "resourceVersion-test"; - EsrVnfm esrVnfm = new EsrVnfm(); - esrVnfm.setResourceVersion(resourceVersion); - assertEquals(esrVnfm.getResourceVersion(), resourceVersion); - } - - @Test - public void getterAndSetter4vimId(){ - final String vimId = "vimId-test"; - EsrVnfm esrVnfm = new EsrVnfm(); - esrVnfm.setVimId(vimId); - assertEquals(esrVnfm.getVimId(), vimId); - } - - @Test - public void getterAndSetter4certificateUrl(){ - final String certificateUrl = "certificateUrl-test"; - EsrVnfm esrVnfm = new EsrVnfm(); - esrVnfm.setCertificateUrl(certificateUrl); - assertEquals(esrVnfm.getCertificateUrl(), certificateUrl); - } + @Test + public void getterAndSetter4vnfmId() { + final String vnfmId = "vnfmId-test"; + EsrVnfm esrVnfm = new EsrVnfm(); + esrVnfm.setVnfmId(vnfmId); + assertEquals(esrVnfm.getVnfmId(), vnfmId); + } + + @Test + public void getterAndSetter4resourceVersion() { + final String resourceVersion = "resourceVersion-test"; + EsrVnfm esrVnfm = new EsrVnfm(); + esrVnfm.setResourceVersion(resourceVersion); + assertEquals(esrVnfm.getResourceVersion(), resourceVersion); + } + + @Test + public void getterAndSetter4vimId() { + final String vimId = "vimId-test"; + EsrVnfm esrVnfm = new EsrVnfm(); + esrVnfm.setVimId(vimId); + assertEquals(esrVnfm.getVimId(), vimId); + } + + @Test + public void getterAndSetter4certificateUrl() { + final String certificateUrl = "certificateUrl-test"; + EsrVnfm esrVnfm = new EsrVnfm(); + esrVnfm.setCertificateUrl(certificateUrl); + assertEquals(esrVnfm.getCertificateUrl(), certificateUrl); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/AlarmAddrTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/AlarmAddrTest.java index ddab31b..b460aa1 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/AlarmAddrTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/AlarmAddrTest.java @@ -16,40 +16,39 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class AlarmAddrTest { - @Test - public void getterAndSetter4ip(){ - final String ip = "127.0.0.1"; - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setIp(ip); - assertEquals(alarmAddr.getIp(), ip); - } - - @Test - public void getterAndSetter4port(){ - final String port = "8080"; - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setPort(port); - assertEquals(alarmAddr.getPort(), port); - } - - @Test - public void getterAndSetter4user(){ - final String user = "root"; - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setUser(user); - assertEquals(alarmAddr.getUser(), user); - } - - @Test - public void getterAndSetter4password(){ - final String password = "dfasfa"; - AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setPassword(password); - assertEquals(alarmAddr.getPassword(), password); - } + @Test + public void getterAndSetter4ip() { + final String ip = "127.0.0.1"; + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr.setIp(ip); + assertEquals(alarmAddr.getIp(), ip); + } + + @Test + public void getterAndSetter4port() { + final String port = "8080"; + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr.setPort(port); + assertEquals(alarmAddr.getPort(), port); + } + + @Test + public void getterAndSetter4user() { + final String user = "root"; + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr.setUser(user); + assertEquals(alarmAddr.getUser(), user); + } + + @Test + public void getterAndSetter4password() { + final String password = "dfasfa"; + AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr.setPassword(password); + assertEquals(alarmAddr.getPassword(), password); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/CommonRegisterResponseTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/CommonRegisterResponseTest.java index 9f4aa20..7912b1b 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/CommonRegisterResponseTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/CommonRegisterResponseTest.java @@ -16,15 +16,14 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class CommonRegisterResponseTest { - @Test - public void getterAndSetter4id(){ - final String id = "312erqdfa"; - CommonRegisterResponse commonRegisterResponse = new CommonRegisterResponse(); - commonRegisterResponse.setId(id); - assertEquals(commonRegisterResponse.getId(), id); - } + @Test + public void getterAndSetter4id() { + final String id = "312erqdfa"; + CommonRegisterResponse commonRegisterResponse = new CommonRegisterResponse(); + commonRegisterResponse.setId(id); + assertEquals(commonRegisterResponse.getId(), id); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/EmsRegisterInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/EmsRegisterInfoTest.java index 091604b..d9a77df 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/EmsRegisterInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/EmsRegisterInfoTest.java @@ -16,66 +16,65 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class EmsRegisterInfoTest { - @Test - public void getterAndSetter4emsId(){ - final String emsId = "dafadf"; - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - emsRegisterInfo.setEmsId(emsId); - assertEquals(emsRegisterInfo.getEmsId(), emsId); - } - - @Test - public void getterAndSetter4name() { - final String name = "dafadf"; - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - emsRegisterInfo.setName(name); - assertEquals(emsRegisterInfo.getName(), name); - } - - @Test - public void getterAndSetter4vendor(){ - final String vendor = "dafadf"; - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - emsRegisterInfo.setVendor(vendor); - assertEquals(emsRegisterInfo.getVendor(), vendor); - } - - @Test - public void getterAndSetter4version(){ - final String version = "dafadf"; - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - emsRegisterInfo.setVersion(version); - assertEquals(emsRegisterInfo.getVersion(), version); - } - - @Test - public void getterAndSetter4resouceAddr(){ - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - final FtpAddr resourceAddr = new FtpAddr(); - resourceAddr.setFtptype("sftp"); - emsRegisterInfo.setResourceAddr(resourceAddr); - assertEquals(emsRegisterInfo.getResourceAddr(), resourceAddr); - } - - @Test - public void getterAndSetter4performanceAddr(){ - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - final FtpAddr performanceAddr = new FtpAddr(); - performanceAddr.setFtptype("sftp"); - emsRegisterInfo.setPerformanceAddr(performanceAddr); - assertEquals(emsRegisterInfo.getPerformanceAddr(), performanceAddr); - } - - @Test - public void getterAndSetter4alarmAddr(){ - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - final AlarmAddr alarmAddr = new AlarmAddr(); - alarmAddr.setIp("127.0.0.1"); - emsRegisterInfo.setAlarmAddr(alarmAddr); - assertEquals(emsRegisterInfo.getAlarmAddr(), alarmAddr); - } + @Test + public void getterAndSetter4emsId() { + final String emsId = "dafadf"; + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + emsRegisterInfo.setEmsId(emsId); + assertEquals(emsRegisterInfo.getEmsId(), emsId); + } + + @Test + public void getterAndSetter4name() { + final String name = "dafadf"; + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + emsRegisterInfo.setName(name); + assertEquals(emsRegisterInfo.getName(), name); + } + + @Test + public void getterAndSetter4vendor() { + final String vendor = "dafadf"; + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + emsRegisterInfo.setVendor(vendor); + assertEquals(emsRegisterInfo.getVendor(), vendor); + } + + @Test + public void getterAndSetter4version() { + final String version = "dafadf"; + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + emsRegisterInfo.setVersion(version); + assertEquals(emsRegisterInfo.getVersion(), version); + } + + @Test + public void getterAndSetter4resouceAddr() { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + final FtpAddr resourceAddr = new FtpAddr(); + resourceAddr.setFtptype("sftp"); + emsRegisterInfo.setResourceAddr(resourceAddr); + assertEquals(emsRegisterInfo.getResourceAddr(), resourceAddr); + } + + @Test + public void getterAndSetter4performanceAddr() { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + final FtpAddr performanceAddr = new FtpAddr(); + performanceAddr.setFtptype("sftp"); + emsRegisterInfo.setPerformanceAddr(performanceAddr); + assertEquals(emsRegisterInfo.getPerformanceAddr(), performanceAddr); + } + + @Test + public void getterAndSetter4alarmAddr() { + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + final AlarmAddr alarmAddr = new AlarmAddr(); + alarmAddr.setIp("127.0.0.1"); + emsRegisterInfo.setAlarmAddr(alarmAddr); + assertEquals(emsRegisterInfo.getAlarmAddr(), alarmAddr); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/FtpAddrTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/FtpAddrTest.java index 13883bb..b823688 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/FtpAddrTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/FtpAddrTest.java @@ -16,64 +16,63 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class FtpAddrTest { - @Test - public void getterAndSetter4ip(){ - final String ip = "127.0.0.1"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setIp(ip); - assertEquals(ftpAddr.getIp(), ip); - } - - @Test - public void getterAndSetter4port(){ - final String port = "8080"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setPort(port); - assertEquals(ftpAddr.getPort(), port); - } - - @Test - public void getterAndSetter4user(){ - final String user = "root"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setUser(user); - assertEquals(ftpAddr.getUser(), user); - } - - @Test - public void getterAndSetter4password(){ - final String password = "dfasfa"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setPassword(password); - assertEquals(ftpAddr.getPassword(), password); - } - - @Test - public void getterAndSetter4ftptype(){ - final String ftptype = "sftp"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setFtptype(ftptype); - assertEquals(ftpAddr.getFtptype(), ftptype); - } - - @Test - public void getterAndSetter4remotepath(){ - final String remotepath = "/home/opt/"; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setRemotepath(remotepath); - assertEquals(ftpAddr.getRemotepath(), remotepath); - } - - @Test - public void getterAndSetter4passive(){ - final Boolean passive = true; - FtpAddr ftpAddr = new FtpAddr(); - ftpAddr.setPassive(passive); - assertEquals(ftpAddr.getPassive(), passive); - } + @Test + public void getterAndSetter4ip() { + final String ip = "127.0.0.1"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setIp(ip); + assertEquals(ftpAddr.getIp(), ip); + } + + @Test + public void getterAndSetter4port() { + final String port = "8080"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setPort(port); + assertEquals(ftpAddr.getPort(), port); + } + + @Test + public void getterAndSetter4user() { + final String user = "root"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setUser(user); + assertEquals(ftpAddr.getUser(), user); + } + + @Test + public void getterAndSetter4password() { + final String password = "dfasfa"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setPassword(password); + assertEquals(ftpAddr.getPassword(), password); + } + + @Test + public void getterAndSetter4ftptype() { + final String ftptype = "sftp"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setFtptype(ftptype); + assertEquals(ftpAddr.getFtptype(), ftptype); + } + + @Test + public void getterAndSetter4remotepath() { + final String remotepath = "/home/opt/"; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setRemotepath(remotepath); + assertEquals(ftpAddr.getRemotepath(), remotepath); + } + + @Test + public void getterAndSetter4passive() { + final Boolean passive = true; + FtpAddr ftpAddr = new FtpAddr(); + ftpAddr.setPassive(passive); + assertEquals(ftpAddr.getPassive(), passive); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfoTest.java index 86524c5..4cd9355 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/ThirdpartySdncRegisterInfoTest.java @@ -16,95 +16,94 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class ThirdpartySdncRegisterInfoTest { - @Test - public void getterAndSetter4cloudDomain(){ - final String thirdpartySdncId = "312erqdfa"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setThirdpartySdncId(thirdpartySdncId); - assertEquals(thirdpartySdncRegisterInfo.getThirdpartySdncId(), thirdpartySdncId); - } - - @Test - public void getterAndSetter4name(){ - final String name = "sdnc-test"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setName(name); - assertEquals(thirdpartySdncRegisterInfo.getName(), name); - } - - @Test - public void getterAndSetter4vendor(){ - final String vendor = "zte"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setVendor(vendor); - assertEquals(thirdpartySdncRegisterInfo.getVendor(), vendor); - } - - @Test - public void getterAndSetter4version(){ - final String version = "v1.0"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setVersion(version); - assertEquals(thirdpartySdncRegisterInfo.getVersion(), version); - } - - @Test - public void getterAndSetter4type(){ - final String type = "type-test"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setType(type); - assertEquals(thirdpartySdncRegisterInfo.getType(), type); - } - - @Test - public void getterAndSetter4location(){ - final String location = "312erqdfa"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setLocation(location); - assertEquals(thirdpartySdncRegisterInfo.getLocation(), location); - } - - @Test - public void getterAndSetter4url(){ - final String url = "http://13.44.22.11:5000"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setUrl(url); - assertEquals(thirdpartySdncRegisterInfo.getUrl(), url); - } - - @Test - public void getterAndSetter4userName(){ - final String userName = "root"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setUserName(userName); - assertEquals(thirdpartySdncRegisterInfo.getUserName(), userName); - } - - @Test - public void getterAndSetter4password(){ - final String password = "root"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setPassword(password); - assertEquals(thirdpartySdncRegisterInfo.getPassword(), password); - } - - @Test - public void getterAndSetter4productName(){ - final String productName = "sdnctest"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setProductName(productName); - assertEquals(thirdpartySdncRegisterInfo.getProductName(), productName); - } - - @Test - public void getterAndSetter4protocol(){ - final String protocol = "root"; - ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - thirdpartySdncRegisterInfo.setProtocol(protocol); - assertEquals(thirdpartySdncRegisterInfo.getProtocol(), protocol); - } + @Test + public void getterAndSetter4cloudDomain() { + final String thirdpartySdncId = "312erqdfa"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setThirdpartySdncId(thirdpartySdncId); + assertEquals(thirdpartySdncRegisterInfo.getThirdpartySdncId(), thirdpartySdncId); + } + + @Test + public void getterAndSetter4name() { + final String name = "sdnc-test"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setName(name); + assertEquals(thirdpartySdncRegisterInfo.getName(), name); + } + + @Test + public void getterAndSetter4vendor() { + final String vendor = "zte"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setVendor(vendor); + assertEquals(thirdpartySdncRegisterInfo.getVendor(), vendor); + } + + @Test + public void getterAndSetter4version() { + final String version = "v1.0"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setVersion(version); + assertEquals(thirdpartySdncRegisterInfo.getVersion(), version); + } + + @Test + public void getterAndSetter4type() { + final String type = "type-test"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setType(type); + assertEquals(thirdpartySdncRegisterInfo.getType(), type); + } + + @Test + public void getterAndSetter4location() { + final String location = "312erqdfa"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setLocation(location); + assertEquals(thirdpartySdncRegisterInfo.getLocation(), location); + } + + @Test + public void getterAndSetter4url() { + final String url = "http://13.44.22.11:5000"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setUrl(url); + assertEquals(thirdpartySdncRegisterInfo.getUrl(), url); + } + + @Test + public void getterAndSetter4userName() { + final String userName = "root"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setUserName(userName); + assertEquals(thirdpartySdncRegisterInfo.getUserName(), userName); + } + + @Test + public void getterAndSetter4password() { + final String password = "root"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setPassword(password); + assertEquals(thirdpartySdncRegisterInfo.getPassword(), password); + } + + @Test + public void getterAndSetter4productName() { + final String productName = "sdnctest"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setProductName(productName); + assertEquals(thirdpartySdncRegisterInfo.getProductName(), productName); + } + + @Test + public void getterAndSetter4protocol() { + final String protocol = "root"; + ThirdpartySdncRegisterInfo thirdpartySdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + thirdpartySdncRegisterInfo.setProtocol(protocol); + assertEquals(thirdpartySdncRegisterInfo.getProtocol(), protocol); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java index 5e8aa4f..94875fc 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimAuthInfoTest.java @@ -16,56 +16,55 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class VimAuthInfoTest { - @Test - public void getterAndSetter4cloudDomain(){ - final String cloudDomain = "chengdu"; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setCloudDomain(cloudDomain); - assertEquals(vimAuthInfo.getCloudDomain(), cloudDomain); - } - - @Test - public void getterAndSetter4userName(){ - final String userName = "nancy"; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setUserName(userName); - assertEquals(vimAuthInfo.getUserName(), userName); - } - - @Test - public void getterAndSetter4password(){ - final String password = "dasffa"; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setPassword(password); - assertEquals(vimAuthInfo.getPassword(), password); - } - - @Test - public void getterAndSetter4authUrl(){ - final String authUrl = "http://127.0.0.1:5000/auth/"; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setAuthUrl(authUrl); - assertEquals(vimAuthInfo.getAuthUrl(), authUrl); - } - - @Test - public void getterAndSetter4sslCacert(){ - final String sslCacert = "fdfafda"; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setSslCacert(sslCacert); - assertEquals(vimAuthInfo.getSslCacert(), sslCacert); - } - - @Test - public void getterAndSetter4sslInsecure(){ - final Boolean sslInsecure = true; - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setSslInsecure(sslInsecure); - assertEquals(vimAuthInfo.getSslInsecure(), sslInsecure); - } + @Test + public void getterAndSetter4cloudDomain() { + final String cloudDomain = "chengdu"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setCloudDomain(cloudDomain); + assertEquals(vimAuthInfo.getCloudDomain(), cloudDomain); + } + + @Test + public void getterAndSetter4userName() { + final String userName = "nancy"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setUserName(userName); + assertEquals(vimAuthInfo.getUserName(), userName); + } + + @Test + public void getterAndSetter4password() { + final String password = "dasffa"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setPassword(password); + assertEquals(vimAuthInfo.getPassword(), password); + } + + @Test + public void getterAndSetter4authUrl() { + final String authUrl = "http://127.0.0.1:5000/auth/"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setAuthUrl(authUrl); + assertEquals(vimAuthInfo.getAuthUrl(), authUrl); + } + + @Test + public void getterAndSetter4sslCacert() { + final String sslCacert = "fdfafda"; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setSslCacert(sslCacert); + assertEquals(vimAuthInfo.getSslCacert(), sslCacert); + } + + @Test + public void getterAndSetter4sslInsecure() { + final Boolean sslInsecure = true; + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setSslInsecure(sslInsecure); + assertEquals(vimAuthInfo.getSslInsecure(), sslInsecure); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java index 4f4c989..74761f9 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterInfoTest.java @@ -16,91 +16,89 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; public class VimRegisterInfoTest { - @Test - public void getterAndSetter4cloudOwner(){ - final String cloudOwner = "zte"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudOwner(cloudOwner); - assertEquals(vimRegisterInfo.getCloudOwner(), cloudOwner); - } - - @Test - public void getterAndSetter4cloudRegionId(){ - final String cloudRegionId = "region-one"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudRegionId(cloudRegionId); - assertEquals(vimRegisterInfo.getCloudRegionId(), cloudRegionId); - } - - @Test - public void getterAndSetter4cloudType(){ - final String cloudType = "openstack"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudType(cloudType); - assertEquals(vimRegisterInfo.getCloudType(), cloudType); - } - - @Test - public void getterAndSetter4cloudRegionVersion(){ - final String cloudRegionVersion = "v1.0"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudRegionVersion(cloudRegionVersion); - assertEquals(vimRegisterInfo.getCloudRegionVersion(), cloudRegionVersion); - } - - @Test - public void getterAndSetter4ownerDefinedType(){ - final String ownerDefinedType = "test"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setOwnerDefinedType(ownerDefinedType); - assertEquals(vimRegisterInfo.getOwnerDefinedType(), ownerDefinedType); - } - - @Test - public void getterAndSetter4cloudZone(){ - final String cloudZone = "zone1"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudZone(cloudZone); - assertEquals(vimRegisterInfo.getCloudZone(), cloudZone); - } - - @Test - public void getterAndSetter4complexName(){ - final String complexName = "test"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setComplexName(complexName); - assertEquals(vimRegisterInfo.getComplexName(), complexName); - } - - @Test - public void getterAndSetter4cloudExtraInfo(){ - final String cloudExtraInfo = "test"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setCloudExtraInfo(cloudExtraInfo); - assertEquals(vimRegisterInfo.getCloudExtraInfo(), cloudExtraInfo); - } - - @Test - public void getterAndSetter4status(){ - final String status = "normal"; - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setStatus(status); - assertEquals(vimRegisterInfo.getStatus(), status); - } - - @Test - public void getterAndSetter4vimAuthInfos(){ - final List vimAuthInfos = new ArrayList<>(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - vimRegisterInfo.setVimAuthInfos(vimAuthInfos); - assertEquals(vimRegisterInfo.getVimAuthInfos(), vimAuthInfos); - } - + @Test + public void getterAndSetter4cloudOwner() { + final String cloudOwner = "zte"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudOwner(cloudOwner); + assertEquals(vimRegisterInfo.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4cloudRegionId() { + final String cloudRegionId = "region-one"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudRegionId(cloudRegionId); + assertEquals(vimRegisterInfo.getCloudRegionId(), cloudRegionId); + } + + @Test + public void getterAndSetter4cloudType() { + final String cloudType = "openstack"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudType(cloudType); + assertEquals(vimRegisterInfo.getCloudType(), cloudType); + } + + @Test + public void getterAndSetter4cloudRegionVersion() { + final String cloudRegionVersion = "v1.0"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudRegionVersion(cloudRegionVersion); + assertEquals(vimRegisterInfo.getCloudRegionVersion(), cloudRegionVersion); + } + + @Test + public void getterAndSetter4ownerDefinedType() { + final String ownerDefinedType = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setOwnerDefinedType(ownerDefinedType); + assertEquals(vimRegisterInfo.getOwnerDefinedType(), ownerDefinedType); + } + + @Test + public void getterAndSetter4cloudZone() { + final String cloudZone = "zone1"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudZone(cloudZone); + assertEquals(vimRegisterInfo.getCloudZone(), cloudZone); + } + + @Test + public void getterAndSetter4complexName() { + final String complexName = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setComplexName(complexName); + assertEquals(vimRegisterInfo.getComplexName(), complexName); + } + + @Test + public void getterAndSetter4cloudExtraInfo() { + final String cloudExtraInfo = "test"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setCloudExtraInfo(cloudExtraInfo); + assertEquals(vimRegisterInfo.getCloudExtraInfo(), cloudExtraInfo); + } + + @Test + public void getterAndSetter4status() { + final String status = "normal"; + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setStatus(status); + assertEquals(vimRegisterInfo.getStatus(), status); + } + + @Test + public void getterAndSetter4vimAuthInfos() { + final List vimAuthInfos = new ArrayList<>(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + vimRegisterInfo.setVimAuthInfos(vimAuthInfos); + assertEquals(vimRegisterInfo.getVimAuthInfos(), vimAuthInfos); + } + } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java index 21ebd16..bd555a2 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VimRegisterResponseTest.java @@ -16,24 +16,23 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class VimRegisterResponseTest { - @Test - public void getterAndSetter4cloudOwner(){ - final String cloudOwner = "zte"; - VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); - vimRegisterResponse.setCloudOwner(cloudOwner); - assertEquals(vimRegisterResponse.getCloudOwner(), cloudOwner); - } - - @Test - public void getterAndSetter4cloudRegionId(){ - final String cloudRegionId = "region-one"; - VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); - vimRegisterResponse.setCloudRegionId(cloudRegionId); - assertEquals(vimRegisterResponse.getCloudRegionId(), cloudRegionId); - } + @Test + public void getterAndSetter4cloudOwner() { + final String cloudOwner = "zte"; + VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); + vimRegisterResponse.setCloudOwner(cloudOwner); + assertEquals(vimRegisterResponse.getCloudOwner(), cloudOwner); + } + + @Test + public void getterAndSetter4cloudRegionId() { + final String cloudRegionId = "region-one"; + VimRegisterResponse vimRegisterResponse = new VimRegisterResponse(); + vimRegisterResponse.setCloudRegionId(cloudRegionId); + assertEquals(vimRegisterResponse.getCloudRegionId(), cloudRegionId); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfoTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfoTest.java index 84d171d..b57525c 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfoTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/rest/VnfmRegisterInfoTest.java @@ -16,88 +16,87 @@ package org.onap.aai.esr.entity.rest; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class VnfmRegisterInfoTest { - - @Test - public void getterAndSetter4vnfmId(){ - final String vnfmId = "dafadf"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVnfmId(vnfmId); - assertEquals(vnfmRegisterInfo.getVnfmId(), vnfmId); - } - - @Test - public void getterAndSetter4name(){ - final String name = "name-test"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setName(name); - assertEquals(vnfmRegisterInfo.getName(), name); - } - - @Test - public void getterAndSetter4type(){ - final String type = "vnfm-type"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setType(type); - assertEquals(vnfmRegisterInfo.getType(), type); - } - - @Test - public void getterAndSetter4vimId(){ - final String vimId = "dafadf"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVimId(vimId); - assertEquals(vnfmRegisterInfo.getVimId(), vimId); - } - - @Test - public void getterAndSetter4vendor(){ - final String vendor = "zte"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVendor(vendor); - assertEquals(vnfmRegisterInfo.getVendor(), vendor); - } - - @Test - public void getterAndSetter4version(){ - final String version = "v1.0"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVersion(version); - assertEquals(vnfmRegisterInfo.getVersion(), version); - } - - @Test - public void getterAndSetter4certificateUrl(){ - final String certificateUrl = "/test"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setCertificateUrl(certificateUrl); - assertEquals(vnfmRegisterInfo.getCertificateUrl(), certificateUrl); - } - - @Test - public void getterAndSetter4url(){ - final String url = "/home"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setUrl(url); - assertEquals(vnfmRegisterInfo.getUrl(), url); - } - - @Test - public void getterAndSetter4userName(){ - final String userName = "li"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setUserName(userName); - assertEquals(vnfmRegisterInfo.getUserName(), userName); - } - - @Test - public void getterAndSetter4password(){ - final String password = "dfaaf"; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setPassword(password); - assertEquals(vnfmRegisterInfo.getPassword(), password); - } + + @Test + public void getterAndSetter4vnfmId() { + final String vnfmId = "dafadf"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVnfmId(vnfmId); + assertEquals(vnfmRegisterInfo.getVnfmId(), vnfmId); + } + + @Test + public void getterAndSetter4name() { + final String name = "name-test"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setName(name); + assertEquals(vnfmRegisterInfo.getName(), name); + } + + @Test + public void getterAndSetter4type() { + final String type = "vnfm-type"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setType(type); + assertEquals(vnfmRegisterInfo.getType(), type); + } + + @Test + public void getterAndSetter4vimId() { + final String vimId = "dafadf"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId(vimId); + assertEquals(vnfmRegisterInfo.getVimId(), vimId); + } + + @Test + public void getterAndSetter4vendor() { + final String vendor = "zte"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVendor(vendor); + assertEquals(vnfmRegisterInfo.getVendor(), vendor); + } + + @Test + public void getterAndSetter4version() { + final String version = "v1.0"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVersion(version); + assertEquals(vnfmRegisterInfo.getVersion(), version); + } + + @Test + public void getterAndSetter4certificateUrl() { + final String certificateUrl = "/test"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setCertificateUrl(certificateUrl); + assertEquals(vnfmRegisterInfo.getCertificateUrl(), certificateUrl); + } + + @Test + public void getterAndSetter4url() { + final String url = "/home"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setUrl(url); + assertEquals(vnfmRegisterInfo.getUrl(), url); + } + + @Test + public void getterAndSetter4userName() { + final String userName = "li"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setUserName(userName); + assertEquals(vnfmRegisterInfo.getUserName(), userName); + } + + @Test + public void getterAndSetter4password() { + final String password = "dfaaf"; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setPassword(password); + assertEquals(vnfmRegisterInfo.getPassword(), password); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExceptionUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExceptionUtilTest.java index 38f8fa2..df4d46b 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExceptionUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExceptionUtilTest.java @@ -17,13 +17,12 @@ package org.onap.aai.esr.exception; import org.junit.Assert; import org.junit.Test; - import javax.ws.rs.WebApplicationException; public class ExceptionUtilTest { @Test - public void testBuildExceptionResponse(){ + public void testBuildExceptionResponse() { WebApplicationException exp = ExceptionUtil.buildExceptionResponse("Exception from JUnit"); Assert.assertNotNull(exp); Assert.assertNotNull(exp.getResponse()); diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExtsysExceptionTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExtsysExceptionTest.java index e448f50..e3ae403 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExtsysExceptionTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/exception/ExtsysExceptionTest.java @@ -21,7 +21,7 @@ import org.junit.Test; public class ExtsysExceptionTest { @Test - public void testAllMethods(){ + public void testAllMethods() { ExtsysException esExp = new ExtsysException(); esExp.setErrorCode("498"); Assert.assertEquals(esExp.getErrorCode(), "498"); diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/AaiCommonTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/AaiCommonTest.java index 1940c79..b428cc4 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/AaiCommonTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/AaiCommonTest.java @@ -21,7 +21,7 @@ import org.junit.Test; public class AaiCommonTest { @Test - public void testGetAuthenticationCredentials(){ + public void testGetAuthenticationCredentials() { String cred = AaiCommon.getAuthenticationCredentials(); Assert.assertNotNull(cred); Assert.assertTrue(cred.contains("Basic")); diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxyTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxyTest.java index 22c9524..b6e4de1 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxyTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/CloudRegionProxyTest.java @@ -26,7 +26,7 @@ public class CloudRegionProxyTest { CloudRegionProxy proxy; @Before - public void init(){ + public void init() { MsbConfig.setMsbServerAddr("http://msb-server"); proxy = new CloudRegionProxy(); } @@ -43,12 +43,12 @@ public class CloudRegionProxyTest { } @Test(expected = ExtsysException.class) - public void testQueryVimList() throws ExtsysException{ + public void testQueryVimList() throws ExtsysException { proxy.qureyVimList(); } @Test(expected = ExtsysException.class) - public void testDeleteVim() throws ExtsysException{ + public void testDeleteVim() throws ExtsysException { proxy.deleteVim("owner-1", "region-1", "version-1"); } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java index 8f7cc92..09e6318 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/aai/ExternalSystemProxyTest.java @@ -34,65 +34,65 @@ public class ExternalSystemProxyTest { } @Test(expected = ExtsysException.class) - public void testRegisterVnfm() throws ExtsysException{ + public void testRegisterVnfm() throws ExtsysException { EsrVnfmDetail detail = new EsrVnfmDetail(); ExternalSystemProxy.registerVnfm("vnfm-1", detail); } @Test(expected = ExtsysException.class) - public void testQueryVnfmDetail() throws ExtsysException{ + public void testQueryVnfmDetail() throws ExtsysException { ExternalSystemProxy.queryVnfmDetail("vnfm-1"); } @Test(expected = ExtsysException.class) - public void testQueryVnfmList() throws ExtsysException{ + public void testQueryVnfmList() throws ExtsysException { ExternalSystemProxy.queryVnfmList(); } @Test(expected = ExtsysException.class) - public void testDeleteVnfm() throws ExtsysException{ + public void testDeleteVnfm() throws ExtsysException { ExternalSystemProxy.deleteVnfm("vnfm-1", "version-1"); } @Test(expected = ExtsysException.class) - public void testRegisterSdnc() throws ExtsysException{ + public void testRegisterSdnc() throws ExtsysException { EsrThirdpartySdncDetail detail = new EsrThirdpartySdncDetail(); ExternalSystemProxy.registerSdnc("sdnc-1", detail); } @Test(expected = ExtsysException.class) - public void testQueryThirdpartySdncDetail() throws ExtsysException{ + public void testQueryThirdpartySdncDetail() throws ExtsysException { ExternalSystemProxy.queryThirdpartySdncDetail("sdnc-1"); } @Test(expected = ExtsysException.class) - public void testQuerySdncList() throws ExtsysException{ + public void testQuerySdncList() throws ExtsysException { ExternalSystemProxy.querySdncList(); } @Test(expected = ExtsysException.class) - public void testDeleteThirdpartySdnc() throws ExtsysException{ + public void testDeleteThirdpartySdnc() throws ExtsysException { ExternalSystemProxy.deleteThirdpartySdnc("sdnc-1", "version-1"); } @Test(expected = ExtsysException.class) - public void testRegisterEms() throws ExtsysException{ + public void testRegisterEms() throws ExtsysException { EsrEmsDetail detail = new EsrEmsDetail(); - ExternalSystemProxy.registerEms("ems-1",detail); + ExternalSystemProxy.registerEms("ems-1", detail); } @Test(expected = ExtsysException.class) - public void testQueryEmsDetail() throws ExtsysException{ + public void testQueryEmsDetail() throws ExtsysException { ExternalSystemProxy.queryEmsDetail("ems-1"); } @Test(expected = ExtsysException.class) - public void testQueryEmsList() throws ExtsysException{ + public void testQueryEmsList() throws ExtsysException { ExternalSystemProxy.queryEmsList(); } @Test(expected = ExtsysException.class) - public void testDeleteEms() throws ExtsysException{ + public void testDeleteEms() throws ExtsysException { ExternalSystemProxy.deleteEms("ems-1", "version-1"); } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxyTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxyTest.java index 5637783..044d830 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxyTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/cloud/VimManagerProxyTest.java @@ -32,7 +32,7 @@ public class VimManagerProxyTest { } @Test(expected = ExtsysException.class) - public void testUpdateVim() throws ExtsysException{ + public void testUpdateVim() throws ExtsysException { Tenant tenant = new Tenant(); tenant.setDefaultTenant("defaultTenant"); Assert.assertEquals(tenant.getDefaultTenant(), "defaultTenant"); diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/msb/MsbHelperTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/msb/MsbHelperTest.java index 28a22c5..1581b08 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/msb/MsbHelperTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/externalservice/msb/MsbHelperTest.java @@ -35,17 +35,17 @@ public class MsbHelperTest { MicroServiceFullInfo serviceInfo; @Before - public void init(){ + public void init() { MockitoAnnotations.initMocks(this); helper = new MsbHelper(client); } @Test public void testRegisterMsb() throws Exception { - Mockito.when(client.registerMicroServiceInfo(Mockito.any(MicroServiceInfo.class), - Mockito.anyBoolean())).thenReturn(serviceInfo); + Mockito.when(client.registerMicroServiceInfo(Mockito.any(MicroServiceInfo.class), Mockito.anyBoolean())) + .thenReturn(serviceInfo); helper.registerMsb(); - Mockito.verify(client, Mockito.times(1)). - registerMicroServiceInfo(Mockito.any(MicroServiceInfo.class), Mockito.anyBoolean()); + Mockito.verify(client, Mockito.times(1)).registerMicroServiceInfo(Mockito.any(MicroServiceInfo.class), + Mockito.anyBoolean()); } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/EmsManagerUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/EmsManagerUtilTest.java index ba16be7..76d4d31 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/util/EmsManagerUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/EmsManagerUtilTest.java @@ -16,164 +16,95 @@ package org.onap.aai.esr.util; import static org.junit.Assert.assertEquals; - - import org.junit.Test; import org.onap.aai.esr.entity.aai.EsrEmsDetail; import org.onap.aai.esr.entity.rest.AlarmAddr; import org.onap.aai.esr.entity.rest.EmsRegisterInfo; import org.onap.aai.esr.entity.rest.FtpAddr; - import com.google.gson.Gson; public class EmsManagerUtilTest { - - @Test - public void getEsrSystemInfoListFromAuthInfoTest() { - EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EsrEmsDetail esrEms = new EsrEmsDetail(); - AlarmAddr alarmAddr = new AlarmAddr(); - FtpAddr resourceAddr = new FtpAddr(); - FtpAddr performanceAddr = new FtpAddr(); - alarmAddr.setIp("127.0.0.1"); - alarmAddr.setPassword("987654"); - alarmAddr.setPort("5000"); - alarmAddr.setUser("nancy"); - resourceAddr.setFtptype("sftp"); - resourceAddr.setIp("127.0.0.1"); - resourceAddr.setPassive(true); - resourceAddr.setPassword("asdf"); - resourceAddr.setPort("5000"); - resourceAddr.setRemotepath("/home/per"); - resourceAddr.setUser("nancy"); - performanceAddr.setFtptype("sftp"); - performanceAddr.setIp("127.0.0.1"); - performanceAddr.setPassive(true); - performanceAddr.setPassword("asdf"); - performanceAddr.setPort("5000"); - performanceAddr.setRemotepath("/home/per"); - performanceAddr.setUser("nancy"); - emsRegisterInfo.setName("EMS_TEST"); - emsRegisterInfo.setVendor("ZTE"); - emsRegisterInfo.setVersion("V1"); - emsRegisterInfo.setAlarmAddr(alarmAddr); - emsRegisterInfo.setResourceAddr(resourceAddr); - emsRegisterInfo.setPerformanceAddr(performanceAddr); - esrEms = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); - esrEms.setEmsId("123456"); - esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("234567"); - esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(1).setEsrSystemInfoId("345678"); - esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(2).setEsrSystemInfoId("456789"); - String esremsStr = new ExtsysUtil().objectToString(esrEms); - String expect = "{\"ems-id\":\"123456\"," - + "\"esr-system-info-list\":" - + "{\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"234567\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"type\":\"sftp\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"system-type\":\"EMS_RESOUCE\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"passive\":true," - + "\"remote-path\":\"/home/per\"}," - + "{\"esr-system-info-id\":\"345678\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"type\":\"sftp\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"system-type\":\"EMS_PERFORMANCE\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"passive\":true," - + "\"remote-path\":\"/home/per\"}," - + "{\"esr-system-info-id\":\"456789\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"EMS_ALARM\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"}]}}"; - assertEquals(expect, esremsStr); - } - - @Test - public void EsrEms2EmsRegisterInfoTest() { - EsrEmsDetail esrEms = new EsrEmsDetail(); - EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); - EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); - String esrEmsStr = "{\"ems-id\":\"123456\"," - + "\"esr-system-info-list\":" - + "{\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"234567\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"type\":\"sftp\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"system-type\":\"EMS_RESOUCE\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"passive\":true," - + "\"remote-path\":\"/home/per\"}," - + "{\"esr-system-info-id\":\"345678\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"type\":\"sftp\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"system-type\":\"EMS_PERFORMANCE\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"passive\":true," - + "\"remote-path\":\"/home/per\"}," - + "{\"esr-system-info-id\":\"456789\"," - + "\"system-name\":\"EMS_TEST\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"EMS_ALARM\"," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"}]}}"; - esrEms = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); - emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEms); - String registerInfoStr = new ExtsysUtil().objectToString(emsRegisterInfo); - String expectRegisterInfo = "{\"emsId\":\"123456\"," - + "\"name\":\"EMS_TEST\"," - + "\"vendor\":\"ZTE\"," - + "\"version\":\"V1\"," - + "\"resourceAddr\":{" - + "\"ftptype\":\"sftp\"," - + "\"ip\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"user\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"remotepath\":\"/home/per\"," - + "\"passive\":true}," - + "\"performanceAddr\":{" - + "\"ftptype\":\"sftp\"," - + "\"ip\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"user\":\"nancy\"," - + "\"password\":\"asdf\"," - + "\"remotepath\":\"/home/per\"," - + "\"passive\":true}," - + "\"alarmAddr\":{" - + "\"ip\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"user\":\"nancy\"," - + "\"password\":\"987654\"}}"; - assertEquals(registerInfoStr, expectRegisterInfo); - } + + @Test + public void getEsrSystemInfoListFromAuthInfoTest() { + EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + EsrEmsDetail esrEms = new EsrEmsDetail(); + AlarmAddr alarmAddr = new AlarmAddr(); + FtpAddr resourceAddr = new FtpAddr(); + FtpAddr performanceAddr = new FtpAddr(); + alarmAddr.setIp("127.0.0.1"); + alarmAddr.setPassword("987654"); + alarmAddr.setPort("5000"); + alarmAddr.setUser("nancy"); + resourceAddr.setFtptype("sftp"); + resourceAddr.setIp("127.0.0.1"); + resourceAddr.setPassive(true); + resourceAddr.setPassword("asdf"); + resourceAddr.setPort("5000"); + resourceAddr.setRemotepath("/home/per"); + resourceAddr.setUser("nancy"); + performanceAddr.setFtptype("sftp"); + performanceAddr.setIp("127.0.0.1"); + performanceAddr.setPassive(true); + performanceAddr.setPassword("asdf"); + performanceAddr.setPort("5000"); + performanceAddr.setRemotepath("/home/per"); + performanceAddr.setUser("nancy"); + emsRegisterInfo.setName("EMS_TEST"); + emsRegisterInfo.setVendor("ZTE"); + emsRegisterInfo.setVersion("V1"); + emsRegisterInfo.setAlarmAddr(alarmAddr); + emsRegisterInfo.setResourceAddr(resourceAddr); + emsRegisterInfo.setPerformanceAddr(performanceAddr); + esrEms = emsManagerUtil.emsRegisterInfo2EsrEms(emsRegisterInfo); + esrEms.setEmsId("123456"); + esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("234567"); + esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(1).setEsrSystemInfoId("345678"); + esrEms.getEsrSystemInfoList().getEsrSystemInfo().get(2).setEsrSystemInfoId("456789"); + String esremsStr = new ExtsysUtil().objectToString(esrEms); + String expect = "{\"ems-id\":\"123456\"," + "\"esr-system-info-list\":" + "{\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"234567\"," + "\"system-name\":\"EMS_TEST\"," + "\"type\":\"sftp\"," + + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + "\"user-name\":\"nancy\"," + "\"password\":\"asdf\"," + + "\"system-type\":\"EMS_RESOUCE\"," + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + + "\"passive\":true," + "\"remote-path\":\"/home/per\"}," + "{\"esr-system-info-id\":\"345678\"," + + "\"system-name\":\"EMS_TEST\"," + "\"type\":\"sftp\"," + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"asdf\"," + "\"system-type\":\"EMS_PERFORMANCE\"," + + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + "\"passive\":true," + + "\"remote-path\":\"/home/per\"}," + "{\"esr-system-info-id\":\"456789\"," + + "\"system-name\":\"EMS_TEST\"," + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"987654\"," + "\"system-type\":\"EMS_ALARM\"," + + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"}]}}"; + assertEquals(expect, esremsStr); + } + + @Test + public void EsrEms2EmsRegisterInfoTest() { + EsrEmsDetail esrEms = new EsrEmsDetail(); + EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo(); + EmsManagerUtil emsManagerUtil = new EmsManagerUtil(); + String esrEmsStr = "{\"ems-id\":\"123456\"," + "\"esr-system-info-list\":" + "{\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"234567\"," + "\"system-name\":\"EMS_TEST\"," + "\"type\":\"sftp\"," + + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + "\"user-name\":\"nancy\"," + "\"password\":\"asdf\"," + + "\"system-type\":\"EMS_RESOUCE\"," + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + + "\"passive\":true," + "\"remote-path\":\"/home/per\"}," + "{\"esr-system-info-id\":\"345678\"," + + "\"system-name\":\"EMS_TEST\"," + "\"type\":\"sftp\"," + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"asdf\"," + "\"system-type\":\"EMS_PERFORMANCE\"," + + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + "\"passive\":true," + + "\"remote-path\":\"/home/per\"}," + "{\"esr-system-info-id\":\"456789\"," + + "\"system-name\":\"EMS_TEST\"," + "\"vendor\":\"ZTE\"," + "\"version\":\"V1\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"987654\"," + "\"system-type\":\"EMS_ALARM\"," + + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"}]}}"; + esrEms = new Gson().fromJson(esrEmsStr, EsrEmsDetail.class); + emsRegisterInfo = emsManagerUtil.EsrEms2EmsRegisterInfo(esrEms); + String registerInfoStr = new ExtsysUtil().objectToString(emsRegisterInfo); + String expectRegisterInfo = "{\"emsId\":\"123456\"," + "\"name\":\"EMS_TEST\"," + "\"vendor\":\"ZTE\"," + + "\"version\":\"V1\"," + "\"resourceAddr\":{" + "\"ftptype\":\"sftp\"," + "\"ip\":\"127.0.0.1\"," + + "\"port\":\"5000\"," + "\"user\":\"nancy\"," + "\"password\":\"asdf\"," + + "\"remotepath\":\"/home/per\"," + "\"passive\":true}," + "\"performanceAddr\":{" + + "\"ftptype\":\"sftp\"," + "\"ip\":\"127.0.0.1\"," + "\"port\":\"5000\"," + "\"user\":\"nancy\"," + + "\"password\":\"asdf\"," + "\"remotepath\":\"/home/per\"," + "\"passive\":true}," + "\"alarmAddr\":{" + + "\"ip\":\"127.0.0.1\"," + "\"port\":\"5000\"," + "\"user\":\"nancy\"," + "\"password\":\"987654\"}}"; + assertEquals(registerInfoStr, expectRegisterInfo); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/ExtsysUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/ExtsysUtilTest.java index 7e71571..08468ed 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/util/ExtsysUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/ExtsysUtilTest.java @@ -16,125 +16,97 @@ package org.onap.aai.esr.util; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.onap.aai.esr.entity.aai.EsrSystemInfo; import org.onap.aai.esr.entity.aai.EsrSystemInfoList; import org.onap.aai.esr.externalservice.cloud.Tenant; public class ExtsysUtilTest { - - @Test - public void objectToStringTest() { - ExtsysUtil extsysUtil = new ExtsysUtil(); - Tenant tenant = new Tenant(); - tenant.setDefaultTenant("admin"); - String tenantStr = "{\"defaultTenant\":\"admin\"}"; - String result = extsysUtil.objectToString(tenant); - assertEquals(tenantStr, result); - } - - - @Test - public void getEsrSystemInfoListFromAuthInfoTest() { - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - ExtsysUtil extsysUtil = new ExtsysUtil(); - EsrSystemInfoList result = new EsrSystemInfoList(); - esrSystemInfoObj.setCloudDomain("cloudDomain"); - esrSystemInfoObj.setDefaultTenant("admin"); - esrSystemInfoObj.setEsrSystemInfoId("123456"); - esrSystemInfoObj.setIpAddress("127.0.0.1"); - esrSystemInfoObj.setPassive(true); - esrSystemInfoObj.setPassword("qwelk"); - esrSystemInfoObj.setPort("5000"); - esrSystemInfoObj.setProtocol("http"); - esrSystemInfoObj.setRemotePath("/root/test"); - esrSystemInfoObj.setServiceUrl("http://127.0.0.1:8080"); - esrSystemInfoObj.setSslCassert("sslCassert"); - esrSystemInfoObj.setSslInsecure(false); - esrSystemInfoObj.setSystemName("vnfm"); - esrSystemInfoObj.setSystemStatus("normal"); - esrSystemInfoObj.setSystemType("VNFM"); - esrSystemInfoObj.setType("test"); - esrSystemInfoObj.setUserName("root"); - esrSystemInfoObj.setVendor("zte"); - esrSystemInfoObj.setVersion("v1.0"); - result = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); - - String listStr = "{\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"123456\"," - + "\"system-name\":\"vnfm\"," - + "\"type\":\"test\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1.0\"," - + "\"service-url\":\"http://127.0.0.1:8080\"," - + "\"user-name\":\"root\"," - + "\"password\":\"qwelk\"," - + "\"system-type\":\"VNFM\"," - + "\"protocol\":\"http\"," - + "\"ssl-cassert\":\"sslCassert\"," - + "\"ssl-insecure\":false," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"cloud-domain\":\"cloudDomain\"," - + "\"default-tenant\":\"admin\"," - + "\"passive\":true," - + "\"remote-path\":\"/root/test\"," - + "\"system-status\":\"normal\"}]}"; - assertEquals(extsysUtil.objectToString(result), listStr); - } - - @Test - public void getEsrSystemInfoListFromAuthInfoListTest() { - List esrSystemInfos = new ArrayList<>(); - EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); - EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); - ExtsysUtil extsysUtil = new ExtsysUtil(); - esrSystemInfoObj.setCloudDomain("cloudDomain"); - esrSystemInfoObj.setDefaultTenant("admin"); - esrSystemInfoObj.setEsrSystemInfoId("123456"); - esrSystemInfoObj.setIpAddress("127.0.0.1"); - esrSystemInfoObj.setPassive(true); - esrSystemInfoObj.setPassword("qwelk"); - esrSystemInfoObj.setPort("5000"); - esrSystemInfoObj.setProtocol("http"); - esrSystemInfoObj.setRemotePath("/root/test"); - esrSystemInfoObj.setServiceUrl("http://127.0.0.1:8080"); - esrSystemInfoObj.setSslCassert("sslCassert"); - esrSystemInfoObj.setSslInsecure(false); - esrSystemInfoObj.setSystemName("vnfm"); - esrSystemInfoObj.setSystemStatus("normal"); - esrSystemInfoObj.setSystemType("VNFM"); - esrSystemInfoObj.setType("test"); - esrSystemInfoObj.setUserName("root"); - esrSystemInfoObj.setVendor("zte"); - esrSystemInfoObj.setVersion("v1.0"); - esrSystemInfos.add(esrSystemInfoObj); - esrSystemInfoList.setEsrSystemInfo(esrSystemInfos); - - String listStr = "{\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"123456\"," - + "\"system-name\":\"vnfm\"," - + "\"type\":\"test\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1.0\"," - + "\"service-url\":\"http://127.0.0.1:8080\"," - + "\"user-name\":\"root\"," - + "\"password\":\"qwelk\"," - + "\"system-type\":\"VNFM\"," - + "\"protocol\":\"http\"," - + "\"ssl-cassert\":\"sslCassert\"," - + "\"ssl-insecure\":false," - + "\"ip-address\":\"127.0.0.1\"," - + "\"port\":\"5000\"," - + "\"cloud-domain\":\"cloudDomain\"," - + "\"default-tenant\":\"admin\"," - + "\"passive\":true," - + "\"remote-path\":\"/root/test\"," - + "\"system-status\":\"normal\"}]}"; - assertEquals(extsysUtil.objectToString(esrSystemInfoList), listStr); - } + + @Test + public void objectToStringTest() { + ExtsysUtil extsysUtil = new ExtsysUtil(); + Tenant tenant = new Tenant(); + tenant.setDefaultTenant("admin"); + String tenantStr = "{\"defaultTenant\":\"admin\"}"; + String result = extsysUtil.objectToString(tenant); + assertEquals(tenantStr, result); + } + + + @Test + public void getEsrSystemInfoListFromAuthInfoTest() { + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + ExtsysUtil extsysUtil = new ExtsysUtil(); + EsrSystemInfoList result = new EsrSystemInfoList(); + esrSystemInfoObj.setCloudDomain("cloudDomain"); + esrSystemInfoObj.setDefaultTenant("admin"); + esrSystemInfoObj.setEsrSystemInfoId("123456"); + esrSystemInfoObj.setIpAddress("127.0.0.1"); + esrSystemInfoObj.setPassive(true); + esrSystemInfoObj.setPassword("qwelk"); + esrSystemInfoObj.setPort("5000"); + esrSystemInfoObj.setProtocol("http"); + esrSystemInfoObj.setRemotePath("/root/test"); + esrSystemInfoObj.setServiceUrl("http://127.0.0.1:8080"); + esrSystemInfoObj.setSslCassert("sslCassert"); + esrSystemInfoObj.setSslInsecure(false); + esrSystemInfoObj.setSystemName("vnfm"); + esrSystemInfoObj.setSystemStatus("normal"); + esrSystemInfoObj.setSystemType("VNFM"); + esrSystemInfoObj.setType("test"); + esrSystemInfoObj.setUserName("root"); + esrSystemInfoObj.setVendor("zte"); + esrSystemInfoObj.setVersion("v1.0"); + result = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj); + + String listStr = "{\"esr-system-info\":[{" + "\"esr-system-info-id\":\"123456\"," + "\"system-name\":\"vnfm\"," + + "\"type\":\"test\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1.0\"," + + "\"service-url\":\"http://127.0.0.1:8080\"," + "\"user-name\":\"root\"," + "\"password\":\"qwelk\"," + + "\"system-type\":\"VNFM\"," + "\"protocol\":\"http\"," + "\"ssl-cassert\":\"sslCassert\"," + + "\"ssl-insecure\":false," + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + + "\"cloud-domain\":\"cloudDomain\"," + "\"default-tenant\":\"admin\"," + "\"passive\":true," + + "\"remote-path\":\"/root/test\"," + "\"system-status\":\"normal\"}]}"; + assertEquals(extsysUtil.objectToString(result), listStr); + } + + @Test + public void getEsrSystemInfoListFromAuthInfoListTest() { + List esrSystemInfos = new ArrayList<>(); + EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList(); + EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo(); + ExtsysUtil extsysUtil = new ExtsysUtil(); + esrSystemInfoObj.setCloudDomain("cloudDomain"); + esrSystemInfoObj.setDefaultTenant("admin"); + esrSystemInfoObj.setEsrSystemInfoId("123456"); + esrSystemInfoObj.setIpAddress("127.0.0.1"); + esrSystemInfoObj.setPassive(true); + esrSystemInfoObj.setPassword("qwelk"); + esrSystemInfoObj.setPort("5000"); + esrSystemInfoObj.setProtocol("http"); + esrSystemInfoObj.setRemotePath("/root/test"); + esrSystemInfoObj.setServiceUrl("http://127.0.0.1:8080"); + esrSystemInfoObj.setSslCassert("sslCassert"); + esrSystemInfoObj.setSslInsecure(false); + esrSystemInfoObj.setSystemName("vnfm"); + esrSystemInfoObj.setSystemStatus("normal"); + esrSystemInfoObj.setSystemType("VNFM"); + esrSystemInfoObj.setType("test"); + esrSystemInfoObj.setUserName("root"); + esrSystemInfoObj.setVendor("zte"); + esrSystemInfoObj.setVersion("v1.0"); + esrSystemInfos.add(esrSystemInfoObj); + esrSystemInfoList.setEsrSystemInfo(esrSystemInfos); + + String listStr = "{\"esr-system-info\":[{" + "\"esr-system-info-id\":\"123456\"," + "\"system-name\":\"vnfm\"," + + "\"type\":\"test\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1.0\"," + + "\"service-url\":\"http://127.0.0.1:8080\"," + "\"user-name\":\"root\"," + "\"password\":\"qwelk\"," + + "\"system-type\":\"VNFM\"," + "\"protocol\":\"http\"," + "\"ssl-cassert\":\"sslCassert\"," + + "\"ssl-insecure\":false," + "\"ip-address\":\"127.0.0.1\"," + "\"port\":\"5000\"," + + "\"cloud-domain\":\"cloudDomain\"," + "\"default-tenant\":\"admin\"," + "\"passive\":true," + + "\"remote-path\":\"/root/test\"," + "\"system-status\":\"normal\"}]}"; + assertEquals(extsysUtil.objectToString(esrSystemInfoList), listStr); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtilTest.java index 8c616b6..1df5cbd 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/ThirdpartySdncManagerUtilTest.java @@ -16,85 +16,58 @@ package org.onap.aai.esr.util; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.aai.esr.entity.aai.EsrThirdpartySdncDetail; import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo; - import com.google.gson.Gson; public class ThirdpartySdncManagerUtilTest { - - @Test - public void sdncRegisterInfo2EsrSdncTest() { - ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); - sdncRegisterInfo.setLocation("edge"); - sdncRegisterInfo.setName("SDNC_TEST"); - sdncRegisterInfo.setPassword("123987"); - sdncRegisterInfo.setProductName("thirdparty SDNC"); - sdncRegisterInfo.setProtocol("protocol"); - sdncRegisterInfo.setThirdpartySdncId("123456"); - sdncRegisterInfo.setType("SDNC"); - sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); - sdncRegisterInfo.setUserName("nancy"); - sdncRegisterInfo.setVendor("zte"); - sdncRegisterInfo.setVersion("v1"); - esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(sdncRegisterInfo); - esrSdncDetail.setThirdpartySdncId("123456"); - esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("987654"); - String esrSdncDetailStr = new ExtsysUtil().objectToString(esrSdncDetail); - String expectResult = "{\"thirdparty-sdnc-id\":\"123456\"," - + "\"location\":\"edge\"," - + "\"product-name\":\"thirdparty SDNC\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"987654\"," - + "\"system-name\":\"SDNC_TEST\"," - + "\"type\":\"SDNC\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://127.0.0.1:8000\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"123987\"," - + "\"system-type\":\"thirdparty_SDNC\"," - + "\"protocol\":\"protocol\"}]}}"; - assertEquals(expectResult, esrSdncDetailStr); - } - - @Test - public void esrSdnc2SdncRegisterInfoTest() { - EsrThirdpartySdncDetail esrSdnc = new EsrThirdpartySdncDetail(); - String esrSdncStr = "{\"thirdparty-sdnc-id\":\"123456\"," - + "\"location\":\"edge\"," - + "\"product-name\":\"thirdparty SDNC\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":" - + "[{\"esr-system-info-id\":\"987654\"," - + "\"system-name\":\"SDNC_TEST\"," - + "\"type\":\"SDNC\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://127.0.0.1:8000\"," - + "\"user-name\":\"nancy\"," - + "\"password\":\"123987\"," - + "\"system-type\":\"thirdparty_SDNC\"," - + "\"protocol\":\"protocol\"}]}}"; - esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); - ThirdpartySdncRegisterInfo registerInfo = new ThirdpartySdncManagerUtil().esrSdnc2SdncRegisterInfo(esrSdnc); - String registerInfoStr = new ExtsysUtil().objectToString(registerInfo); - String expectResult = "{\"thirdpartySdncId\":\"123456\"," - + "\"name\":\"SDNC_TEST\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"type\":\"SDNC\"," - + "\"location\":\"edge\"," - + "\"url\":\"http://127.0.0.1:8000\"," - + "\"userName\":\"nancy\"," - + "\"password\":\"123987\"," - + "\"productName\":\"thirdparty SDNC\"," - + "\"protocol\":\"protocol\"}"; - assertEquals(expectResult, registerInfoStr); - } + + @Test + public void sdncRegisterInfo2EsrSdncTest() { + ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil(); + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + EsrThirdpartySdncDetail esrSdncDetail = new EsrThirdpartySdncDetail(); + sdncRegisterInfo.setLocation("edge"); + sdncRegisterInfo.setName("SDNC_TEST"); + sdncRegisterInfo.setPassword("123987"); + sdncRegisterInfo.setProductName("thirdparty SDNC"); + sdncRegisterInfo.setProtocol("protocol"); + sdncRegisterInfo.setThirdpartySdncId("123456"); + sdncRegisterInfo.setType("SDNC"); + sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); + sdncRegisterInfo.setUserName("nancy"); + sdncRegisterInfo.setVendor("zte"); + sdncRegisterInfo.setVersion("v1"); + esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(sdncRegisterInfo); + esrSdncDetail.setThirdpartySdncId("123456"); + esrSdncDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("987654"); + String esrSdncDetailStr = new ExtsysUtil().objectToString(esrSdncDetail); + String expectResult = "{\"thirdparty-sdnc-id\":\"123456\"," + "\"location\":\"edge\"," + + "\"product-name\":\"thirdparty SDNC\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"987654\"," + "\"system-name\":\"SDNC_TEST\"," + "\"type\":\"SDNC\"," + + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + "\"service-url\":\"http://127.0.0.1:8000\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"123987\"," + "\"system-type\":\"thirdparty_SDNC\"," + + "\"protocol\":\"protocol\"}]}}"; + assertEquals(expectResult, esrSdncDetailStr); + } + + @Test + public void esrSdnc2SdncRegisterInfoTest() { + EsrThirdpartySdncDetail esrSdnc = new EsrThirdpartySdncDetail(); + String esrSdncStr = "{\"thirdparty-sdnc-id\":\"123456\"," + "\"location\":\"edge\"," + + "\"product-name\":\"thirdparty SDNC\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":" + + "[{\"esr-system-info-id\":\"987654\"," + "\"system-name\":\"SDNC_TEST\"," + "\"type\":\"SDNC\"," + + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + "\"service-url\":\"http://127.0.0.1:8000\"," + + "\"user-name\":\"nancy\"," + "\"password\":\"123987\"," + "\"system-type\":\"thirdparty_SDNC\"," + + "\"protocol\":\"protocol\"}]}}"; + esrSdnc = new Gson().fromJson(esrSdncStr, EsrThirdpartySdncDetail.class); + ThirdpartySdncRegisterInfo registerInfo = new ThirdpartySdncManagerUtil().esrSdnc2SdncRegisterInfo(esrSdnc); + String registerInfoStr = new ExtsysUtil().objectToString(registerInfo); + String expectResult = "{\"thirdpartySdncId\":\"123456\"," + "\"name\":\"SDNC_TEST\"," + "\"vendor\":\"zte\"," + + "\"version\":\"v1\"," + "\"type\":\"SDNC\"," + "\"location\":\"edge\"," + + "\"url\":\"http://127.0.0.1:8000\"," + "\"userName\":\"nancy\"," + "\"password\":\"123987\"," + + "\"productName\":\"thirdparty SDNC\"," + "\"protocol\":\"protocol\"}"; + assertEquals(expectResult, registerInfoStr); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/VimManagerUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/VimManagerUtilTest.java index 202368f..9426753 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/util/VimManagerUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/VimManagerUtilTest.java @@ -16,115 +16,78 @@ package org.onap.aai.esr.util; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import org.junit.Test; import org.onap.aai.esr.entity.aai.CloudRegionDetail; import org.onap.aai.esr.entity.rest.VimAuthInfo; import org.onap.aai.esr.entity.rest.VimRegisterInfo; - import com.google.gson.Gson; public class VimManagerUtilTest { - - @Test - public void vimRegisterInfo2CloudRegionTest() { - VimManagerUtil vimManagerUtil = new VimManagerUtil(); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - List vimAuthInfos = new ArrayList<>(); - VimAuthInfo vimAuthInfo = new VimAuthInfo(); - vimAuthInfo.setAuthUrl("http://10.11.22.33:5000/v3"); - vimAuthInfo.setCloudDomain("default"); - vimAuthInfo.setPassword("123456"); - vimAuthInfo.setSslCacert("test"); - vimAuthInfo.setSslInsecure(true); - vimAuthInfo.setUserName("onap"); - vimAuthInfo.setDefaultTenant("admin"); - vimRegisterInfo.setCloudExtraInfo("{}"); - vimRegisterInfo.setCloudOwner("zte"); - vimRegisterInfo.setCloudRegionId("RegionOne"); - vimRegisterInfo.setCloudRegionVersion("mitaca"); - vimRegisterInfo.setCloudType("openstack"); - vimRegisterInfo.setCloudZone("default"); - vimRegisterInfo.setComplexName("complex"); - vimRegisterInfo.setOwnerDefinedType("test"); - vimRegisterInfo.setStatus("normal"); - vimAuthInfos.add(vimAuthInfo); - vimRegisterInfo.setVimAuthInfos(vimAuthInfos); - cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); - cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("123456"); - String cloudRegionDetailStr = new ExtsysUtil().objectToString(cloudRegionDetail); - String expectResult = "{\"cloud-owner\":\"zte\"," - + "\"cloud-region-id\":\"RegionOne\"," - + "\"cloud-type\":\"openstack\"," - + "\"cloud-region-version\":\"mitaca\"," - + "\"owner-defined-type\":\"test\"," - + "\"cloud-zone\":\"default\"," - + "\"complex-name\":\"complex\"," - + "\"cloud-extra-info\":\"{}\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"123456\"," - + "\"service-url\":\"http://10.11.22.33:5000/v3\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"123456\"," - + "\"system-type\":\"VIM\"," - + "\"ssl-cassert\":\"test\"," - + "\"ssl-insecure\":true," - + "\"cloud-domain\":\"default\"," - + "\"default-tenant\":\"admin\"," - + "\"system-status\":\"normal\"}]}}"; - assertEquals(expectResult, cloudRegionDetailStr); - } - - @Test - public void cloudRegion2VimRegisterInfoTest() { - VimManagerUtil vimManagerUtil = new VimManagerUtil(); - CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); - VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); - String cloudRegionDetailStr = "{\"cloud-owner\":\"zte\"," - + "\"cloud-region-id\":\"RegionOne\"," - + "\"cloud-type\":\"openstack\"," - + "\"cloud-region-version\":\"mitaca\"," - + "\"owner-defined-type\":\"test\"," - + "\"cloud-zone\":\"default\"," - + "\"complex-name\":\"complex\"," - + "\"cloud-extra-info\":\"{}\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"123456\"," - + "\"service-url\":\"http://10.11.22.33:5000/v3\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"123456\"," - + "\"default-tenant\":\"admin\"," - + "\"system-type\":\"VIM\"," - + "\"ssl-cassert\":\"test\"," - + "\"ssl-insecure\":true," - + "\"cloud-domain\":\"default\"," - + "\"system-status\":\"normal\"}]}}"; - cloudRegionDetail = new Gson().fromJson(cloudRegionDetailStr, CloudRegionDetail.class); - vimRegisterInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); - String vimRegisterInfoStr = new ExtsysUtil().objectToString(vimRegisterInfo); - String expectResult = "{\"cloudOwner\":\"zte\"," - + "\"cloudRegionId\":\"RegionOne\"," - + "\"cloudType\":\"openstack\"," - + "\"cloudRegionVersion\":\"mitaca\"," - + "\"ownerDefinedType\":\"test\"," - + "\"cloudZone\":\"default\"," - + "\"complexName\":\"complex\"," - + "\"cloudExtraInfo\":\"{}\"," - + "\"status\":\"normal\"," - + "\"vimAuthInfos\":[{" - + "\"cloudDomain\":\"default\"," - + "\"userName\":\"onap\"," - + "\"password\":\"123456\"," - + "\"authUrl\":\"http://10.11.22.33:5000/v3\"," - + "\"defaultTenant\":\"admin\"," - + "\"sslCacert\":\"test\"," - + "\"sslInsecure\":true}]}"; - assertEquals(expectResult, vimRegisterInfoStr); - } + + @Test + public void vimRegisterInfo2CloudRegionTest() { + VimManagerUtil vimManagerUtil = new VimManagerUtil(); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + List vimAuthInfos = new ArrayList<>(); + VimAuthInfo vimAuthInfo = new VimAuthInfo(); + vimAuthInfo.setAuthUrl("http://10.11.22.33:5000/v3"); + vimAuthInfo.setCloudDomain("default"); + vimAuthInfo.setPassword("123456"); + vimAuthInfo.setSslCacert("test"); + vimAuthInfo.setSslInsecure(true); + vimAuthInfo.setUserName("onap"); + vimAuthInfo.setDefaultTenant("admin"); + vimRegisterInfo.setCloudExtraInfo("{}"); + vimRegisterInfo.setCloudOwner("zte"); + vimRegisterInfo.setCloudRegionId("RegionOne"); + vimRegisterInfo.setCloudRegionVersion("mitaca"); + vimRegisterInfo.setCloudType("openstack"); + vimRegisterInfo.setCloudZone("default"); + vimRegisterInfo.setComplexName("complex"); + vimRegisterInfo.setOwnerDefinedType("test"); + vimRegisterInfo.setStatus("normal"); + vimAuthInfos.add(vimAuthInfo); + vimRegisterInfo.setVimAuthInfos(vimAuthInfos); + cloudRegionDetail = vimManagerUtil.vimRegisterInfo2CloudRegion(vimRegisterInfo); + cloudRegionDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("123456"); + String cloudRegionDetailStr = new ExtsysUtil().objectToString(cloudRegionDetail); + String expectResult = "{\"cloud-owner\":\"zte\"," + "\"cloud-region-id\":\"RegionOne\"," + + "\"cloud-type\":\"openstack\"," + "\"cloud-region-version\":\"mitaca\"," + + "\"owner-defined-type\":\"test\"," + "\"cloud-zone\":\"default\"," + "\"complex-name\":\"complex\"," + + "\"cloud-extra-info\":\"{}\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":[{" + + "\"esr-system-info-id\":\"123456\"," + "\"service-url\":\"http://10.11.22.33:5000/v3\"," + + "\"user-name\":\"onap\"," + "\"password\":\"123456\"," + "\"system-type\":\"VIM\"," + + "\"ssl-cassert\":\"test\"," + "\"ssl-insecure\":true," + "\"cloud-domain\":\"default\"," + + "\"default-tenant\":\"admin\"," + "\"system-status\":\"normal\"}]}}"; + assertEquals(expectResult, cloudRegionDetailStr); + } + + @Test + public void cloudRegion2VimRegisterInfoTest() { + VimManagerUtil vimManagerUtil = new VimManagerUtil(); + CloudRegionDetail cloudRegionDetail = new CloudRegionDetail(); + VimRegisterInfo vimRegisterInfo = new VimRegisterInfo(); + String cloudRegionDetailStr = "{\"cloud-owner\":\"zte\"," + "\"cloud-region-id\":\"RegionOne\"," + + "\"cloud-type\":\"openstack\"," + "\"cloud-region-version\":\"mitaca\"," + + "\"owner-defined-type\":\"test\"," + "\"cloud-zone\":\"default\"," + "\"complex-name\":\"complex\"," + + "\"cloud-extra-info\":\"{}\"," + "\"esr-system-info-list\":{" + "\"esr-system-info\":[{" + + "\"esr-system-info-id\":\"123456\"," + "\"service-url\":\"http://10.11.22.33:5000/v3\"," + + "\"user-name\":\"onap\"," + "\"password\":\"123456\"," + "\"default-tenant\":\"admin\"," + + "\"system-type\":\"VIM\"," + "\"ssl-cassert\":\"test\"," + "\"ssl-insecure\":true," + + "\"cloud-domain\":\"default\"," + "\"system-status\":\"normal\"}]}}"; + cloudRegionDetail = new Gson().fromJson(cloudRegionDetailStr, CloudRegionDetail.class); + vimRegisterInfo = vimManagerUtil.cloudRegion2VimRegisterInfo(cloudRegionDetail); + String vimRegisterInfoStr = new ExtsysUtil().objectToString(vimRegisterInfo); + String expectResult = "{\"cloudOwner\":\"zte\"," + "\"cloudRegionId\":\"RegionOne\"," + + "\"cloudType\":\"openstack\"," + "\"cloudRegionVersion\":\"mitaca\"," + + "\"ownerDefinedType\":\"test\"," + "\"cloudZone\":\"default\"," + "\"complexName\":\"complex\"," + + "\"cloudExtraInfo\":\"{}\"," + "\"status\":\"normal\"," + "\"vimAuthInfos\":[{" + + "\"cloudDomain\":\"default\"," + "\"userName\":\"onap\"," + "\"password\":\"123456\"," + + "\"authUrl\":\"http://10.11.22.33:5000/v3\"," + "\"defaultTenant\":\"admin\"," + + "\"sslCacert\":\"test\"," + "\"sslInsecure\":true}]}"; + assertEquals(expectResult, vimRegisterInfoStr); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/util/VnfmManagerUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/VnfmManagerUtilTest.java index bc7eea1..db888bd 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/util/VnfmManagerUtilTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/util/VnfmManagerUtilTest.java @@ -16,82 +16,58 @@ package org.onap.aai.esr.util; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.aai.esr.entity.aai.EsrVnfmDetail; import org.onap.aai.esr.entity.rest.VnfmRegisterInfo; - import com.google.gson.Gson; public class VnfmManagerUtilTest { - @Test - public void vnfmRegisterInfo2EsrVnfmTest() { - VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - vnfmRegisterInfo.setVimId("987654"); - vnfmRegisterInfo.setVersion("v1"); - vnfmRegisterInfo.setVendor("zte"); - vnfmRegisterInfo.setUserName("onap"); - vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); - vnfmRegisterInfo.setType("vnfm"); - vnfmRegisterInfo.setPassword("987654"); - vnfmRegisterInfo.setName("ONAP VNFM"); - vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); - esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfmRegisterInfo); - esrVnfmDetail.setVnfmId("123456"); - esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("qwerty"); - String esrVnfmDetailStr = new ExtsysUtil().objectToString(esrVnfmDetail); - String expectResult = "{\"vnfm-id\":\"123456\"," - + "\"vim-id\":\"987654\"," - + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"qwerty\"," - + "\"system-name\":\"ONAP VNFM\"," - + "\"type\":\"vnfm\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://10.11.22.33:8000\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"VNFM\"}]}}"; - assertEquals(expectResult, esrVnfmDetailStr); - } - - @Test - public void esrVnfm2VnfmRegisterInfoTest() { - VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); - String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," - + "\"vim-id\":\"987654\"," - + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," - + "\"esr-system-info-list\":{" - + "\"esr-system-info\":[{" - + "\"esr-system-info-id\":\"qwerty\"," - + "\"system-name\":\"ONAP VNFM\"," - + "\"type\":\"vnfm\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"service-url\":\"http://10.11.22.33:8000\"," - + "\"user-name\":\"onap\"," - + "\"password\":\"987654\"," - + "\"system-type\":\"VNFM\"}]}}"; - esrVnfmDetail = new Gson().fromJson(esrVnfmDetailStr, EsrVnfmDetail.class); - vnfmRegisterInfo = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); - String vnfmRegisterInfoStr = new ExtsysUtil().objectToString(vnfmRegisterInfo); - String expectResult = "{\"vnfmId\":\"123456\"," - + "\"name\":\"ONAP VNFM\"," - + "\"type\":\"vnfm\"," - + "\"vimId\":\"987654\"," - + "\"vendor\":\"zte\"," - + "\"version\":\"v1\"," - + "\"certificateUrl\":\"http://11.22.33.44:5000/v3\"," - + "\"url\":\"http://10.11.22.33:8000\"," - + "\"userName\":\"onap\"," - + "\"password\":\"987654\"}"; - assertEquals(expectResult, vnfmRegisterInfoStr); - } + @Test + public void vnfmRegisterInfo2EsrVnfmTest() { + VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + esrVnfmDetail = vnfmManagerUtil.vnfmRegisterInfo2EsrVnfm(vnfmRegisterInfo); + esrVnfmDetail.setVnfmId("123456"); + esrVnfmDetail.getEsrSystemInfoList().getEsrSystemInfo().get(0).setEsrSystemInfoId("qwerty"); + String esrVnfmDetailStr = new ExtsysUtil().objectToString(esrVnfmDetail); + String expectResult = "{\"vnfm-id\":\"123456\"," + "\"vim-id\":\"987654\"," + + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," + "\"esr-system-info-list\":{" + + "\"esr-system-info\":[{" + "\"esr-system-info-id\":\"qwerty\"," + "\"system-name\":\"ONAP VNFM\"," + + "\"type\":\"vnfm\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + + "\"service-url\":\"http://10.11.22.33:8000\"," + "\"user-name\":\"onap\"," + + "\"password\":\"987654\"," + "\"system-type\":\"VNFM\"}]}}"; + assertEquals(expectResult, esrVnfmDetailStr); + } + + @Test + public void esrVnfm2VnfmRegisterInfoTest() { + VnfmManagerUtil vnfmManagerUtil = new VnfmManagerUtil(); + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + EsrVnfmDetail esrVnfmDetail = new EsrVnfmDetail(); + String esrVnfmDetailStr = "{\"vnfm-id\":\"123456\"," + "\"vim-id\":\"987654\"," + + "\"certificate-url\":\"http://11.22.33.44:5000/v3\"," + "\"esr-system-info-list\":{" + + "\"esr-system-info\":[{" + "\"esr-system-info-id\":\"qwerty\"," + "\"system-name\":\"ONAP VNFM\"," + + "\"type\":\"vnfm\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + + "\"service-url\":\"http://10.11.22.33:8000\"," + "\"user-name\":\"onap\"," + + "\"password\":\"987654\"," + "\"system-type\":\"VNFM\"}]}}"; + esrVnfmDetail = new Gson().fromJson(esrVnfmDetailStr, EsrVnfmDetail.class); + vnfmRegisterInfo = vnfmManagerUtil.esrVnfm2VnfmRegisterInfo(esrVnfmDetail); + String vnfmRegisterInfoStr = new ExtsysUtil().objectToString(vnfmRegisterInfo); + String expectResult = "{\"vnfmId\":\"123456\"," + "\"name\":\"ONAP VNFM\"," + "\"type\":\"vnfm\"," + + "\"vimId\":\"987654\"," + "\"vendor\":\"zte\"," + "\"version\":\"v1\"," + + "\"certificateUrl\":\"http://11.22.33.44:5000/v3\"," + "\"url\":\"http://10.11.22.33:8000\"," + + "\"userName\":\"onap\"," + "\"password\":\"987654\"}"; + assertEquals(expectResult, vnfmRegisterInfoStr); + } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/EmsManagerWrapperTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/EmsManagerWrapperTest.java new file mode 100644 index 0000000..78237d7 --- /dev/null +++ b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/EmsManagerWrapperTest.java @@ -0,0 +1,37 @@ +/** + * Copyright 2018 ZTE Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.aai.esr.wrapper; + +import org.junit.Before; +import org.junit.Test; +import org.onap.aai.esr.common.MsbConfig; + +public class EmsManagerWrapperTest { + private static EmsManagerWrapper emsManagerWrapper; + static { + MsbConfig.setMsbServerAddr("http://127.0.0.1:80"); + } + + @Before + public void setUp() throws Exception { + emsManagerWrapper = EmsManagerWrapper.getInstance(); + } + + @Test + public void test_registerEms() { + + } +} diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapperTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapperTest.java index 6afd179..e39adc7 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapperTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapperTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2018 ZTE Corporation. * * 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,9 @@ package org.onap.aai.esr.wrapper; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -32,117 +29,117 @@ import org.onap.aai.esr.util.ExtsysUtil; public class ThirdpartySdncWrapperTest { - private static ThirdpartySdncWrapper thirdpartySdncWrapper; - static { - MsbConfig.setMsbServerAddr("http://127.0.0.1:80"); - } - - @Before - public void setUp() throws Exception { - thirdpartySdncWrapper = ThirdpartySdncWrapper.getInstance(); - } - - @Test - public void test_registerThirdpartySdnc() { - ExternalSystemProxy.isTest = true; - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - sdncRegisterInfo.setLocation("edge"); - sdncRegisterInfo.setName("SDNC_TEST"); - sdncRegisterInfo.setPassword("123987"); - sdncRegisterInfo.setProductName("thirdparty SDNC"); - sdncRegisterInfo.setProtocol("protocol"); - sdncRegisterInfo.setThirdpartySdncId("123456"); - sdncRegisterInfo.setType("SDNC"); - sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); - sdncRegisterInfo.setUserName("nancy"); - sdncRegisterInfo.setVendor("zte"); - sdncRegisterInfo.setVersion("v1"); - Response response = thirdpartySdncWrapper.registerThirdpartySdnc(sdncRegisterInfo); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); + private static ThirdpartySdncWrapper thirdpartySdncWrapper; + static { + MsbConfig.setMsbServerAddr("http://127.0.0.1:80"); } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_delThirdpartySdnc() { - ExternalSystemProxy.isTest = true; - Response response = thirdpartySdncWrapper.delThirdpartySdnc("123456"); - if (response != null) { - Assert.assertTrue(response.getStatus() == 204); + + @Before + public void setUp() throws Exception { + thirdpartySdncWrapper = ThirdpartySdncWrapper.getInstance(); } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_queryThirdpartySdncById() { - ExternalSystemProxy.isTest = true; - ExtsysUtil extsysUtil = new ExtsysUtil(); - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - sdncRegisterInfo.setLocation("edge"); - sdncRegisterInfo.setName("SDNC_TEST"); - sdncRegisterInfo.setPassword("123987"); - sdncRegisterInfo.setProductName("thirdparty SDNC"); - sdncRegisterInfo.setProtocol("protocol"); - sdncRegisterInfo.setThirdpartySdncId("123456"); - sdncRegisterInfo.setType("SDNC"); - sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); - sdncRegisterInfo.setUserName("nancy"); - sdncRegisterInfo.setVendor("zte"); - sdncRegisterInfo.setVersion("v1"); - Response response = thirdpartySdncWrapper.queryThirdpartySdncById("123456"); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); - assertEquals(extsysUtil.objectToString(sdncRegisterInfo), extsysUtil.objectToString(response.getEntity())); + + @Test + public void test_registerThirdpartySdnc() { + ExternalSystemProxy.isTest = true; + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + sdncRegisterInfo.setLocation("edge"); + sdncRegisterInfo.setName("SDNC_TEST"); + sdncRegisterInfo.setPassword("123987"); + sdncRegisterInfo.setProductName("thirdparty SDNC"); + sdncRegisterInfo.setProtocol("protocol"); + sdncRegisterInfo.setThirdpartySdncId("123456"); + sdncRegisterInfo.setType("SDNC"); + sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); + sdncRegisterInfo.setUserName("nancy"); + sdncRegisterInfo.setVendor("zte"); + sdncRegisterInfo.setVersion("v1"); + Response response = thirdpartySdncWrapper.registerThirdpartySdnc(sdncRegisterInfo); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_queryThirdpartySdncList() { - ExternalSystemProxy.isTest = true; - ExtsysUtil extsysUtil = new ExtsysUtil(); - List sdncList = new ArrayList<>(); - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - sdncRegisterInfo.setLocation("edge"); - sdncRegisterInfo.setName("SDNC_TEST"); - sdncRegisterInfo.setPassword("123987"); - sdncRegisterInfo.setProductName("thirdparty SDNC"); - sdncRegisterInfo.setProtocol("protocol"); - sdncRegisterInfo.setThirdpartySdncId("123456"); - sdncRegisterInfo.setType("SDNC"); - sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); - sdncRegisterInfo.setUserName("nancy"); - sdncRegisterInfo.setVendor("zte"); - sdncRegisterInfo.setVersion("v1"); - sdncList.add(sdncRegisterInfo); - Response response = thirdpartySdncWrapper.queryThirdpartySdncList(); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); - assertEquals(extsysUtil.objectToString(sdncList), extsysUtil.objectToString(response.getEntity())); + + @Test + public void test_delThirdpartySdnc() { + ExternalSystemProxy.isTest = true; + Response response = thirdpartySdncWrapper.delThirdpartySdnc("123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 204); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_updateThirdpartySdnc() { - ExternalSystemProxy.isTest = true; - ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); - sdncRegisterInfo.setLocation("edge"); - sdncRegisterInfo.setName("SDNC_TEST"); - sdncRegisterInfo.setPassword("123987"); - sdncRegisterInfo.setProductName("thirdparty SDNC"); - sdncRegisterInfo.setProtocol("protocol"); - sdncRegisterInfo.setThirdpartySdncId("123456"); - sdncRegisterInfo.setType("SDNC"); - sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); - sdncRegisterInfo.setUserName("nancy"); - sdncRegisterInfo.setVendor("zte"); - sdncRegisterInfo.setVersion("v1"); - Response response = thirdpartySdncWrapper.updateThirdpartySdnc(sdncRegisterInfo, "123456"); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); + + @Test + public void test_queryThirdpartySdncById() { + ExternalSystemProxy.isTest = true; + ExtsysUtil extsysUtil = new ExtsysUtil(); + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + sdncRegisterInfo.setLocation("edge"); + sdncRegisterInfo.setName("SDNC_TEST"); + sdncRegisterInfo.setPassword("123987"); + sdncRegisterInfo.setProductName("thirdparty SDNC"); + sdncRegisterInfo.setProtocol("protocol"); + sdncRegisterInfo.setThirdpartySdncId("123456"); + sdncRegisterInfo.setType("SDNC"); + sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); + sdncRegisterInfo.setUserName("nancy"); + sdncRegisterInfo.setVendor("zte"); + sdncRegisterInfo.setVersion("v1"); + Response response = thirdpartySdncWrapper.queryThirdpartySdncById("123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + assertEquals(extsysUtil.objectToString(sdncRegisterInfo), extsysUtil.objectToString(response.getEntity())); + } + ExternalSystemProxy.isTest = false; + } + + @Test + public void test_queryThirdpartySdncList() { + ExternalSystemProxy.isTest = true; + ExtsysUtil extsysUtil = new ExtsysUtil(); + List sdncList = new ArrayList<>(); + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + sdncRegisterInfo.setLocation("edge"); + sdncRegisterInfo.setName("SDNC_TEST"); + sdncRegisterInfo.setPassword("123987"); + sdncRegisterInfo.setProductName("thirdparty SDNC"); + sdncRegisterInfo.setProtocol("protocol"); + sdncRegisterInfo.setThirdpartySdncId("123456"); + sdncRegisterInfo.setType("SDNC"); + sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); + sdncRegisterInfo.setUserName("nancy"); + sdncRegisterInfo.setVendor("zte"); + sdncRegisterInfo.setVersion("v1"); + sdncList.add(sdncRegisterInfo); + Response response = thirdpartySdncWrapper.queryThirdpartySdncList(); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + assertEquals(extsysUtil.objectToString(sdncList), extsysUtil.objectToString(response.getEntity())); + } + ExternalSystemProxy.isTest = false; + } + + @Test + public void test_updateThirdpartySdnc() { + ExternalSystemProxy.isTest = true; + ThirdpartySdncRegisterInfo sdncRegisterInfo = new ThirdpartySdncRegisterInfo(); + sdncRegisterInfo.setLocation("edge"); + sdncRegisterInfo.setName("SDNC_TEST"); + sdncRegisterInfo.setPassword("123987"); + sdncRegisterInfo.setProductName("thirdparty SDNC"); + sdncRegisterInfo.setProtocol("protocol"); + sdncRegisterInfo.setThirdpartySdncId("123456"); + sdncRegisterInfo.setType("SDNC"); + sdncRegisterInfo.setUrl("http://127.0.0.1:8000"); + sdncRegisterInfo.setUserName("nancy"); + sdncRegisterInfo.setVendor("zte"); + sdncRegisterInfo.setVersion("v1"); + Response response = thirdpartySdncWrapper.updateThirdpartySdnc(sdncRegisterInfo, "123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } } diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java index 735e169..bfc9afd 100644 --- a/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java +++ b/esr-mgr/src/test/java/org/onap/aai/esr/wrapper/VnfmManagerWrapperTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2017 ZTE Corporation. + * Copyright 2018 ZTE Corporation. * * 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,9 @@ package org.onap.aai.esr.wrapper; import static org.junit.Assert.assertEquals; - import java.util.ArrayList; import java.util.List; - import javax.ws.rs.core.Response; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -32,112 +29,112 @@ import org.onap.aai.esr.util.ExtsysUtil; public class VnfmManagerWrapperTest { - private static VnfmManagerWrapper vnfmManagerWrapper; - static { - MsbConfig.setMsbServerAddr("http://127.0.0.1:80"); - } + private static VnfmManagerWrapper vnfmManagerWrapper; + static { + MsbConfig.setMsbServerAddr("http://127.0.0.1:80"); + } - @Before - public void setUp() throws Exception { - vnfmManagerWrapper = VnfmManagerWrapper.getInstance(); - } + @Before + public void setUp() throws Exception { + vnfmManagerWrapper = VnfmManagerWrapper.getInstance(); + } - @Test - public void test_registerVnfm() { - ExternalSystemProxy.isTest = true; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVimId("987654"); - vnfmRegisterInfo.setVersion("v1"); - vnfmRegisterInfo.setVendor("zte"); - vnfmRegisterInfo.setUserName("onap"); - vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); - vnfmRegisterInfo.setType("vnfm"); - vnfmRegisterInfo.setPassword("987654"); - vnfmRegisterInfo.setName("ONAP VNFM"); - vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); - Response response = vnfmManagerWrapper.registerVnfm(vnfmRegisterInfo); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); + @Test + public void test_registerVnfm() { + ExternalSystemProxy.isTest = true; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + Response response = vnfmManagerWrapper.registerVnfm(vnfmRegisterInfo); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_queryVnfmById() { - ExternalSystemProxy.isTest = true; - ExtsysUtil extsysUtil = new ExtsysUtil(); - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVimId("987654"); - vnfmRegisterInfo.setVersion("v1"); - vnfmRegisterInfo.setVendor("zte"); - vnfmRegisterInfo.setUserName("onap"); - vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); - vnfmRegisterInfo.setType("vnfm"); - vnfmRegisterInfo.setPassword("987654"); - vnfmRegisterInfo.setName("ONAP VNFM"); - vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); - vnfmRegisterInfo.setVnfmId("123456"); - Response response = vnfmManagerWrapper.queryVnfmById("123456"); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); - assertEquals(extsysUtil.objectToString(vnfmRegisterInfo), extsysUtil.objectToString(response.getEntity())); + + @Test + public void test_queryVnfmById() { + ExternalSystemProxy.isTest = true; + ExtsysUtil extsysUtil = new ExtsysUtil(); + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + vnfmRegisterInfo.setVnfmId("123456"); + Response response = vnfmManagerWrapper.queryVnfmById("123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + assertEquals(extsysUtil.objectToString(vnfmRegisterInfo), extsysUtil.objectToString(response.getEntity())); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_queryVnfmList() { - ExternalSystemProxy.isTest = true; - ExtsysUtil extsysUtil = new ExtsysUtil(); - List vnfmList = new ArrayList<>(); - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVimId("987654"); - vnfmRegisterInfo.setVersion("v1"); - vnfmRegisterInfo.setVendor("zte"); - vnfmRegisterInfo.setUserName("onap"); - vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); - vnfmRegisterInfo.setType("vnfm"); - vnfmRegisterInfo.setPassword("987654"); - vnfmRegisterInfo.setName("ONAP VNFM"); - vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); - vnfmRegisterInfo.setVnfmId("123456"); - vnfmList.add(vnfmRegisterInfo); - Response response = vnfmManagerWrapper.queryVnfmList(); - if (response != null) { - Assert.assertTrue(response.getStatus() == 200); - assertEquals(extsysUtil.objectToString(vnfmList), extsysUtil.objectToString(response.getEntity())); + + @Test + public void test_queryVnfmList() { + ExternalSystemProxy.isTest = true; + ExtsysUtil extsysUtil = new ExtsysUtil(); + List vnfmList = new ArrayList<>(); + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + vnfmRegisterInfo.setVnfmId("123456"); + vnfmList.add(vnfmRegisterInfo); + Response response = vnfmManagerWrapper.queryVnfmList(); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + assertEquals(extsysUtil.objectToString(vnfmList), extsysUtil.objectToString(response.getEntity())); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_delVnfm() { - ExternalSystemProxy.isTest = true; - Response response = vnfmManagerWrapper.delVnfm("123456"); - if(response != null) { - Assert.assertTrue(response.getStatus() == 204); + + @Test + public void test_delVnfm() { + ExternalSystemProxy.isTest = true; + Response response = vnfmManagerWrapper.delVnfm("123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 204); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } - - @Test - public void test_updateVnfm() { - ExternalSystemProxy.isTest = true; - VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); - vnfmRegisterInfo.setVimId("987654"); - vnfmRegisterInfo.setVersion("v1"); - vnfmRegisterInfo.setVendor("zte"); - vnfmRegisterInfo.setUserName("onap"); - vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); - vnfmRegisterInfo.setType("vnfm"); - vnfmRegisterInfo.setPassword("987654"); - vnfmRegisterInfo.setName("ONAP VNFM"); - vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); - vnfmRegisterInfo.setVnfmId("123456"); - Response response = vnfmManagerWrapper.updateVnfm(vnfmRegisterInfo, "123456"); - if(response != null) { - Assert.assertTrue(response.getStatus() == 200); + + @Test + public void test_updateVnfm() { + ExternalSystemProxy.isTest = true; + VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo(); + vnfmRegisterInfo.setVimId("987654"); + vnfmRegisterInfo.setVersion("v1"); + vnfmRegisterInfo.setVendor("zte"); + vnfmRegisterInfo.setUserName("onap"); + vnfmRegisterInfo.setUrl("http://10.11.22.33:8000"); + vnfmRegisterInfo.setType("vnfm"); + vnfmRegisterInfo.setPassword("987654"); + vnfmRegisterInfo.setName("ONAP VNFM"); + vnfmRegisterInfo.setCertificateUrl("http://11.22.33.44:5000/v3"); + vnfmRegisterInfo.setVnfmId("123456"); + Response response = vnfmManagerWrapper.updateVnfm(vnfmRegisterInfo, "123456"); + if (response != null) { + Assert.assertTrue(response.getStatus() == 200); + } + ExternalSystemProxy.isTest = false; } - ExternalSystemProxy.isTest = false; - } }