summaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb3
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb3
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb5
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImpl.java236
-rw-r--r--catalog-be/src/main/resources/portal.properties4
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java1
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImplTest.java151
7 files changed, 399 insertions, 4 deletions
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
index d1d6f642fd..54f7128aa2 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb
@@ -40,4 +40,5 @@ default['DMAAP']['active'] = false
#Portal
default['ECompP']['cipher_key'] = "AGLDdG4D04BKm2IxIWEr8o=="
default['ECompP']['portal_user'] = "Ipwxi2oLvDxctMA1royaRw1W0jhucLx+grHzci3ePIA="
-default['ECompP']['portal_pass'] = "j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI=" \ No newline at end of file
+default['ECompP']['portal_pass'] = "j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI="
+default['ECompP']['portal_app_name'] = "Ipwxi2oLvDxctMA1royaRw1W0jhucLx+grHzci3ePIA=" \ No newline at end of file
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb
index bf724ded5f..4f9993848a 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb
@@ -8,7 +8,8 @@ template "template portal.properties" do
:ecomp_rest_url => node['ECompP']['ecomp_rest_url'],
:ecomp_redirect_url => node['ECompP']['ecomp_redirect_url'],
:ecomp_portal_user => node['ECompP']['portal_user'],
- :ecomp_portal_pass => node['ECompP']['portal_pass']
+ :ecomp_portal_pass => node['ECompP']['portal_pass'],
+ :portal_app_name => node['ECompP']['portal_app_name'],
})
end
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb
index bf58f77d9f..d43c2faa1a 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-portal.properties.erb
@@ -54,14 +54,17 @@ use_rest_for_functional_menu=true
##########################################################################
# Name of java class that implements the OnBoardingApiService interface.
-portal.api.impl.class = org.openecomp.sdc.be.ecomp.EcompIntImpl
+portal.api.impl.class = org.openecomp.sdc.be.ecomp.PortalRestAPICentralServiceImpl
+role_access_centralized = remote
# URL of the Portal where this app is onboarded
ecomp_redirect_url = <%= @ecomp_redirect_url %>
# URL of the ECOMP Portal REST API
ecomp_rest_url = <%= @ecomp_rest_url %>
+
#Portal user & key
portal_user = <%= @ecomp_portal_user %>
portal_pass = <%= @ecomp_portal_pass %>
+portal_app_name = <%= @portal_app_name %>
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImpl.java b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImpl.java
new file mode 100644
index 0000000000..0dd37170d6
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImpl.java
@@ -0,0 +1,236 @@
+package org.openecomp.sdc.be.ecomp;
+
+import fj.data.Either;
+import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService;
+import org.onap.portalsdk.core.onboarding.exception.CipherUtilException;
+import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
+import org.onap.portalsdk.core.onboarding.util.CipherUtil;
+import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
+import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.sdc.be.config.BeEcompErrorManager;
+import org.openecomp.sdc.be.ecomp.converters.EcompUserConverter;
+import org.openecomp.sdc.be.model.User;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
+import org.openecomp.sdc.common.api.Constants;
+import org.openecomp.sdc.common.log.wrappers.Logger;
+import org.openecomp.sdc.exception.ResponseFormat;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.ContextLoader;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+public final class PortalRestAPICentralServiceImpl implements IPortalRestCentralService {
+ private static final String FAILED_TO_UPDATE_USER_CREDENTIALS = "Failed to update user credentials";
+ private static final String FAILED_TO_UPDATE_USER_ROLE = "Failed to update user role";
+ private static final String FAILED_TO_DEACTIVATE_USER = "Failed to deactivate user {}";
+ private static final String FAILED_TO_DEACTIVATE_USER2 = "Failed to deactivate user";
+ private static final String FAILED_TO_EDIT_USER = "Failed to edit user";
+ private static final String EDIT_USER = "EditUser";
+ private static final String CHECK_ROLES = "checkIfSingleRoleProvided";
+ private static final String RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID = "Received null for argument loginId";
+ private static final String RECEIVED_NULL_ROLES = "Received null roles for user";
+ private static final String RECEIVED_MULTIPLE_ROLES = "Received multiple roles for user {}";
+ private static final String RECEIVED_MULTIPLE_ROLES2 = "Received multiple roles for user";
+ private static final String NULL_POINTER_RETURNED_FROM_USER_CONVERTER = "NULL pointer returned from user converter";
+ private static final String FAILED_TO_CREATE_USER = "Failed to create user {}";
+ private static final String FAILED_TO_CONVERT_USER = "Failed to convert user";
+ private static final String JH0003 = "jh0003";
+ private static final String PUSH_USER = "PushUser";
+ private static final String RECEIVED_NULL_FOR_ARGUMENT_USER = "Received null for argument user";
+ private static final Logger log = Logger.getLogger(PortalRestAPICentralServiceImpl.class);
+
+ public PortalRestAPICentralServiceImpl() {
+ log.debug("PortalRestAPICentralServiceImpl Class Instantiated");
+ }
+
+ //TODO put username password and appName into portal properties
+ @Override
+ public Map<String, String> getAppCredentials() throws PortalAPIException {
+ Map<String, String> credMap = new HashMap<>();
+ String portal_user = PortalApiProperties.getProperty(PortalPropertiesEnum.PORTAL_USER.value);
+ String password = PortalApiProperties.getProperty(PortalPropertiesEnum.PORTAL_PASS.value);
+ String appName = PortalApiProperties.getProperty(PortalPropertiesEnum.PORTAL_APP_NAME.value);
+ try {
+ credMap.put(PortalPropertiesEnum.PORTAL_USER.value, CipherUtil.decryptPKC(portal_user));
+ credMap.put(PortalPropertiesEnum.PORTAL_PASS.value, CipherUtil.decryptPKC(password));
+ credMap.put(PortalPropertiesEnum.PORTAL_APP_NAME.value, CipherUtil.decryptPKC(appName));
+ } catch (CipherUtilException e) {
+ log.debug("User authentication failed - Decryption failed", e);
+ throw new PortalAPIException("Failed to decrypt" + e.getMessage());
+ }
+
+ return credMap;
+ }
+
+ @Override
+ public void pushUser(EcompUser user) throws PortalAPIException {
+ log.debug("Start handle request of ECOMP pushUser");
+
+ if (user == null) {
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, BeEcompErrorManager.ErrorSeverity.INFO);
+ log.debug(RECEIVED_NULL_FOR_ARGUMENT_USER);
+ throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_USER);
+ }
+ checkIfSingleRoleProvided(user);
+ UserBusinessLogic userBusinessLogic = getUserBusinessLogic();
+
+ final String modifierAttId = JH0003;
+ User modifier = new User();
+ modifier.setUserId(modifierAttId);
+ log.debug("modifier id is {}", modifierAttId);
+
+ Either<User, String> newASDCUser = EcompUserConverter.convertEcompUserToUser(user);
+ if (newASDCUser.isRight()) {
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_CONVERT_USER, BeEcompErrorManager.ErrorSeverity.INFO);
+ log.debug(FAILED_TO_CREATE_USER, user);
+ throw new PortalAPIException("Failed to create user " + newASDCUser.right().value());
+ } else if (newASDCUser.left().value() == null) {
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, NULL_POINTER_RETURNED_FROM_USER_CONVERTER, BeEcompErrorManager.ErrorSeverity.INFO);
+ log.debug(FAILED_TO_CREATE_USER, user);
+ throw new PortalAPIException("Failed to create user " + newASDCUser.right().value());
+ }
+
+ User convertedAsdcUser = newASDCUser.left().value();
+ Either<User, ResponseFormat> createUserResponse = userBusinessLogic.createUser(modifier, convertedAsdcUser);
+
+ // ALREADY EXIST ResponseFormat
+ final String ALREADY_EXISTS_RESPONSE_ID = "SVC4006";
+
+ if (createUserResponse.isRight()) {
+ if (!createUserResponse.right().value().getMessageId().equals(ALREADY_EXISTS_RESPONSE_ID)) {
+ log.debug(FAILED_TO_CREATE_USER, user);
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_CREATE_USER, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_CREATE_USER + createUserResponse.right());
+ } else {
+ log.debug("User already exist and will be updated and reactivated {}", user);
+ Either<User, ResponseFormat> updateUserResp = userBusinessLogic.updateUserCredentials(convertedAsdcUser);
+ if(updateUserResp.isRight()){
+ log.debug(FAILED_TO_UPDATE_USER_CREDENTIALS, user);
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_UPDATE_USER_CREDENTIALS, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_UPDATE_USER_CREDENTIALS + createUserResponse.right());
+ }
+ Either<User, ResponseFormat> updateUserRoleResp = userBusinessLogic.updateUserRole(modifier, convertedAsdcUser.getUserId(), convertedAsdcUser.getRole());
+ if(updateUserRoleResp.isRight()){
+ log.debug(FAILED_TO_UPDATE_USER_ROLE, user);
+ BeEcompErrorManager.getInstance().logInvalidInputError(PUSH_USER, FAILED_TO_UPDATE_USER_ROLE, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_UPDATE_USER_ROLE + createUserResponse.right());
+ }
+ }
+
+ }
+ log.debug("User created {}", user);
+ }
+
+ @Override
+ public void editUser(String loginId, EcompUser user) throws PortalAPIException {
+ log.debug("Start handle request of ECOMP editUser");
+
+ if (user == null) {
+ log.debug(RECEIVED_NULL_FOR_ARGUMENT_USER);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_USER, BeEcompErrorManager.ErrorSeverity.INFO);
+ throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_USER);
+ } else if (loginId == null) {
+ log.debug(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID, BeEcompErrorManager.ErrorSeverity.INFO);
+ throw new PortalAPIException(RECEIVED_NULL_FOR_ARGUMENT_LOGIN_ID);
+ }
+
+ checkIfSingleRoleProvided(user);
+ UserBusinessLogic userBusinessLogic = getUserBusinessLogic();
+
+ final String modifierAttId = JH0003;
+ User modifier = new User();
+ modifier.setUserId(modifierAttId);
+ log.debug("modifier id is {}", modifierAttId);
+
+ if (user.getLoginId() != null && !user.getLoginId().equals(loginId)) {
+ log.debug("loginId and user loginId not equal");
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, "loginId and user loginId not equal", BeEcompErrorManager.ErrorSeverity.INFO);
+ throw new PortalAPIException("loginId not equals to the user loginId field");
+ } else if (user.getLoginId() == null) {
+ user.setLoginId(loginId);
+ }
+
+ Either<User, String> convertorResp = EcompUserConverter.convertEcompUserToUser(user);
+ if (convertorResp.isRight()) {
+ log.debug(FAILED_TO_CONVERT_USER);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, FAILED_TO_CONVERT_USER, BeEcompErrorManager.ErrorSeverity.INFO);
+ throw new PortalAPIException(convertorResp.right().value());
+ } else if (convertorResp.left().value() == null) {
+ log.debug(NULL_POINTER_RETURNED_FROM_USER_CONVERTER);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, NULL_POINTER_RETURNED_FROM_USER_CONVERTER, BeEcompErrorManager.ErrorSeverity.INFO);
+ throw new PortalAPIException(FAILED_TO_EDIT_USER);
+ }
+
+ User asdcUser = convertorResp.left().value();
+ Either<User, ResponseFormat> updateUserCredentialsResponse = userBusinessLogic.updateUserCredentials(asdcUser);
+
+ if (updateUserCredentialsResponse.isRight()) {
+ log.debug(FAILED_TO_UPDATE_USER_CREDENTIALS);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, FAILED_TO_UPDATE_USER_CREDENTIALS, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_EDIT_USER + updateUserCredentialsResponse.right().value());
+ }
+
+ Either<User, ResponseFormat> deActivateUser;
+
+ if(asdcUser.getRole() == null || asdcUser.getRole().isEmpty()){
+ deActivateUser = userBusinessLogic.deActivateUser(modifier, asdcUser.getUserId());
+ } else {
+ return;
+ }
+
+ if (deActivateUser.isRight()) {
+ log.debug(FAILED_TO_DEACTIVATE_USER, asdcUser);
+ BeEcompErrorManager.getInstance().logInvalidInputError(EDIT_USER, FAILED_TO_DEACTIVATE_USER2, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_DEACTIVATE_USER2 + deActivateUser.right().value());
+ }
+ }
+
+ @Override
+ public String getUserId(HttpServletRequest request) throws PortalAPIException {
+ return request.getHeader(Constants.USER_ID_HEADER);
+ }
+
+ private UserBusinessLogic getUserBusinessLogic() throws PortalAPIException {
+ UserBusinessLogic ubl = null;
+ try {
+ ApplicationContext ctx = ContextLoader.getCurrentWebApplicationContext();
+ ubl = (UserBusinessLogic) ctx.getBean("userBusinessLogic");
+ } catch (Exception e) {
+ log.debug("Failed to get user UserBusinessLogic", e);
+ BeEcompErrorManager.getInstance().logInvalidInputError("getUserBusinessLogic", "Exception thrown" + e.getMessage(), BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException("SDC Internal server error");
+ }
+ return ubl;
+ }
+
+ private void checkIfSingleRoleProvided(EcompUser user) throws PortalAPIException {
+ if(user.getRoles() == null) {
+ log.debug(RECEIVED_NULL_ROLES, user);
+ BeEcompErrorManager.getInstance().logInvalidInputError(CHECK_ROLES, RECEIVED_NULL_ROLES, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(RECEIVED_NULL_ROLES + user);
+ }else if(user.getRoles().size() > 1) {
+ log.debug(RECEIVED_MULTIPLE_ROLES, user);
+ BeEcompErrorManager.getInstance().logInvalidInputError(CHECK_ROLES, RECEIVED_MULTIPLE_ROLES2, BeEcompErrorManager.ErrorSeverity.ERROR);
+ throw new PortalAPIException(FAILED_TO_DEACTIVATE_USER2 + user);
+ }
+ }
+
+ public enum PortalPropertiesEnum{
+ PORTAL_PASS ("portal_pass"),
+ PORTAL_USER("portal_user"),
+ PORTAL_APP_NAME("portal_app_name");
+
+ private final String value;
+
+ PortalPropertiesEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
+ }
+ }
+}
diff --git a/catalog-be/src/main/resources/portal.properties b/catalog-be/src/main/resources/portal.properties
index fbedd05028..185a4fb9dc 100644
--- a/catalog-be/src/main/resources/portal.properties
+++ b/catalog-be/src/main/resources/portal.properties
@@ -53,7 +53,8 @@ use_rest_for_functional_menu=true
##########################################################################
# Name of java class that implements the OnBoardingApiService interface.
-portal.api.impl.class = org.openecomp.sdc.be.ecomp.EcompIntImpl
+portal.api.impl.class = org.openecomp.sdc.be.ecomp.PortalRestAPICentralServiceImpl
+role_access_centralized = remote
# URL of the Portal where this app is onboarded
ecomp_redirect_url = http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm
@@ -67,6 +68,7 @@ ueb_listeners_enable = false
#Portal user & key
portal_user = Ipwxi2oLvDxctMA1royaRw1W0jhucLx+grHzci3ePIA=
portal_pass = j85yNhyIs7zKYbR1VlwEfNhS6b7Om4l0Gx5O8931sCI=
+portal_app_name = Ipwxi2oLvDxctMA1royaRw1W0jhucLx+grHzci3ePIA=
# UEB Configuration
# If key ueb_listeners_enable is set to false,
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
index 6ba28fe103..20f7f1874a 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/BaseServiceBusinessLogicTest.java
@@ -48,6 +48,7 @@ import java.util.Map;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
+
public abstract class BaseServiceBusinessLogicTest {
private static final String SERVICE_CATEGORY = "Mobility";
final ServletContext servletContext = Mockito.mock(ServletContext.class);
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImplTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImplTest.java
new file mode 100644
index 0000000000..552d2dd4a6
--- /dev/null
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/ecomp/PortalRestAPICentralServiceImplTest.java
@@ -0,0 +1,151 @@
+package org.openecomp.sdc.be.ecomp;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
+import org.onap.portalsdk.core.restful.domain.EcompRole;
+import org.onap.portalsdk.core.restful.domain.EcompUser;
+import org.openecomp.sdc.be.user.UserBusinessLogic;
+import org.springframework.web.context.ContextLoader;
+import org.springframework.web.context.WebApplicationContext;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+public class PortalRestAPICentralServiceImplTest {
+ @Mock
+ ContextLoader conLoader;
+ @Mock
+ WebApplicationContext apContext;
+ @Mock
+ UserBusinessLogic userBusinessLogic;
+ @Mock
+ ContextLoader ctx;
+ @InjectMocks
+ PortalRestAPICentralServiceImpl testSubject;
+
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testGetAppCredentials() throws Exception {
+ Map<String, String> appCredentials = testSubject.getAppCredentials();
+ Assert.assertTrue(appCredentials.get(PortalRestAPICentralServiceImpl.PortalPropertiesEnum.PORTAL_APP_NAME.value()).equals("sdc"));
+ Assert.assertTrue(appCredentials.get(PortalRestAPICentralServiceImpl.PortalPropertiesEnum.PORTAL_USER.value()).equals("sdc"));
+ Assert.assertTrue(appCredentials.get(PortalRestAPICentralServiceImpl.PortalPropertiesEnum.PORTAL_PASS.value()).equals("asdc"));
+ }
+
+ /*@Test
+ public void testPushUser() throws Exception {
+ EcompUser user = new EcompUser();
+ Set<EcompRole> roleSet = new HashSet<>();
+ EcompRole role = new EcompRole();
+ role.setId(1L);
+ role.setName("Designer");
+ roleSet.add(role);
+ user.setRoles(roleSet);
+ testSubject.pushUser(user);
+ }*/
+
+ @Test
+ public void testPushUserNullRoles() throws Exception {
+ EcompUser user = new EcompUser();
+ try{
+ testSubject.pushUser(user);
+ } catch (PortalAPIException e){
+ Assert.assertTrue(e.getMessage().equals("Received null roles for user" + user));
+ }
+
+ }
+
+ @Test
+ public void testPushUserUserNull() throws Exception {
+ try {
+ testSubject.pushUser(null);
+ } catch (PortalAPIException e) {
+ Assert.assertTrue(e.getMessage().equals("Received null for argument user"));
+ }
+
+ }
+
+ /**
+ *
+ * Method: editUser(String loginId, EcompUser user)
+ *
+ */
+ @Test
+ public void testEditUser() throws Exception {
+ //TODO: Test goes here...
+ }
+
+ /**
+ *
+ * Method: getUserId(HttpServletRequest request)
+ *
+ */
+ @Test
+ public void testGetUserId() throws Exception {
+ //TODO: Test goes here...
+ }
+
+ /**
+ *
+ * Method: value()
+ *
+ */
+ @Test
+ public void testValue() throws Exception {
+ //TODO: Test goes here...
+ }
+
+
+ /**
+ *
+ * Method: getUserBusinessLogic()
+ *
+ */
+ @Test
+ public void testGetUserBusinessLogic() throws Exception {
+ //TODO: Test goes here...
+
+ try {
+ Method method = testSubject.getClass().getMethod("getUserBusinessLogic");
+ method.setAccessible(true);
+ method.invoke(testSubject);
+ } catch(NoSuchMethodException e) {
+ } catch(IllegalAccessException e) {
+ } catch(InvocationTargetException e) {
+ }
+ }
+
+ /**
+ *
+ * Method: checkIfSingleRoleProvided(EcompUser user)
+ *
+ */
+ @Test
+ public void testCheckIfSingleRoleProvided() throws Exception {
+ //TODO: Test goes here...
+ /*
+ try {
+ Method method = PortalRestAPICentralServiceImpl.getClass().getMethod("checkIfSingleRoleProvided", EcompUser.class);
+ method.setAccessible(true);
+ method.invoke(<Object>, <Parameters>);
+ } catch(NoSuchMethodException e) {
+ } catch(IllegalAccessException e) {
+ } catch(InvocationTargetException e) {
+ }
+ */
+ }
+
+}