summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMurali-P <murali.p@huawei.com>2017-02-15 21:31:44 +0530
committerMurali-P <murali.p@huawei.com>2017-02-15 21:31:44 +0530
commit884427c640aaa59a24e6645576522c009aebff06 (patch)
tree9f5eb9818d97b8021e33bc2dd7f0aa69f051b068
parent0a18571b70757bb4dba741fe7ceac6c6805321a6 (diff)
Fix UT case
Resolved:VNFSDK-21 VNF SDK Function test Change-Id: I97e008a70849263004efcbf410c266e9a156ba2a Signed-off-by: Murali-P <murali.p@huawei.com>
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/common/ServiceRegistration.java6
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumer.java6
-rw-r--r--vnf-sdk-function-test/src/main/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusRest.java6
-rw-r--r--vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java4
4 files changed, 10 insertions, 12 deletions
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 ca326ea..d7ed67e 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
@@ -36,14 +36,12 @@ public class ServiceRegistration implements Runnable {
LOG.info("start extsys microservice register");
boolean flag = false;
int retry = 0;
- while(!flag && retry < 1000) {
+ while(!flag || retry < 1000) {
LOG.info("VNF-SDK function test microservice register.retry:" + retry);
retry++;
flag = MicroserviceBusConsumer.registerService(funcTestEntity);
- if(retry >= 1000) {
- flag = true;
- }
+
if(flag == false) {
LOG.warn("microservice register failed, sleep 30S and try again.");
threadSleep(30000);
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 73dcfbf..7c74545 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,7 +16,7 @@
package org.openo.vnfsdk.functest.externalservice.msb;
-import java.io.IOException;
+import javax.ws.rs.ProcessingException;
import org.glassfish.jersey.client.ClientConfig;
import org.openo.vnfsdk.functest.common.Config;
@@ -39,8 +39,8 @@ public class MicroserviceBusConsumer {
try {
MicroserviceBusRest resourceserviceproxy = ConsumerFactory
.createConsumer(Config.getConfigration().getMsbServerAddr(), config, MicroserviceBusRest.class);
- resourceserviceproxy.registerServce("false", entity);
- } catch(IOException error) {
+ resourceserviceproxy.registerService("false", entity);
+ } catch(ProcessingException error) {
LOG.error("Microservice register failed!", error);
return false;
}
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 6314734..1433605 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,8 +16,6 @@
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;
@@ -34,6 +32,6 @@ public interface MicroserviceBusRest {
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- public ServiceRegisterEntity registerServce(@QueryParam("createOrUpdate") String createOrUpdate,
- ServiceRegisterEntity entity) throws IOException;
+ public ServiceRegisterEntity registerService(@QueryParam("createOrUpdate") String createOrUpdate,
+ ServiceRegisterEntity entity);
}
diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java
index f8b1f60..48f08ca 100644
--- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java
+++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functests/VnfSdkFuncTestAppTest.java
@@ -35,7 +35,9 @@ public class VnfSdkFuncTestAppTest {
try {
- Config.setConfigration(new VnfSdkFuncTestAppConfiguration());
+ VnfSdkFuncTestAppConfiguration oConfig = new VnfSdkFuncTestAppConfiguration();
+ oConfig.setMsbServerAddr("http://127.0.0.1");
+ Config.setConfigration(oConfig);
Thread registerExtsysService = new Thread(new ServiceRegistration());
registerExtsysService.setName("Register vnfsdk-functionTest service to Microservice Bus");
registerExtsysService.start();