From 769718b3e8b4e659299602701b575cf1b4b182c5 Mon Sep 17 00:00:00 2001
From: Lizi
Date: Wed, 10 Jan 2018 10:43:29 +0000
Subject: Fix the nonstandard coding.
Fix the ArrayList usage, Remove the redundancy newly object.
Change-Id: I0311297d4e1387f89196eab978ed58a86f54cddb
Issue-ID: AAI-500
Signed-off-by: Lizi
---
.../src/main/java/org/onap/aai/esr/ExtsysApp.java | 4 +-
.../onap/aai/esr/entity/aai/CloudRegionList.java | 8 +-
.../org/onap/aai/esr/entity/aai/EsrEmsList.java | 8 +-
.../onap/aai/esr/entity/aai/EsrSystemInfoList.java | 8 +-
.../aai/esr/entity/aai/EsrThirdpartySdncList.java | 8 +-
.../org/onap/aai/esr/entity/aai/EsrVnfmList.java | 8 +-
.../onap/aai/esr/entity/rest/VimRegisterInfo.java | 7 +-
.../externalservice/aai/ExternalSystemProxy.java | 54 +++++--
.../aai/esr/resource/ThirdpartySdncManager.java | 151 ++++++++++++++++++
.../aai/esr/resource/ThirdpatySdncManager.java | 151 ------------------
.../java/org/onap/aai/esr/util/EmsManagerUtil.java | 23 ++-
.../java/org/onap/aai/esr/util/ExtsysUtil.java | 5 +-
.../aai/esr/util/ThirdpartySdncManagerUtil.java | 3 +-
.../java/org/onap/aai/esr/util/VimManagerUtil.java | 19 +--
.../onap/aai/esr/wrapper/EmsManagerWrapper.java | 11 +-
.../aai/esr/wrapper/ThirdpartySdncWrapper.java | 163 ++++++++++++++++++++
.../onap/aai/esr/wrapper/ThirdpatySdncWrapper.java | 169 ---------------------
.../onap/aai/esr/wrapper/VimManagerWrapper.java | 7 +-
.../onap/aai/esr/wrapper/VnfmManagerWrapper.java | 7 +-
.../aai/esr/entity/aai/CloudRegionDetailTest.java | 3 +-
.../aai/esr/entity/aai/CloudRegionListTest.java | 3 +-
.../onap/aai/esr/entity/aai/EsrEmsDetailTest.java | 3 +-
.../onap/aai/esr/entity/aai/EsrEmsListTest.java | 3 +-
.../aai/esr/entity/aai/EsrSystemInfoListTest.java | 3 +-
.../entity/aai/EsrThirdpartySdncDetailTest.java | 3 +-
.../esr/entity/aai/EsrThirdpartySdncListTest.java | 3 +-
.../onap/aai/esr/entity/aai/EsrVnfmDetailTest.java | 3 +-
.../onap/aai/esr/entity/aai/EsrVnfmListTest.java | 3 +-
.../aai/esr/entity/rest/VimRegisterInfoTest.java | 3 +-
.../java/org/onap/aai/esr/util/ExtsysUtilTest.java | 3 +-
.../org/onap/aai/esr/util/VimManagerUtilTest.java | 3 +-
.../aai/esr/wrapper/VnfmManagerWrapperTest.java | 3 +-
32 files changed, 444 insertions(+), 409 deletions(-)
create mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java
delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
create mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java
delete mode 100644 esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
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 2e1ae6f..e1db108 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
@@ -20,7 +20,7 @@ import org.onap.aai.esr.common.MsbConfig;
import org.onap.aai.esr.externalservice.msb.MsbHelper;
import org.onap.aai.esr.resource.EmsManager;
import org.onap.aai.esr.resource.ServiceTest;
-import org.onap.aai.esr.resource.ThirdpatySdncManager;
+import org.onap.aai.esr.resource.ThirdpartySdncManager;
import org.onap.aai.esr.resource.VimManager;
import org.onap.aai.esr.resource.VnfmManager;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
@@ -50,7 +50,7 @@ public class ExtsysApp extends Application {
MsbConfig.setMsbDiscoveryIp(configuration.getMsbDiscoveryIp());
MsbConfig.setMsbDiscoveryPort(configuration.getMsbDiscoveryPort());
environment.jersey().register(new EmsManager());
- environment.jersey().register(new ThirdpatySdncManager());
+ environment.jersey().register(new ThirdpartySdncManager());
environment.jersey().register(new VimManager());
environment.jersey().register(new VnfmManager());
environment.jersey().register(new ServiceTest());
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 aef7bca..c6815d2 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
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.List;
import com.google.gson.annotations.SerializedName;
@@ -25,13 +25,13 @@ public class CloudRegionList implements Serializable {
public static final long serialVersionUID = 1L;
@SerializedName("cloud-region")
- private ArrayList cloudRegion;
+ private List cloudRegion;
- public ArrayList getCloudRegion() {
+ public List getCloudRegion() {
return cloudRegion;
}
- public void setCloudRegion(ArrayList cloudRegion) {
+ public void setCloudRegion(List cloudRegion) {
this.cloudRegion = cloudRegion;
}
}
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 e14da46..8d4dc69 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
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.List;
import com.google.gson.annotations.SerializedName;
@@ -25,13 +25,13 @@ public class EsrEmsList implements Serializable {
public static final long serialVersionUID = 1L;
@SerializedName("esr-ems")
- private ArrayList esrEms;
+ private List esrEms;
- public ArrayList getEsrEms() {
+ public List getEsrEms() {
return esrEms;
}
- public void setEsrEms(ArrayList esrEms) {
+ public void setEsrEms(List esrEms) {
this.esrEms = esrEms;
}
}
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 9306b98..dd06c53 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
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.List;
import com.google.gson.annotations.SerializedName;
@@ -25,13 +25,13 @@ public class EsrSystemInfoList implements Serializable {
public static final long serialVersionUID = 1L;
@SerializedName("esr-system-info")
- private ArrayList esrSystemInfo;
+ private List esrSystemInfo;
- public ArrayList getEsrSystemInfo() {
+ public List getEsrSystemInfo() {
return esrSystemInfo;
}
- public void setEsrSystemInfo(ArrayList esrSystemInfo) {
+ public void setEsrSystemInfo(List esrSystemInfo) {
this.esrSystemInfo = esrSystemInfo;
}
}
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 8340e31..0d4d100 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
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.List;
import com.google.gson.annotations.SerializedName;
@@ -25,13 +25,13 @@ public class EsrThirdpartySdncList implements Serializable {
public static final long serialVersionUID = 1L;
@SerializedName("esr-thirdparty-sdnc")
- private ArrayList esrThirdpartySdnc;
+ private List esrThirdpartySdnc;
- public ArrayList getEsrThirdpartySdnc() {
+ public List getEsrThirdpartySdnc() {
return esrThirdpartySdnc;
}
- public void setEsrThirdpartySdnc(ArrayList esrThirdpartySdnc) {
+ public void setEsrThirdpartySdnc(List esrThirdpartySdnc) {
this.esrThirdpartySdnc = esrThirdpartySdnc;
}
}
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 0193147..eec0a07 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
@@ -16,7 +16,7 @@
package org.onap.aai.esr.entity.aai;
import java.io.Serializable;
-import java.util.ArrayList;
+import java.util.List;
import com.google.gson.annotations.SerializedName;
@@ -25,13 +25,13 @@ public class EsrVnfmList implements Serializable {
public static final long serialVersionUID = 1L;
@SerializedName("esr-vnfm")
- private ArrayList esrVnfm;
+ private List esrVnfm;
- public ArrayList getEsrVnfm() {
+ public List getEsrVnfm() {
return esrVnfm;
}
- public void setEsrVnfm(ArrayList esrVnfm) {
+ public void setEsrVnfm(List esrVnfm) {
this.esrVnfm = esrVnfm;
}
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 f6b928c..1441f79 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
@@ -16,6 +16,7 @@
package org.onap.aai.esr.entity.rest;
import java.util.ArrayList;
+import java.util.List;
public class VimRegisterInfo {
@@ -37,7 +38,7 @@ public class VimRegisterInfo {
private String status;
- private ArrayList vimAuthInfos;
+ private List vimAuthInfos;
public String getCloudOwner() {
return cloudOwner;
@@ -103,11 +104,11 @@ public class VimRegisterInfo {
this.cloudExtraInfo = cloudExtraInfo;
}
- public ArrayList getVimAuthInfos() {
+ public List getVimAuthInfos() {
return vimAuthInfos;
}
- public void setVimAuthInfos(ArrayList vimAuthInfos) {
+ public void setVimAuthInfos(List vimAuthInfos) {
this.vimAuthInfos = vimAuthInfos;
}
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 6c34265..e6addce 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
@@ -106,18 +106,38 @@ public class ExternalSystemProxy {
}
public static void registerSdnc(String thirdpartySdncId, EsrThirdpartySdncDetail esrSdncDetail) throws ExtsysException {
- 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);
+ 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 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) {
@@ -126,6 +146,14 @@ public class ExternalSystemProxy {
}
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) {
@@ -134,10 +162,12 @@ public class ExternalSystemProxy {
}
public static void deleteThirdpartySdnc(String sdncId, String resourceVersion) throws ExtsysException {
- try {
- externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion);
- } catch (Exception e) {
- throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e);
+ if(!isTest) {
+ try {
+ externalSystemproxy.deleteThirdpartySdnc(transactionId, fromAppId, authorization, sdncId, resourceVersion);
+ } catch (Exception e) {
+ throw new ExtsysException("Delete thirdparty SDNC from A&AI failed.", e);
+ }
}
}
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
new file mode 100644
index 0000000..93edffb
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpartySdncManager.java
@@ -0,0 +1,151 @@
+/**
+ * Copyright 2016-2017 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.resource;
+
+import com.codahale.metrics.annotation.Timed;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+@SwaggerDefinition
+@Path("/sdncontrollers")
+@Api(tags = {"ThirdParty sdnc Management "})
+public class ThirdpartySdncManager {
+
+ 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);
+ }
+
+ /**
+ *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/ThirdpatySdncManager.java b/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
deleted file mode 100644
index 8660ade..0000000
--- a/esr-mgr/src/main/java/org/onap/aai/esr/resource/ThirdpatySdncManager.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * Copyright 2016-2017 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.resource;
-
-import com.codahale.metrics.annotation.Timed;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-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.ThirdpatySdncWrapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-@SwaggerDefinition
-@Path("/sdncontrollers")
-@Api(tags = {"ThirdParty sdnc Management "})
-public class ThirdpatySdncManager {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ThirdpatySdncManager.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 ThirdpatySdncWrapper.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 ThirdpatySdncWrapper.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 ThirdpatySdncWrapper.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 ThirdpatySdncWrapper.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 ThirdpatySdncWrapper.getInstance().registerThirdpartySdnc(thirdPartySdnc);
- }
-}
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 76f9681..404b118 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
@@ -16,6 +16,7 @@
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;
@@ -30,20 +31,16 @@ public class EmsManagerUtil {
public EsrEmsDetail emsRegisterInfo2EsrEms(EmsRegisterInfo emsRegisterInfo) {
EsrEmsDetail esrEms = new EsrEmsDetail();
esrEms.setEmsId(extsysUtil.generateId());
- ArrayList authInfos = new ArrayList();
- authInfos = getAuthInfosFromRegisterData(emsRegisterInfo);
+ List authInfos = getAuthInfosFromRegisterData(emsRegisterInfo);
esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos));
return esrEms;
}
- private ArrayList getAuthInfosFromRegisterData(EmsRegisterInfo emsRegisterInfo) {
- ArrayList authInfos = new ArrayList();
- EsrSystemInfo resouceAuthInfo = new EsrSystemInfo();
- EsrSystemInfo performanceAuthInfo = new EsrSystemInfo();
- EsrSystemInfo alarmAuthInfo = new EsrSystemInfo();
- resouceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_RESOUCE.toString());
- performanceAuthInfo = getAuthInfoFromFtpAddr(emsRegisterInfo, SystemType.EMS_PERFORMANCE.toString());
- alarmAuthInfo = getAuthInfoFromAlarmAddr(emsRegisterInfo);
+ 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);
@@ -75,8 +72,7 @@ public class EmsManagerUtil {
private EsrSystemInfo getAuthInfoFromAlarmAddr(EmsRegisterInfo emsRegisterInfo) {
EsrSystemInfo authInfo = new EsrSystemInfo();
- AlarmAddr alarmAddr = new AlarmAddr();
- alarmAddr = emsRegisterInfo.getAlarmAddr();
+ AlarmAddr alarmAddr = emsRegisterInfo.getAlarmAddr();
authInfo.setEsrSystemInfoId(extsysUtil.generateId());
authInfo.setIpAddress(alarmAddr.getIp());
authInfo.setPort(alarmAddr.getPort());
@@ -91,9 +87,8 @@ public class EmsManagerUtil {
public EmsRegisterInfo EsrEms2EmsRegisterInfo(EsrEmsDetail esrEms) {
EmsRegisterInfo emsRegisterInfo = new EmsRegisterInfo();
- ArrayList esrSystemInfo = new ArrayList();
EsrSystemInfo authInfo = new EsrSystemInfo();
- esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo();
+ List esrSystemInfo = esrEms.getEsrSystemInfoList().getEsrSystemInfo();
emsRegisterInfo.setEmsId(esrEms.getEmsId());
for(int i=0; i esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
esrSystemInfo.add(esrSystemInfoObj);
esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);
return esrSystemInfoList;
}
- public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(ArrayList esrSystemInfo) {
+ 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 d0f61ca..2a01ddc 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
@@ -16,6 +16,7 @@
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;
@@ -38,7 +39,7 @@ public class ThirdpartySdncManagerUtil {
private EsrSystemInfoList getEsrSystemInfoList(ThirdpartySdncRegisterInfo sdncRegisterInfo) {
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
EsrSystemInfo authInfo = new EsrSystemInfo();
authInfo.setEsrSystemInfoId(extsysUtil.generateId());
authInfo.setVersion(sdncRegisterInfo.getVersion());
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 88cceea..0a69f40 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
@@ -17,6 +17,7 @@ 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;
@@ -30,8 +31,6 @@ public class VimManagerUtil {
public CloudRegionDetail vimRegisterInfo2CloudRegion(VimRegisterInfo vimRegisterInfo) {
CloudRegionDetail cloudRegion = new CloudRegionDetail();
- EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
cloudRegion.setCloudOwner(vimRegisterInfo.getCloudOwner());
cloudRegion.setCloudRegionId(vimRegisterInfo.getCloudRegionId());
@@ -42,17 +41,16 @@ public class VimManagerUtil {
cloudRegion.setOwnerDefinedType(vimRegisterInfo.getOwnerDefinedType());
cloudRegion.setCloudExtraInfo(vimRegisterInfo.getCloudExtraInfo());
- esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos());
+ EsrSystemInfo esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos());
esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus());
- esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
+ EsrSystemInfoList esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
cloudRegion.setEsrSystemInfoList(esrSystemInfoList);
return cloudRegion;
}
- private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(ArrayList vimAuthInfos) {
+ private EsrSystemInfo vimAuthInfo2EsrSystemInfoObj(List vimAuthInfos) {
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
- VimAuthInfo vimAuthInfo = new VimAuthInfo();
- vimAuthInfo = vimAuthInfos.get(0);
+ VimAuthInfo vimAuthInfo = vimAuthInfos.get(0);
esrSystemInfoObj.setCloudDomain(vimAuthInfo.getCloudDomain());
esrSystemInfoObj.setUserName(vimAuthInfo.getUserName());
esrSystemInfoObj.setPassword(vimAuthInfo.getPassword());
@@ -80,13 +78,12 @@ public class VimManagerUtil {
public VimRegisterInfo cloudRegion2VimRegisterInfo(CloudRegionDetail cloudRegion) {
VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
- VimAuthInfo vimAuthInfo = new VimAuthInfo();
- ArrayList vimAuthInfos = new ArrayList();
+ List vimAuthInfos = new ArrayList<>();
if(cloudRegion.getEsrSystemInfoList()!=null){
- vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0));
+ VimAuthInfo vimAuthInfo = authInfo2VimAuthInfo(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0));
+ vimAuthInfos.add(vimAuthInfo);
vimRegisterInfo.setStatus(cloudRegion.getEsrSystemInfoList().getEsrSystemInfo().get(0).getSystemStatus());
}
- vimAuthInfos.add(vimAuthInfo);
vimRegisterInfo.setVimAuthInfos(vimAuthInfos);
vimRegisterInfo.setCloudExtraInfo(cloudRegion.getCloudExtraInfo());
vimRegisterInfo.setCloudOwner(cloudRegion.getCloudOwner());
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 e1ab970..8acc825 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
@@ -16,6 +16,7 @@
package org.onap.aai.esr.wrapper;
import java.util.ArrayList;
+import java.util.List;
import javax.ws.rs.core.Response;
@@ -79,7 +80,7 @@ public class EmsManagerWrapper {
}
public Response queryEmsList() {
- ArrayList emsList = new ArrayList();
+ List emsList = new ArrayList<>();
EsrEmsList esrEms = new EsrEmsList();
try {
String esrEmsStr = ExternalSystemProxy.queryEmsList();
@@ -132,8 +133,8 @@ public class EmsManagerWrapper {
return emsRegisterInfo;
}
- private ArrayList getEmsDetailList(EsrEmsList esrEms) {
- ArrayList emsInfoList = new ArrayList();
+ 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();
@@ -159,10 +160,10 @@ public class EmsManagerWrapper {
private EsrEmsDetail getNewEsrEmsDetail(EmsRegisterInfo emsRegisterInfo, String emsId) {
EsrEmsDetail esrEmsDetail = new EsrEmsDetail();
- ArrayList newEsrSysInfoList = new ArrayList();
+ List newEsrSysInfoList = new ArrayList<>();
EsrSystemInfo newEsrSystemInfo = new EsrSystemInfo();
EsrEmsDetail oriEsrEmsDetail = new EsrEmsDetail();
- ArrayList oriEsrSysInfoList = new ArrayList();
+ List oriEsrSysInfoList = new ArrayList<>();
EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo();
oriEsrEmsDetail = queryEsrEmsDetail(emsId);
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
new file mode 100644
index 0000000..a36d0ba
--- /dev/null
+++ b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpartySdncWrapper.java
@@ -0,0 +1,163 @@
+/**
+ * Copyright 2017 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 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;
+import org.onap.aai.esr.entity.rest.CommonRegisterResponse;
+import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
+import org.onap.aai.esr.exception.ExceptionUtil;
+import org.onap.aai.esr.exception.ExtsysException;
+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();
+
+ /**
+ * get ThirdpatySdncWrapper instance.
+ * @return ThirdpatySdnc manager wrapper instance
+ */
+ public static ThirdpartySdncWrapper getInstance() {
+ if (thirdpatySdncWrapper == null) {
+ thirdpatySdncWrapper = new ThirdpartySdncWrapper();
+ }
+ 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 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);
+ }
+ 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());
+ }
+ }
+
+ 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);
+ }
+ }
+ 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());
+ }
+ return esrSdncDetail;
+ }
+
+}
diff --git a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java b/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
deleted file mode 100644
index fd7dc43..0000000
--- a/esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * Copyright 2017 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 java.util.ArrayList;
-
-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;
-import org.onap.aai.esr.entity.rest.CommonRegisterResponse;
-import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
-import org.onap.aai.esr.exception.ExceptionUtil;
-import org.onap.aai.esr.exception.ExtsysException;
-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 ThirdpatySdncWrapper {
-
- private static ThirdpatySdncWrapper thirdpatySdncWrapper;
- private static final Logger LOG = LoggerFactory.getLogger(ThirdpatySdncWrapper.class);
- private static ThirdpartySdncManagerUtil thirdpartySdncManagerUtil = new ThirdpartySdncManagerUtil();
-
- /**
- * get ThirdpatySdncWrapper instance.
- * @return ThirdpatySdnc manager wrapper instance
- */
- public static ThirdpatySdncWrapper getInstance() {
- if (thirdpatySdncWrapper == null) {
- thirdpatySdncWrapper = new ThirdpatySdncWrapper();
- }
- return thirdpatySdncWrapper;
- }
-
- public Response registerThirdpartySdnc(ThirdpartySdncRegisterInfo thirdpartySdnc) {
- CommonRegisterResponse result = new CommonRegisterResponse();
- EsrThirdpartySdncDetail esrSdncDetail = new 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 esrSdncDetail = new EsrThirdpartySdncDetail();
- EsrThirdpartySdncDetail originalEsrSdncDetail = new EsrThirdpartySdncDetail();
- EsrSystemInfo originalEsrSystemInfo = new EsrSystemInfo();
- originalEsrSdncDetail = queryEsrThirdpartySdncDetail(sdncId);
- esrSdncDetail = thirdpartySdncManagerUtil.sdncRegisterInfo2EsrSdnc(thirdpartySdnc);
- String resourceVersion = originalEsrSdncDetail.getResourceVersion();
- esrSdncDetail.setResourceVersion(resourceVersion);
- esrSdncDetail.setThirdpartySdncId(sdncId);
- 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() {
- ArrayList 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();
- }
-
- public Response queryThirdpartySdncById(String thirdpartySdncId) {
- ThirdpartySdncRegisterInfo thirdpartySdnc = new ThirdpartySdncRegisterInfo();
- thirdpartySdnc = querySdncDetail(thirdpartySdncId);
- return Response.ok(thirdpartySdnc).build();
- }
-
- public Response delThirdpartySdnc(String thirdpartySdncId) {
- EsrThirdpartySdncDetail thirdpartySdncDetail = new 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 ArrayList getSdncDetailList(EsrThirdpartySdncList esrThirdPartySdnc) {
- ArrayList sdncInfoList = new ArrayList();
- ThirdpartySdncRegisterInfo sdncInfo = new ThirdpartySdncRegisterInfo();
- for (int i = 0; i < esrThirdPartySdnc.getEsrThirdpartySdnc().size(); i++) {
- String sdncId = esrThirdPartySdnc.getEsrThirdpartySdnc().get(i).getThirdpartySdncId();
- sdncInfo = querySdncDetail(sdncId);
- if (sdncInfo != null) {
- sdncInfoList.add(sdncInfo);
- }
- }
- 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());
- }
- 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 6c4c5af..fa52166 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
@@ -16,6 +16,7 @@
package org.onap.aai.esr.wrapper;
import java.util.ArrayList;
+import java.util.List;
import javax.ws.rs.core.Response;
@@ -104,7 +105,7 @@ public class VimManagerWrapper {
}
public Response queryVimListDetails() {
- ArrayList vimRegisterInfos = new ArrayList();
+ List vimRegisterInfos = new ArrayList<>();
CloudRegionList cloudRegionList = new CloudRegionList();
try {
String aaiVimList = cloudRegionProxy.qureyVimList();
@@ -134,8 +135,8 @@ public class VimManagerWrapper {
}
- private ArrayList getVimDetailList(CloudRegionList cloudRegionList) {
- ArrayList vimRegisterInfos = new ArrayList();
+ 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++) {
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 d46a846..584a156 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
@@ -16,6 +16,7 @@
package org.onap.aai.esr.wrapper;
import java.util.ArrayList;
+import java.util.List;
import javax.ws.rs.core.Response;
@@ -88,7 +89,7 @@ public class VnfmManagerWrapper {
}
public Response queryVnfmList() {
- ArrayList vnfmList = new ArrayList();
+ List vnfmList = new ArrayList<>();
EsrVnfmList esrVnfm = new EsrVnfmList();
try {
String esrVnfmStr = ExternalSystemProxy.queryVnfmList();
@@ -138,8 +139,8 @@ public class VnfmManagerWrapper {
return vnfm;
}
- private ArrayList getVnfmDetailList(EsrVnfmList esrVnfm) {
- ArrayList vnfmInfoList = new ArrayList();
+ 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);
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 89cbd95..ac9de8a 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
@@ -18,6 +18,7 @@ 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;
@@ -89,7 +90,7 @@ public class CloudRegionDetailTest {
@Test
public void getterAndSetter4esrSystemInfoList(){
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
esrSystemInfoObj.setEsrSystemInfoId("123");
esrSystemInfo.add(esrSystemInfoObj );
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 4786fc1..4a3a432 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
@@ -18,6 +18,7 @@ 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;
@@ -26,7 +27,7 @@ public class CloudRegionListTest {
@Test
public void getterAndSetter4cloudRegion() {
CloudRegionList cloudRegionList = new CloudRegionList();
- ArrayList cloudRegions = new ArrayList();
+ List cloudRegions = new ArrayList<>();
CloudRegion cloudRegion = new CloudRegion();
cloudRegion.setCloudOwner("owner");
cloudRegion.setCloudRegionId("regionId");
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 eb1f619..7cdbde3 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
@@ -18,6 +18,7 @@ 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;
@@ -42,7 +43,7 @@ public class EsrEmsDetailTest {
@Test
public void getterAndSetter4esrSystemInfoList(){
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
esrSystemInfoObj.setEsrSystemInfoId("123");
esrSystemInfo.add(esrSystemInfoObj );
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 3da7aaa..333a900 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
@@ -18,6 +18,7 @@ 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;
@@ -25,7 +26,7 @@ public class EsrEmsListTest {
@Test
public void getterAndSetter4EsrEmsList() {
EsrEmsList esrEmsList = new EsrEmsList();
- ArrayList esrEmses = new ArrayList();
+ List esrEmses = new ArrayList<>();
EsrEms esrEms = new EsrEms();
esrEms.setEmsId("123");
esrEmses.add(esrEms);
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 98337a0..6beb4b4 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
@@ -18,6 +18,7 @@ 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;
@@ -25,7 +26,7 @@ public class EsrSystemInfoListTest {
@Test
public void getterAndSetter4cloudRegion() {
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfos = new ArrayList();
+ List esrSystemInfos = new ArrayList<>();
EsrSystemInfo esrSystemInfo = new EsrSystemInfo();
esrSystemInfo.setEsrSystemInfoId("123");
esrSystemInfos.add(esrSystemInfo);
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 e83a6f9..7985d55 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
@@ -18,6 +18,7 @@ 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;
@@ -57,7 +58,7 @@ public class EsrThirdpartySdncDetailTest {
@Test
public void getterAndSetter4esrSystemInfoList(){
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
esrSystemInfoObj.setEsrSystemInfoId("123");
esrSystemInfo.add(esrSystemInfoObj );
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 2a531b4..fcf5db4 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
@@ -18,6 +18,7 @@ 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;
@@ -25,7 +26,7 @@ public class EsrThirdpartySdncListTest {
@Test
public void getterAndSetter4EsrThirdpartySdncList() {
EsrThirdpartySdncList esrThirdpartySdncList = new EsrThirdpartySdncList();
- ArrayList esrThirdpartySdncs = new ArrayList();
+ List esrThirdpartySdncs = new ArrayList<>();
EsrThirdpartySdnc esrThirdpartySdnc = new EsrThirdpartySdnc();
esrThirdpartySdnc.setThirdpartySdncId("123");
esrThirdpartySdncs.add(esrThirdpartySdnc);
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 4dc4f0e..17991aa 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
@@ -18,6 +18,7 @@ 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;
@@ -57,7 +58,7 @@ public class EsrVnfmDetailTest {
@Test
public void getterAndSetter4esrSystemInfoList(){
final EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
- ArrayList esrSystemInfo = new ArrayList();
+ List esrSystemInfo = new ArrayList<>();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
esrSystemInfoObj.setEsrSystemInfoId("123");
esrSystemInfo.add(esrSystemInfoObj );
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 f5d5228..943307b 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
@@ -18,6 +18,7 @@ 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;
@@ -25,7 +26,7 @@ public class EsrVnfmListTest {
@Test
public void getterAndSetter4EsrVnfmList() {
EsrVnfmList esrVnfmList = new EsrVnfmList();
- ArrayList esrVnfms = new ArrayList();
+ List esrVnfms = new ArrayList<>();
EsrVnfm esrVnfm = new EsrVnfm();
esrVnfm.setVnfmId("fadasf");
esrVnfms.add(esrVnfm);
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 04db4a3..4f4c989 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
@@ -18,6 +18,7 @@ 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;
@@ -96,7 +97,7 @@ public class VimRegisterInfoTest {
@Test
public void getterAndSetter4vimAuthInfos(){
- final ArrayList vimAuthInfos = new ArrayList();
+ 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/util/ExtsysUtilTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/util/ExtsysUtilTest.java
index 1bd8a62..7e71571 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
@@ -18,6 +18,7 @@ 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;
@@ -88,7 +89,7 @@ public class ExtsysUtilTest {
@Test
public void getEsrSystemInfoListFromAuthInfoListTest() {
- ArrayList esrSystemInfos = new ArrayList();
+ List esrSystemInfos = new ArrayList<>();
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
EsrSystemInfo esrSystemInfoObj = new EsrSystemInfo();
ExtsysUtil extsysUtil = new ExtsysUtil();
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 647c952..202368f 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
@@ -18,6 +18,7 @@ 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;
@@ -33,7 +34,7 @@ public class VimManagerUtilTest {
VimManagerUtil vimManagerUtil = new VimManagerUtil();
CloudRegionDetail cloudRegionDetail = new CloudRegionDetail();
VimRegisterInfo vimRegisterInfo = new VimRegisterInfo();
- ArrayList vimAuthInfos = new ArrayList();
+ List vimAuthInfos = new ArrayList<>();
VimAuthInfo vimAuthInfo = new VimAuthInfo();
vimAuthInfo.setAuthUrl("http://10.11.22.33:5000/v3");
vimAuthInfo.setCloudDomain("default");
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 00dc1f7..735e169 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
@@ -18,6 +18,7 @@ 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;
@@ -88,7 +89,7 @@ public class VnfmManagerWrapperTest {
public void test_queryVnfmList() {
ExternalSystemProxy.isTest = true;
ExtsysUtil extsysUtil = new ExtsysUtil();
- ArrayList vnfmList = new ArrayList();
+ List vnfmList = new ArrayList<>();
VnfmRegisterInfo vnfmRegisterInfo = new VnfmRegisterInfo();
vnfmRegisterInfo.setVimId("987654");
vnfmRegisterInfo.setVersion("v1");
--
cgit 1.2.3-korg