summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/ExtsysAppConfiguration.java4
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/EmsManagerUtil.java3
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/ExtsysUtil.java16
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VimManagerUtil.java3
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/util/VnfmManagerUtil.java3
-rw-r--r--esr-mgr/src/main/java/org/onap/aai/esr/wrapper/ThirdpatySdncWrapper.java2
-rw-r--r--esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java79
7 files changed, 89 insertions, 21 deletions
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 f0b6097..0ac6d7a 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
@@ -73,8 +73,8 @@ public class ExtsysAppConfiguration extends Configuration {
}
@JsonProperty
- public String setMsbDiscoveryIp() {
- return msbDiscoveryIp;
+ public void setMsbDiscoveryIp(String discoveryIp) {
+ this.msbDiscoveryIp = discoveryIp;
}
@JsonProperty
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 916c9e7..238683d 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
@@ -25,13 +25,14 @@ 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());
ArrayList<EsrSystemInfo> authInfos = new ArrayList<EsrSystemInfo>();
authInfos = getAuthInfosFromRegisterData(emsRegisterInfo);
- esrEms.setEsrSystemInfoList(ExtsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos));
+ esrEms.setEsrSystemInfoList(extsysUtil.getEsrSystemInfoListFromAuthInfoList(authInfos));
return esrEms;
}
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 d0ba1d8..8e1d323 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
@@ -20,25 +20,18 @@ import com.google.gson.Gson;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
-import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Date;
import java.util.UUID;
import org.onap.aai.esr.entity.aai.EsrSystemInfo;
import org.onap.aai.esr.entity.aai.EsrSystemInfoList;
public class ExtsysUtil {
-// private final static Logger logger = LoggerFactory.getLogger(ExtsysUtil.class);
public static String generateId() {
return UUID.randomUUID().toString();
}
- public static boolean isNotEmpty(String str) {
- return str != null && !"".equals(str) && str.length() > 0;
- }
-
/**
* change object to str.
*/
@@ -51,12 +44,7 @@ public class ExtsysUtil {
}
}
- public static String getNowTime() {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- return sdf.format(new Date());
- }
-
- public static EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) {
+ public EsrSystemInfoList getEsrSystemInfoListFromAuthInfo(EsrSystemInfo esrSystemInfoObj) {
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
ArrayList<EsrSystemInfo> esrSystemInfo = new ArrayList<EsrSystemInfo>();
esrSystemInfo.add(esrSystemInfoObj);
@@ -64,7 +52,7 @@ public class ExtsysUtil {
return esrSystemInfoList;
}
- public static EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(ArrayList<EsrSystemInfo> esrSystemInfo) {
+ public EsrSystemInfoList getEsrSystemInfoListFromAuthInfoList(ArrayList<EsrSystemInfo> esrSystemInfo) {
EsrSystemInfoList esrSystemInfoList = new EsrSystemInfoList();
esrSystemInfoList.setEsrSystemInfo(esrSystemInfo);;
return esrSystemInfoList;
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 6393f12..2670866 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
@@ -27,6 +27,7 @@ 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();
@@ -44,7 +45,7 @@ public class VimManagerUtil {
esrSystemInfoObj = vimAuthInfo2EsrSystemInfoObj(vimRegisterInfo.getVimAuthInfos());
esrSystemInfoObj.setSystemStatus(vimRegisterInfo.getStatus());
- esrSystemInfoList = ExtsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
+ esrSystemInfoList = extsysUtil.getEsrSystemInfoListFromAuthInfo(esrSystemInfoObj);
cloudRegion.setEsrSystemInfoList(esrSystemInfoList);
return cloudRegion;
}
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 ca6babd..9c1a353 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,6 +22,7 @@ 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();
@@ -32,7 +33,7 @@ public class VnfmManagerUtil {
esrVnfm.setVimId(vnfmRegisterInfo.getVimId());
esrVnfm.setVnfmId(ExtsysUtil.generateId());
authInfo = getAuthInfoFromVnfmRegisterInfo(vnfmRegisterInfo);
- esrSystemInfo = ExtsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo);
+ esrSystemInfo = extsysUtil.getEsrSystemInfoListFromAuthInfo(authInfo);
esrVnfm.setEsrSystemInfoList(esrSystemInfo);
return esrVnfm;
}
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
index effc244..0aa21da 100644
--- 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
@@ -22,12 +22,10 @@ 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.aai.EsrVnfmDetail;
import org.onap.aai.esr.entity.rest.CommonRegisterResponse;
import org.onap.aai.esr.entity.rest.ThirdpartySdncRegisterInfo;
import org.onap.aai.esr.externalservice.aai.ExternalSystemProxy;
import org.onap.aai.esr.util.ThirdpartySdncManagerUtil;
-import org.onap.aai.esr.util.VnfmManagerUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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
new file mode 100644
index 0000000..95f7fe4
--- /dev/null
+++ b/esr-mgr/src/test/java/org/onap/aai/esr/ExtsysAppConfigurationTest.java
@@ -0,0 +1,79 @@
+/**
+ * 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;
+
+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);
+ }
+}