X-Git-Url: https://gerrit.onap.org/r/gitweb?p=portal.git;a=blobdiff_plain;f=ecomp-portal-BE-common%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fportalapp%2Fportal%2Fcontroller%2FWidgetsCatalogControllerTest.java;h=502f0aa1f905e6f40a9759443a45242e9f2cd0da;hp=e77186b1de9663e156edf88be9931409bab8b631;hb=a3a04c5887779e9ca8024a3e87ece109b8d9b0c1;hpb=7ce177cd99096772ff42ef89d8820070c687fd9b diff --git a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java index e77186b1..502f0aa1 100644 --- a/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java +++ b/ecomp-portal-BE-common/src/test/java/org/onap/portalapp/portal/controller/WidgetsCatalogControllerTest.java @@ -65,8 +65,8 @@ import org.onap.portalapp.portal.domain.WidgetServiceHeaders; import org.onap.portalapp.portal.ecomp.model.PortalRestResponse; import org.onap.portalapp.portal.ecomp.model.PortalRestStatusEnum; import org.onap.portalapp.portal.framework.MockitoTestSuite; -import org.onap.portalapp.portal.service.ConsulHealthService; -import org.onap.portalapp.portal.service.ConsulHealthServiceImpl; +import org.onap.portalapp.portal.service.WidgetMService; +import org.onap.portalapp.portal.service.WidgetMServiceImpl; import org.onap.portalapp.portal.service.MicroserviceService; import org.onap.portalapp.portal.service.MicroserviceServiceImpl; import org.onap.portalapp.portal.service.WidgetParameterService; @@ -98,7 +98,7 @@ import org.springframework.web.client.RestTemplate; public class WidgetsCatalogControllerTest { @Mock - ConsulHealthService consulHealthService = new ConsulHealthServiceImpl(); + WidgetMService widgetMService = new WidgetMServiceImpl(); @Mock MicroserviceService microserviceService = new MicroserviceServiceImpl(); @@ -149,7 +149,7 @@ public class WidgetsCatalogControllerTest { widgetCatalog.setName("test"); widgetsList.add(widgetCatalog); ResponseEntity ans = new ResponseEntity<>(widgetsList, HttpStatus.OK); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(List.class))).thenReturn(ans); List expectedWidgets = widgetsCatalogController.getUserWidgetCatalog("guestT"); @@ -170,7 +170,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.doThrow(new NullPointerException()).when(template).exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(List.class)); List expectedWidgets = widgetsCatalogController.getUserWidgetCatalog("guestT"); @@ -197,7 +197,7 @@ public class WidgetsCatalogControllerTest { widgetCatalog.setName("test"); widgetsList.add(widgetCatalog); ResponseEntity ans = new ResponseEntity<>(widgetsList, HttpStatus.OK); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(List.class))).thenReturn(ans); List expectedWidgets = widgetsCatalogController.getWidgetCatalog(); @@ -218,7 +218,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.doThrow(new NullPointerException()).when(template).exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(List.class)); List expectedWidgets = widgetsCatalogController.getUserWidgetCatalog("guestT"); @@ -239,9 +239,9 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); ResponseEntity ans = new ResponseEntity<>(HttpStatus.OK); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.PUT), Matchers.>any(), Matchers.eq(List.class))).thenReturn(ans); WidgetCatalog widget = new WidgetCatalog(); @@ -263,9 +263,9 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); ResponseEntity ans = new ResponseEntity<>(HttpStatus.OK); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.DELETE), Matchers.>any(), Matchers.eq(List.class))).thenReturn(ans); widgetsCatalogController.deleteOnboardingWidget(1l); @@ -286,9 +286,9 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); String ans = "success"; - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.postForObject(Mockito.any(String.class), Mockito.any(HttpEntity.class), Mockito.any(Class.class))).thenReturn(ans); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); @@ -316,9 +316,9 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); String ans = "success"; - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.postForObject(Mockito.any(String.class), Mockito.any(HttpEntity.class), Mockito.any(Class.class))).thenReturn(ans); MockMultipartHttpServletRequest request = new MockMultipartHttpServletRequest(); @@ -346,7 +346,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.getForObject(Mockito.anyString(), Mockito.any(Class.class), Mockito.any(String.class))) .thenReturn("test123"); String result = widgetsCatalogController.getWidgetFramework(1l); @@ -368,7 +368,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.getForObject(Mockito.anyString(), Mockito.any(Class.class), Mockito.any(String.class))) .thenReturn("test123"); String result = widgetsCatalogController.getWidgetController(1); @@ -390,7 +390,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.getForObject(Mockito.anyString(), Mockito.any(Class.class), Mockito.any(String.class))) .thenReturn("test123"); String result = widgetsCatalogController.getWidgetCSS(1); @@ -415,9 +415,9 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); ResponseEntity ans = new ResponseEntity<>(1l, HttpStatus.OK); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); Mockito.when(template.exchange(Matchers.anyString(), Matchers.eq(HttpMethod.GET), Matchers.>any(), Matchers.eq(Long.class))).thenReturn(ans); List defaultParam = new ArrayList<>(); @@ -456,7 +456,7 @@ public class WidgetsCatalogControllerTest { Mockito.when(CipherUtil .decryptPKC(EcompPortalUtils.getPropertyOrDefault("microservices.widget.password", "widget_password"))) .thenReturn("abc"); - Mockito.when(consulHealthService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); + Mockito.when(widgetMService.getServiceLocation("widgets-service", "test")).thenReturn("test.com"); MockHttpServletRequest request = new MockHttpServletRequest(); MockHttpServletResponse response = new MockHttpServletResponse(); ResponseEntity mockData = new ResponseEntity("testfile.zip".getBytes(), HttpStatus.OK);