summaryrefslogtreecommitdiffstats
path: root/vnf-sdk-function-test/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'vnf-sdk-function-test/src/main/java/org')
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/Config.java4
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java3
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntity.java7
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java11
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java4
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java3
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/responsehandler/VnfFuncTestResponseHandler.java2
7 files changed, 24 insertions, 10 deletions
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/Config.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/Config.java
index cb19c98..23d4158 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/Config.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/Config.java
@@ -22,6 +22,10 @@ public class Config {
private static VnfSdkFuncTestAppConfiguration configration;
+ private Config() {
+
+ }
+
public static VnfSdkFuncTestAppConfiguration getConfigration() {
return configration;
}
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java
index ada7d78..4dc0192 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java
@@ -39,6 +39,9 @@ public class ServiceRegistration implements Runnable {
while(!flag && retry < 1000) {
LOG.info("VNF-SDK function test microservice register.retry:" + retry);
retry++;
+ if(retry >= 1000) {
+ flag = true;
+ }
flag = MicroserviceBusConsumer.registerService(funcTestEntity);
if(flag == false) {
LOG.warn("microservice register failed, sleep 30S and try again.");
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntity.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntity.java
index b622a6c..d32e2af 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntity.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/entity/ServiceRegisterEntity.java
@@ -17,6 +17,7 @@
package org.openo.vnfsdk.functest.externalservice.entity;
import java.util.ArrayList;
+import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -70,11 +71,11 @@ public class ServiceRegisterEntity {
this.visualRange = visualRange;
}
- public ArrayList<ServiceNode> getNodes() {
+ public List<ServiceNode> getNodes() {
return nodes;
}
- public void setNodes(ArrayList<ServiceNode> nodes) {
+ public void setNodes(List<ServiceNode> nodes) {
this.nodes = nodes;
}
@@ -88,7 +89,7 @@ public class ServiceRegisterEntity {
private String visualRange;
- private ArrayList<ServiceNode> nodes = new ArrayList<ServiceNode>();
+ private List<ServiceNode> nodes = new ArrayList<ServiceNode>();
public void setSingleNode(String ip, String port, int ttl) {
ServiceNode node = new ServiceNode();
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java
index 1c7bdd6..73dcfbf 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java
@@ -16,6 +16,8 @@
package org.openo.vnfsdk.functest.externalservice.msb;
+import java.io.IOException;
+
import org.glassfish.jersey.client.ClientConfig;
import org.openo.vnfsdk.functest.common.Config;
import org.openo.vnfsdk.functest.externalservice.entity.ServiceRegisterEntity;
@@ -28,15 +30,18 @@ public class MicroserviceBusConsumer {
private static final Logger LOG = LoggerFactory.getLogger(MicroserviceBusConsumer.class);
+ private MicroserviceBusConsumer() {
+
+ }
+
public static boolean registerService(ServiceRegisterEntity entity) {
ClientConfig config = new ClientConfig();
- // LOG.info("microservice register body:" + ExtsysDbUtil.objectToString(entity));
try {
MicroserviceBusRest resourceserviceproxy = ConsumerFactory
.createConsumer(Config.getConfigration().getMsbServerAddr(), config, MicroserviceBusRest.class);
resourceserviceproxy.registerServce("false", entity);
- } catch(Exception error) {
- LOG.error("Microservice register failed!" + error.getMessage());
+ } catch(IOException error) {
+ LOG.error("Microservice register failed!", error);
return false;
}
return true;
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java
index 02361c1..6314734 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java
@@ -16,6 +16,8 @@
package org.openo.vnfsdk.functest.externalservice.msb;
+import java.io.IOException;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
@@ -33,5 +35,5 @@ public interface MicroserviceBusRest {
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity) throws Exception;
+ ServiceRegisterEntity entity) throws IOException;
}
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java
index 41c4391..6dc161c 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/resource/CommonManager.java
@@ -26,7 +26,6 @@ import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
@@ -91,7 +90,7 @@ public class CommonManager {
final String finalPath = filePath;
ExecutorService es = Executors.newFixedThreadPool(3);
- final Future<Integer> future = es.submit(new Callable<Integer>() {
+ es.submit(new Callable<Integer>() {
public Integer call() throws Exception {
diff --git a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/responsehandler/VnfFuncTestResponseHandler.java b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/responsehandler/VnfFuncTestResponseHandler.java
index 9005ef8..fe79027 100644
--- a/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/responsehandler/VnfFuncTestResponseHandler.java
+++ b/vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/responsehandler/VnfFuncTestResponseHandler.java
@@ -100,7 +100,7 @@ public class VnfFuncTestResponseHandler {
*/
FileUtil.deleteFile(zipFileName);
/*
- * Later will delete this file..FileUtil.deleteDirectory(fileName);
+ * Later will delete this file
*/
logger.warn("Resquested function Test result Sucess !!!");
return RestResponseUtil.getSuccessResponse(byteArrayFile);