@Bean
public PortalAuthManager portalAuthManagerBean() throws ClassNotFoundException, IllegalAccessException,
InstantiationException, InvocationTargetException, NoSuchMethodException {
- logger.debug("portalAuthManagerBean");
+ logger.debug("portalAuthManagerBean: appName {}", appName);
return new PortalAuthManager(appName, portalApiUsername, portalApiPassword, decryptor, userCookie);
}
*/
public PortalAuthenticationFilter portalAuthenticationFilterBean() throws ClassNotFoundException,
IllegalAccessException, InstantiationException, InvocationTargetException, NoSuchMethodException {
- logger.debug("portalAuthenticationFilterBean");
+ logger.debug("portalAuthenticationFilterBean: portalapiSecurity {}", portalapiSecurity);
return new PortalAuthenticationFilter(portalapiSecurity, portalAuthManagerBean(), this.userManager);
}
private final DashboardUserManager userManager;
public PortalRestCentralServiceImpl() throws IOException, PortalAPIException {
- final ApplicationContext context = SpringContextCache.getApplicationContext();
- authManager = context.getBean(PortalAuthManager.class);
- userManager = context.getBean(DashboardUserManager.class);
- logger.debug("ctor: authManager has credentials for app {}",
- authManager.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_APP));
- logger.debug("ctor: userManager has list size {}", userManager.getUsers().size());
+ try {
+ final ApplicationContext context = SpringContextCache.getApplicationContext();
+ authManager = context.getBean(PortalAuthManager.class);
+ userManager = context.getBean(DashboardUserManager.class);
+ logger.debug("ctor: authManager fetched credentials for app {}",
+ authManager.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_APP));
+ logger.debug("ctor: userManager has list size {}", userManager.getUsers().size());
+ } catch (Exception ex) {
+ // Log the exception before it's discarded by class
+ // PortalRestAPICentralServiceImpl
+ logger.error("ctor failed", ex);
+ throw ex;
+ }
}
/*
import java.lang.invoke.MethodHandles;
-import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService;
import org.oransc.ric.portal.dashboard.DashboardConstants;
import org.oransc.ric.portal.dashboard.portalapi.PortalAuthManager;
import org.slf4j.Logger;
@Bean
public PortalAuthManager portalAuthManagerBean() throws Exception {
- logger.debug("portalAuthManagerBean");
- return new PortalAuthManager(IPortalRestCentralService.CREDENTIALS_APP, portalApiUsername, portalApiPassword,
+ logger.debug("portalAuthManagerBean: app {}", appName);
+ return new PortalAuthManager(appName, portalApiUsername, portalApiPassword,
decryptor, userCookie);
}
public void contextLoads() {
// Silence Sonar warning about missing assertion.
Assertions.assertTrue(logger.isWarnEnabled());
- logger.info("DefaultContextTest#contextLoads on default profile");
+ logger.info("contextLoads on default profile");
}
}
public void getAnalyticsTest() {
// paths are hardcoded here exactly like the EPSDK-FW library :(
URI uri = buildUri(null, PortalApiConstants.API_PREFIX, "/analytics");
- logger.info("Invoking {}", uri);
+ logger.info("getAnalyticsTest invoking {}", uri);
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, null, String.class);
// No Portal is available so this always fails
Assertions.assertTrue(response.getStatusCode().is4xxClientError());
public void getErrorPageTest() {
// Send unauthorized request
URI uri = buildUri(null, "/favicon.ico");
- logger.info("Invoking {}", uri);
+ logger.info("getErrorPageTest invoking {}", uri);
ResponseEntity<String> response = restTemplate.exchange(uri, HttpMethod.GET, null, String.class);
Assertions.assertTrue(response.getStatusCode().is4xxClientError());
Assertions.assertTrue(response.getBody().contains("Static error page"));
HttpEntity<Object> requestEntity = getEntityWithAuthHeaders(createEcompUser(loginId));
ResponseEntity<String> response = restTemplate.exchange(create, HttpMethod.POST, requestEntity, String.class);
logger.info("createUserTest response {}", response);
+ Assertions.assertNotNull(response);
Assertions.assertTrue(response.getStatusCode().is2xxSuccessful());
}
logger.info("updateUserTest invoking {}", update);
response = restTemplate.exchange(update, HttpMethod.POST, requestEntity, String.class);
logger.info("updateUserTest response {}", response);
+ Assertions.assertNotNull(response);
Assertions.assertTrue(response.getStatusCode().is2xxSuccessful());
}