Add doc folder.
[portal.git] / ecomp-portal-BE-common / src / test / java / org / openecomp / portalapp / portal / controller / WidgetsCatalogControllerTest.java
1 //package org.openecomp.portalapp.portal.controller;
2 //
3 //import javax.servlet.http.HttpServletRequest;
4 //import javax.servlet.http.HttpServletResponse;
5 //
6 //import org.junit.Before;
7 //import org.junit.runner.RunWith;
8 //import org.mockito.InjectMocks;
9 //import org.mockito.Mock;
10 //import org.mockito.MockitoAnnotations;
11 //import org.openecomp.portalapp.portal.core.MockEPUser;
12 //import org.openecomp.portalapp.portal.framework.MockitoTestSuite;
13 //import org.openecomp.portalapp.portal.service.ConsulHealthService;
14 //import org.openecomp.portalapp.portal.service.ConsulHealthServiceImpl;
15 //import org.openecomp.portalapp.portal.service.MicroserviceService;
16 //import org.openecomp.portalapp.portal.service.MicroserviceServiceImpl;
17 //import org.openecomp.portalapp.portal.service.WidgetParameterService;
18 //import org.openecomp.portalapp.portal.service.WidgetParameterServiceImpl;
19 //import org.openecomp.portalapp.util.EPUserUtils;
20 //import org.powermock.core.classloader.annotations.PrepareForTest;
21 //import org.powermock.modules.junit4.PowerMockRunner;
22 //
23 //@RunWith(PowerMockRunner.class)
24 //@PrepareForTest({EPUserUtils.class})
25 //public class WidgetsCatalogControllerTest {
26 //
27 //      @Mock
28 //      ConsulHealthService consulHealthService = new ConsulHealthServiceImpl();
29 //      
30 //      @Mock
31 //      MicroserviceService microserviceService = new MicroserviceServiceImpl();
32 //      
33 //      @Mock
34 //      WidgetParameterService widgetParameterService = new WidgetParameterServiceImpl();
35 //      
36 //      @InjectMocks
37 //      WidgetsCatalogController widgetsCatalogController = new WidgetsCatalogController();
38 //
39 //      @Before
40 //      public void setup() {
41 //              MockitoAnnotations.initMocks(this);
42 //      }
43 //
44 //      MockitoTestSuite mockitoTestSuite = new MockitoTestSuite();
45 //
46 //      HttpServletRequest mockedRequest = mockitoTestSuite.getMockedRequest();
47 //      HttpServletResponse mockedResponse = mockitoTestSuite.getMockedResponse();
48 //
49 //      NullPointerException nullPointerException = new NullPointerException();
50 //      
51 //      MockEPUser mockUser = new MockEPUser();
52 //      
53 //      /*public List<WidgetCatalog> getUserWidgetCatalog(HttpServletRequest request, HttpServletResponse response,
54 //                      @PathVariable("loginName") String loginName) throws RestClientException, Exception {
55 //              List<WidgetCatalog> widgets = new ArrayList<>();
56 //              try {
57 //                      CustomLoggingFilter d;
58 //                      ResponseEntity<ArrayList> ans = template.exchange(
59 //                                      EcompPortalUtils.widgetMsProtocol() + "://" + consulHealthService.getServiceLocation(whatService,
60 //                                                      SystemProperties.getProperty("microservices.widget.local.port"))
61 //                                                      + "/widget/microservices/widgetCatalog/" + loginName,
62 //                                      HttpMethod.GET, new HttpEntity(WidgetServiceHeaders.getInstance()), ArrayList.class);
63 //                      widgets = ans.getBody();
64 //              } catch (Exception e) {
65 //                      logger.error(EELFLoggerDelegate.errorLogger, "getUserWidgetCatalog failed", e);
66 //                      // returning null because null help check on the UI if there was a
67 //                      // communication problem with Microservice.
68 //                      return null;
69 //              }
70 //              return widgets;
71 //      }
72 //      
73 //      @Test
74 //      public void getWidgetDataTest(){
75 //              
76 //              String resourceType = null;
77 //              List<WidgetCatalog> expectedData = new ArrayList<WidgetCatalog>();
78 //              expectedData.setStatus(PortalRestStatusEnum.ERROR);
79 //              expectedData.setMessage("Unexpected resource type null");
80 //              expectedData.setResponse(null);
81 //              
82 //              PortalRestResponse<CommonWidgetMeta> actualResponse =   dashboardController.getWidgetData(mockedRequest, resourceType);
83 //              assertEquals(expectedData,actualResponse);      
84 //              
85 //              
86 //      }*/
87 //}