diff options
Diffstat (limited to 'vnf-sdk-function-test')
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(); |