From bb5382a54c7d552cc1c7e53d8bcc0db5dd852db8 Mon Sep 17 00:00:00 2001 From: Murali-P Date: Wed, 15 Feb 2017 20:37:01 +0530 Subject: UT Test case fix Resolved:VNFSDK-21 VNF SDK Function test Change-Id: I9fe03e01c0d0203318aeb1d5764dcae4da80e6b8 Signed-off-by: Murali-P --- .../msb/MicroserviceBusConsumerTest.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'vnf-sdk-function-test') diff --git a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java index b047633..8250700 100644 --- a/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java +++ b/vnf-sdk-function-test/src/test/java/org/openo/vnfsdk/functest/externalservice/msb/MicroserviceBusConsumerTest.java @@ -16,25 +16,27 @@ package org.openo.vnfsdk.functest.externalservice.msb; -import org.glassfish.jersey.client.ClientConfig; +import javax.ws.rs.ProcessingException; + import org.junit.Test; -import org.mockito.Mockito; +import org.openo.vnfsdk.functest.VnfSdkFuncTestAppConfiguration; +import org.openo.vnfsdk.functest.common.Config; import org.openo.vnfsdk.functest.externalservice.entity.ServiceRegisterEntity; -import org.openo.vnfsdk.functest.externalservice.msb.MicroserviceBusConsumer; -import org.openo.vnfsdk.functest.externalservice.msb.MicroserviceBusRest; -import org.powermock.api.mockito.PowerMockito; - -import com.eclipsesource.jaxrs.consumer.ConsumerFactory; public class MicroserviceBusConsumerTest { @Test public void testRegisterService() { - ServiceRegisterEntity entity = Mockito.mock(ServiceRegisterEntity.class); - Mockito.mock(MicroserviceBusRest.class); - Mockito.mock(ClientConfig.class); - PowerMockito.mockStatic(ConsumerFactory.class); - PowerMockito.mockStatic(MicroserviceBusConsumer.class); - MicroserviceBusConsumer.registerService(entity); + + try { + ServiceRegisterEntity entity = new ServiceRegisterEntity(); + VnfSdkFuncTestAppConfiguration oConfig = new VnfSdkFuncTestAppConfiguration(); + oConfig.setMsbServerAddr("http://127.0.0.1"); + Config.setConfigration(oConfig); + + MicroserviceBusConsumer.registerService(entity); + } catch(ProcessingException e) { + // Connect to MSB will fail, Connect refused is OK + } } } -- cgit 1.2.3-korg