diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java index 0ed8e27..a436904 100644 --- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java +++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/ServerUtils.java @@ -46,9 +46,9 @@ public class ServerUtils { if (user == null) { - logger.warn("USER IS NULL setting " + UserStatisticsServiceImpl.defaultUserId + " and Running OUTSIDE PORTAL"); + logger.warn("USER IS NULL setting " + UserStatisticsServiceImpl.TEST_USER + " and Running OUTSIDE PORTAL"); user = getDevelopmentUser(); - SessionManager.getInstance().getASLSession(sessionID, user).setScope(UserStatisticsServiceImpl.vreID); + SessionManager.getInstance().getASLSession(sessionID, user).setScope(UserStatisticsServiceImpl.TEST_CONTEXT); } @@ -60,7 +60,7 @@ public class ServerUtils { * @return . */ public static String getDevelopmentUser() { - String user = UserStatisticsServiceImpl.defaultUserId; + String user = UserStatisticsServiceImpl.TEST_USER; // user = "costantino.perciante"; return user; } diff --git a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java index 4258fab..a851a0c 100644 --- a/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java +++ b/src/main/java/org/gcube/portlet/user/userstatisticsportlet/server/UserStatisticsServiceImpl.java @@ -40,8 +40,8 @@ import com.liferay.portal.service.UserLocalServiceUtil; public class UserStatisticsServiceImpl extends RemoteServiceServlet implements UserStatisticsService { private static final org.slf4j.Logger logger = LoggerFactory.getLogger(UserStatisticsServiceImpl.class); - public static final String defaultUserId = "test.user"; - public static final String vreID = "/gcube/devsec/devVRE"; + public static final String TEST_USER = "test.user"; + public static final String TEST_CONTEXT = "/gcube/devsec/devVRE"; private DatabookStore store; private static final String CUSTOM_FIELD_NAME_USER_STATISTICS_VISIBILITY = "show_user_statistics_other_people"; private UserManager userManager = new LiferayUserManager(); @@ -70,7 +70,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U if(userid != null && !userid.equals(userName)) statisticsOfUsername = userid; - if (userName.compareTo(defaultUserId) == 0) { + if (userName.compareTo(TEST_USER) == 0) { logger.debug("Found " + userName + " returning nothing"); return null; }else{ @@ -105,7 +105,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U if(userid != null && !userid.equals(userName)) statisticsOfUsername = userid; - if (userName.compareTo(defaultUserId) == 0) { + if (userName.compareTo(TEST_USER) == 0) { logger.debug("Found " + userName + " returning nothing"); return profileStrenght; }else{ @@ -143,7 +143,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U logger.info("Is profile showable for user " + userid + " " + isProfileShowable); } - if (userName.compareTo(defaultUserId) == 0) { + if (userName.compareTo(TEST_USER) == 0) { logger.debug("Found " + userName + " returning nothing"); return null; } @@ -172,7 +172,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U return bean; } else - return new UserInformation(true, null, userName, vreID, true, true); + return new UserInformation(true, null, userName, TEST_CONTEXT, true, true); } /** @@ -202,7 +202,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U String userName = session.getUsername(); String scope = session.getScope(); - if (userName.compareTo(defaultUserId) == 0) { + if (userName.compareTo(TEST_USER) == 0) { logger.debug("Found " + userName + " returning nothing"); return null; } @@ -283,7 +283,7 @@ public class UserStatisticsServiceImpl extends RemoteServiceServlet implements U if(ServerUtils.isWithinPortal()){ ASLSession session = ServerUtils.getASLSession(this.getThreadLocalRequest().getSession()); String username = session.getUsername(); - if (username.compareTo(defaultUserId) == 0) { + if (username.compareTo(TEST_USER) == 0) { logger.debug("Found " + username + " returning nothing"); return; } diff --git a/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java b/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java index ae686d1..e652fc1 100644 --- a/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java +++ b/src/test/java/org/gcube/portlet/user/userstatisticsportlet/client/TestForDeploy.java @@ -12,7 +12,7 @@ public class TestForDeploy { public void testUserIsTestUser() { String username = ServerUtils.getDevelopmentUser(); System.out.println("username for deploy is: " + username); - assertTrue(username.compareTo(UserStatisticsServiceImpl.defaultUserId) == 0); + assertTrue(username.compareTo(UserStatisticsServiceImpl.TEST_USER) == 0); System.out.println("Test OK!"); }