[kune-commits] r1411 - in trunk/src: main/java/cc/kune/core/client/sn main/java/cc/kune/core/server main/java/cc/kune/core/server/auth main/java/cc/kune/core/server/manager main/java/cc/kune/core/server/manager/impl main/java/cc/kune/core/server/rpc main/java/cc/kune/gspace/client/resources test/java/cc/kune/core/server/integration/site
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sat Jun 18 23:57:55 CEST 2011
Author: vjrj_
Date: 2011-06-18 23:57:55 +0200 (Sat, 18 Jun 2011)
New Revision: 1411
Added:
trunk/src/main/java/cc/kune/core/server/CustomPersistFilter.java
Modified:
trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/cc/kune/core/server/manager/UserManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/RPC.java
trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css
trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
Log:
Added Guice Persist Filter
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPanel.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -44,6 +44,7 @@
setVisibleImpl(false);
mainTitle.setText(i18n.t("His/her network:"));
mainTitle.setTitle(i18n.t("This user buddies and groups where participes"));
+ firstCategoryLabel.setText(i18n.t("Buddies"));
setTooltip(firstCategoryLabel, i18n.t("This user buddies"));
sndCategoryLabel.setText(i18n.t("Participates in"));
setTooltip(sndCategoryLabel, i18n.t("Groups in which this user participates"));
@@ -72,7 +73,9 @@
@Override
public void addTextToBuddieList(final String text) {
- firstCategoryFlow.add(new Label(text));
+ final Label label = new Label(text);
+ label.addStyleName("k-sn-collabsCountlabel");
+ firstCategoryFlow.add(label);
}
@Override
Added: trunk/src/main/java/cc/kune/core/server/CustomPersistFilter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/CustomPersistFilter.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/CustomPersistFilter.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -0,0 +1,109 @@
+/**
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cc.kune.core.server;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.persist.PersistService;
+import com.google.inject.persist.UnitOfWork;
+
+/**
+ * Apply this filter to enable the HTTP Request unit of work and to have
+ * guice-persist manage the lifecycle of active units of work. The filter
+ * automatically starts and stops the relevant {@link PersistService} upon
+ * {@link javax.servlet.Filter#init(javax.servlet.FilterConfig)} and
+ * {@link javax.servlet.Filter#destroy()} respectively.
+ *
+ * <p>
+ * To be able to use the open session-in-view pattern (i.e. work per request),
+ * register this filter <b>once</b> in your Guice {@code ServletModule}. It is
+ * important that you register this filter before any other filter.
+ *
+ * For multiple providers, you should register this filter once per provider,
+ * inside a private module for each persist module installed (this must be the
+ * same private module where the specific persist module is itself installed).
+ *
+ * <p>
+ * Example configuration:
+ *
+ * <pre>
+ * {
+ * @code
+ * public class MyModule extends ServletModule {
+ * public void configureServlets() {
+ * filter("/*").through(PersistFilter.class);
+ *
+ * serve("/index.html").with(MyHtmlServlet.class);
+ * // Etc.
+ * }
+ * }
+ * }
+ * </pre>
+ * <p>
+ * This filter is thread safe and allows you to create injectors concurrently
+ * and deploy multiple guice-persist modules within the same injector, or even
+ * multiple injectors with persist modules withing the same JVM or web app.
+ * <p>
+ * This filter requires the Guice Servlet extension.
+ *
+ * @author Dhanji R. Prasanna (dhanji at gmail.com)
+ *
+ * (Custom PersistFilter.class modified for kune needs without
+ * persistence start/stop)
+ */
+
+ at Singleton
+public class CustomPersistFilter implements Filter {
+ private final PersistService persistService;
+ private final UnitOfWork unitOfWork;
+
+ @Inject
+ public CustomPersistFilter(final UnitOfWork unitOfWork, final PersistService persistService) {
+ this.unitOfWork = unitOfWork;
+ this.persistService = persistService;
+ }
+
+ @Override
+ public void destroy() {
+ // persistService.stop();
+ }
+
+ @Override
+ public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse,
+ final FilterChain filterChain) throws IOException, ServletException {
+
+ unitOfWork.begin();
+ try {
+ filterChain.doFilter(servletRequest, servletResponse);
+ } finally {
+ unitOfWork.end();
+ }
+ }
+
+ @Override
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ // persistService.start();
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/cc/kune/core/server/CustomPersistFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -146,7 +146,13 @@
private void installGuiceModules(final RackBuilder builder) {
// https://code.google.com/p/google-guice/wiki/ServletModule
- builder.use(new ServletModule());
+ builder.use(new ServletModule() {
+ @Override
+ protected void configureServlets() {
+ filter("/*").through(CustomPersistFilter.class);
+ super.configureServlets();
+ }
+ });
builder.use(new PlatformServerModule());
builder.use(new DocumentServerModule());
builder.use(new BlogServerModule());
Modified: trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -32,7 +32,6 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.persist.UnitOfWork;
public class AuthenticatedMethodInterceptor implements MethodInterceptor {
@@ -45,17 +44,16 @@
Provider<SessionService> sessionServiceProvider;
// https://code.google.com/p/google-guice/wiki/Transactions
+ // @Inject
+ // private UnitOfWork unitOfWork;
@Inject
- private UnitOfWork unitOfWork;
-
- @Inject
Provider<UserSession> userSessionProvider;
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
// https://code.google.com/p/google-guice/wiki/Transactions
- unitOfWork.end();
- unitOfWork.begin();
+ // unitOfWork.end();
+ // unitOfWork.begin();
try {
final Object[] arguments = invocation.getArguments();
// Some browsers getCookie returns "null" as String instead of null
@@ -95,7 +93,7 @@
final Object result = invocation.proceed();
return result;
} finally {
- unitOfWork.end();
+ // unitOfWork.end();
}
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/UserManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/UserManager.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/manager/UserManager.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -23,47 +23,50 @@
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.server.manager.impl.SearchResult;
+import cc.kune.core.shared.domain.UserSNetVisibility;
import cc.kune.domain.User;
import cc.kune.domain.utils.UserBuddiesData;
public interface UserManager {
- /**
- * CreateUser new method with language country and timezone params
- *
- * @param shortName
- * @param longName
- * @param email
- * @param passwd
- * @param timezone
- * @param country
- * @param language
- * @param timezone
- * @return User
- * @throws I18nNotFoundException
- */
- User createUser(String shortName, String longName, String email, String passwd, String language, String country,
- String timezone) throws I18nNotFoundException;
+ /**
+ * CreateUser new method with language country and timezone params
+ *
+ * @param shortName
+ * @param longName
+ * @param email
+ * @param passwd
+ * @param timezone
+ * @param country
+ * @param language
+ * @param timezone
+ * @return User
+ * @throws I18nNotFoundException
+ */
+ User createUser(String shortName, String longName, String email, String passwd, String language,
+ String country, String timezone) throws I18nNotFoundException;
- void createWaveAccount(String shortName, PasswordDigest passwdDigest);
+ void createWaveAccount(String shortName, PasswordDigest passwdDigest);
- /**
- * IMPORTANT: if userId == null, it returns User.UNKNOWN_USER
- *
- * @param userId
- * @return
- */
- User find(Long userId);
+ /**
+ * IMPORTANT: if userId == null, it returns User.UNKNOWN_USER
+ *
+ * @param userId
+ * @return
+ */
+ User find(Long userId);
- User findByShortname(String shortName);
+ User findByShortname(String shortName);
- UserBuddiesData getUserBuddies(String shortName);
+ UserBuddiesData getUserBuddies(String shortName);
- User login(String nickOrEmail, String passwd);
+ User login(String nickOrEmail, String passwd);
- void reIndex();
+ void reIndex();
- SearchResult<User> search(String search);
+ SearchResult<User> search(String search);
- SearchResult<User> search(String search, Integer firstResult, Integer maxResults);
+ SearchResult<User> search(String search, Integer firstResult, Integer maxResults);
+ void setSNetVisibility(User user, UserSNetVisibility visibility);
+
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -49,6 +49,7 @@
import cc.kune.core.server.xmpp.ChatConnection;
import cc.kune.core.server.xmpp.ChatException;
import cc.kune.core.server.xmpp.XmppManager;
+import cc.kune.core.shared.domain.UserSNetVisibility;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.domain.I18nCountry;
import cc.kune.domain.I18nLanguage;
@@ -283,4 +284,10 @@
return super.search(query, firstResult, maxResults);
}
+ @Override
+ public void setSNetVisibility(final User user, final UserSNetVisibility visibility) {
+ user.setSNetVisibility(visibility);
+ persist(user);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -68,10 +68,8 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
- at Singleton
public class ContentRPC implements ContentService, RPC {
private final AccessService accessService;
private final ChatManager chatManager;
Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -43,10 +43,8 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
- at Singleton
public class GroupRPC implements RPC, GroupService {
private final ContentManager contentManager;
private final GroupManager groupManager;
Modified: trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -24,7 +24,6 @@
import javax.persistence.NoResultException;
import javax.servlet.http.HttpServletRequest;
-
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.rpcservices.I18nService;
@@ -39,95 +38,94 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
- at Singleton
public class I18nRPC implements RPC, I18nService {
- private final I18nTranslationManager i18nTranslationManager;
- private final I18nLanguageManager languageManager;
- private final Mapper mapper;
- private final Provider<HttpServletRequest> requestProvider;
- private final Provider<UserSession> userSessionProvider;
+ private final I18nTranslationManager i18nTranslationManager;
+ private final I18nLanguageManager languageManager;
+ private final Mapper mapper;
+ private final Provider<HttpServletRequest> requestProvider;
+ private final Provider<UserSession> userSessionProvider;
- @Inject
- public I18nRPC(final Provider<HttpServletRequest> requestProvider, final Provider<UserSession> userSessionProvider,
- final I18nTranslationManager i18nTranslationManager, final I18nLanguageManager languageManager,
- final Mapper mapper) {
- this.requestProvider = requestProvider;
- this.userSessionProvider = userSessionProvider;
- this.i18nTranslationManager = i18nTranslationManager;
- this.languageManager = languageManager;
- this.mapper = mapper;
- }
+ @Inject
+ public I18nRPC(final Provider<HttpServletRequest> requestProvider,
+ final Provider<UserSession> userSessionProvider,
+ final I18nTranslationManager i18nTranslationManager, final I18nLanguageManager languageManager,
+ final Mapper mapper) {
+ this.requestProvider = requestProvider;
+ this.userSessionProvider = userSessionProvider;
+ this.i18nTranslationManager = i18nTranslationManager;
+ this.languageManager = languageManager;
+ this.mapper = mapper;
+ }
- @Override
- @Transactional
- public I18nLanguageDTO getInitialLanguage(final String localeParam) {
- String initLanguage;
- I18nLanguage lang;
- final UserSession userSession = getUserSession();
- if (localeParam != null) {
- initLanguage = localeParam;
+ @Override
+ @Transactional
+ public I18nLanguageDTO getInitialLanguage(final String localeParam) {
+ String initLanguage;
+ I18nLanguage lang;
+ final UserSession userSession = getUserSession();
+ if (localeParam != null) {
+ initLanguage = localeParam;
+ } else {
+ if (userSession.isUserLoggedIn()) {
+ initLanguage = userSession.getUser().getLanguage().getCode();
+ } else {
+ final String browserLang = requestProvider.get().getLocale().getLanguage();
+ if (browserLang != null) {
+ // Not logged, use browser language if possible
+ final String country = requestProvider.get().getLocale().getCountry();
+ if (browserLang.equals("pt") && country != null && country.equals("BR")) {
+ // FIXME: the only supported rfc 3066 lang supported
+ initLanguage = "pt-br";
+ } else {
+ initLanguage = browserLang;
+ }
} else {
- if (userSession.isUserLoggedIn()) {
- initLanguage = userSession.getUser().getLanguage().getCode();
- } else {
- final String browserLang = requestProvider.get().getLocale().getLanguage();
- if (browserLang != null) {
- // Not logged, use browser language if possible
- final String country = requestProvider.get().getLocale().getCountry();
- if (browserLang.equals("pt") && country != null && country.equals("BR")) {
- // FIXME: the only supported rfc 3066 lang supported
- initLanguage = "pt-br";
- } else {
- initLanguage = browserLang;
- }
- } else {
- initLanguage = I18nTranslation.DEFAULT_LANG;
- }
- }
+ initLanguage = I18nTranslation.DEFAULT_LANG;
}
- try {
- lang = languageManager.findByCode(initLanguage);
- } catch (final NoResultException e) {
- lang = languageManager.findByCode(I18nTranslation.DEFAULT_LANG);
- }
- return mapper.map(lang, I18nLanguageDTO.class);
+ }
}
-
- @Override
- @Transactional
- public HashMap<String, String> getLexicon(final String language) {
- return i18nTranslationManager.getLexicon(language);
+ try {
+ lang = languageManager.findByCode(initLanguage);
+ } catch (final NoResultException e) {
+ lang = languageManager.findByCode(I18nTranslation.DEFAULT_LANG);
}
+ return mapper.map(lang, I18nLanguageDTO.class);
+ }
- @Override
- @Transactional
- public String getTranslation(final String userHash, final String language, final String text) {
- String translation = null;
- try {
- translation = getTranslationWrapper(language, text);
- } catch (final SessionExpiredException e) {
- }
- return translation;
- }
+ @Override
+ @Transactional
+ public HashMap<String, String> getLexicon(final String language) {
+ return i18nTranslationManager.getLexicon(language);
+ }
- @Authenticated(mandatory = false)
- private String getTranslationWrapper(final String language, final String text) {
- return i18nTranslationManager.getTranslation(language, text);
+ @Override
+ @Transactional
+ public String getTranslation(final String userHash, final String language, final String text) {
+ String translation = null;
+ try {
+ translation = getTranslationWrapper(language, text);
+ } catch (final SessionExpiredException e) {
}
+ return translation;
+ }
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
+ @Authenticated(mandatory = false)
+ private String getTranslationWrapper(final String language, final String text) {
+ return i18nTranslationManager.getTranslation(language, text);
+ }
- @Override
- @Authenticated
- @Transactional
- public String setTranslation(final String userHash, final String id, final String translation)
- throws DefaultException {
- return i18nTranslationManager.setTranslation(id, translation);
- }
+ private UserSession getUserSession() {
+ return userSessionProvider.get();
+ }
+ @Override
+ @Authenticated
+ @Transactional
+ public String setTranslation(final String userHash, final String id, final String translation)
+ throws DefaultException {
+ return i18nTranslationManager.setTranslation(id, translation);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/RPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/RPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/RPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.server.rpc;
+import com.google.inject.Singleton;
+
/**
* marker interface (should not contain any method!)
*
@@ -32,6 +34,7 @@
* </ul>
*
*/
+ at Singleton
public interface RPC {
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -41,10 +41,8 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
- at Singleton
public class SiteRPC implements RPC, SiteService {
private final ChatProperties chatProperties;
private final I18nCountryManager countryManager;
Modified: trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -37,196 +37,197 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.persist.Transactional;
- at Singleton
public class SocialNetworkRPC implements SocialNetworkService, RPC {
- private final GroupManager groupManager;
- private final Mapper mapper;
- private final SocialNetworkManager socialNetworkManager;
- private final Provider<UserSession> userSessionProvider;
+ private final GroupManager groupManager;
+ private final Mapper mapper;
+ private final SocialNetworkManager socialNetworkManager;
+ private final Provider<UserSession> userSessionProvider;
- @Inject
- public SocialNetworkRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
- final SocialNetworkManager socialNetworkManager, final Mapper mapper) {
- this.userSessionProvider = userSessionProvider;
- this.groupManager = groupManager;
- this.socialNetworkManager = socialNetworkManager;
- this.mapper = mapper;
- }
+ @Inject
+ public SocialNetworkRPC(final Provider<UserSession> userSessionProvider,
+ final GroupManager groupManager, final SocialNetworkManager socialNetworkManager,
+ final Mapper mapper) {
+ this.userSessionProvider = userSessionProvider;
+ this.groupManager = groupManager;
+ this.socialNetworkManager = socialNetworkManager;
+ this.mapper = mapper;
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO acceptJoinGroup(final String hash, final StateToken groupToken,
- final String groupToAcceptShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToAccept = groupManager.findByShortName(groupToAcceptShortName);
- socialNetworkManager.acceptJoinGroup(userLogged, groupToAccept, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO acceptJoinGroup(final String hash, final StateToken groupToken,
+ final String groupToAcceptShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToAccept = groupManager.findByShortName(groupToAcceptShortName);
+ socialNetworkManager.acceptJoinGroup(userLogged, groupToAccept, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO addAdminMember(final String hash, final StateToken groupToken,
- final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
- socialNetworkManager.addGroupToAdmins(userLogged, groupToAdd, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO addAdminMember(final String hash, final StateToken groupToken,
+ final String groupToAddShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
+ socialNetworkManager.addGroupToAdmins(userLogged, groupToAdd, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO addCollabMember(final String hash, final StateToken groupToken,
- final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
- socialNetworkManager.addGroupToCollabs(userLogged, groupToAdd, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO addCollabMember(final String hash, final StateToken groupToken,
+ final String groupToAddShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
+ socialNetworkManager.addGroupToCollabs(userLogged, groupToAdd, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO addViewerMember(final String hash, final StateToken groupToken,
- final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
- socialNetworkManager.addGroupToViewers(userLogged, groupToAdd, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO addViewerMember(final String hash, final StateToken groupToken,
+ final String groupToAddShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
+ socialNetworkManager.addGroupToViewers(userLogged, groupToAdd, group);
+ return generateResponse(userLogged, group);
+ }
- private void checkIsNotPersonalGroup(final Group group) {
- if (group.isPersonal()) {
- throw new DefaultException();
- }
- ;
+ private void checkIsNotPersonalGroup(final Group group) {
+ if (group.isPersonal()) {
+ throw new DefaultException();
}
+ ;
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO deleteMember(final String hash, final StateToken groupToken,
- final String groupToDeleleShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToDelete = groupManager.findByShortName(groupToDeleleShortName);
- socialNetworkManager.deleteMember(userLogged, groupToDelete, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO deleteMember(final String hash, final StateToken groupToken,
+ final String groupToDeleleShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToDelete = groupManager.findByShortName(groupToDeleleShortName);
+ socialNetworkManager.deleteMember(userLogged, groupToDelete, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO denyJoinGroup(final String hash, final StateToken groupToken,
- final String groupToDenyShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToDenyJoin = groupManager.findByShortName(groupToDenyShortName);
- socialNetworkManager.denyJoinGroup(userLogged, groupToDenyJoin, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO denyJoinGroup(final String hash, final StateToken groupToken,
+ final String groupToDenyShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToDenyJoin = groupManager.findByShortName(groupToDenyShortName);
+ socialNetworkManager.denyJoinGroup(userLogged, groupToDenyJoin, group);
+ return generateResponse(userLogged, group);
+ }
- private SocialNetworkDataDTO generateResponse(final User userLogged, final Group group) {
- return mapper.map(socialNetworkManager.getSocialNetworkData(userLogged, group), SocialNetworkDataDTO.class);
- }
+ private SocialNetworkDataDTO generateResponse(final User userLogged, final Group group) {
+ return mapper.map(socialNetworkManager.getSocialNetworkData(userLogged, group),
+ SocialNetworkDataDTO.class);
+ }
- @Override
- @Authenticated(mandatory = false)
- // At least you can access as Viewer to the Group
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
- @Transactional
- public SocialNetworkDataDTO getSocialNetwork(final String hash, final StateToken groupToken)
- throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- return generateResponse(user, group);
- }
+ @Override
+ @Authenticated(mandatory = false)
+ // At least you can access as Viewer to the Group
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Viewer)
+ @Transactional
+ public SocialNetworkDataDTO getSocialNetwork(final String hash, final StateToken groupToken)
+ throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User user = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ return generateResponse(user, group);
+ }
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
+ private UserSession getUserSession() {
+ return userSessionProvider.get();
+ }
- @Override
- @Authenticated
- @Transactional
- public SocialNetworkRequestResult requestJoinGroup(final String hash, final StateToken groupToken)
- throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- return socialNetworkManager.requestToJoin(user, group);
- }
+ @Override
+ @Authenticated
+ @Transactional
+ public SocialNetworkRequestResult requestJoinGroup(final String hash, final StateToken groupToken)
+ throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User user = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ return socialNetworkManager.requestToJoin(user, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO setAdminAsCollab(final String hash, final StateToken groupToken,
- final String groupToSetCollabShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToSetCollab = groupManager.findByShortName(groupToSetCollabShortName);
- socialNetworkManager.setAdminAsCollab(userLogged, groupToSetCollab, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO setAdminAsCollab(final String hash, final StateToken groupToken,
+ final String groupToSetCollabShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToSetCollab = groupManager.findByShortName(groupToSetCollabShortName);
+ socialNetworkManager.setAdminAsCollab(userLogged, groupToSetCollab, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
- @Transactional
- public SocialNetworkDataDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
- final String groupToSetAdminShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- final Group groupToSetAdmin = groupManager.findByShortName(groupToSetAdminShortName);
- socialNetworkManager.setCollabAsAdmin(userLogged, groupToSetAdmin, group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Authorizated(actionLevel = ActionLevel.group, accessRolRequired = AccessRol.Administrator)
+ @Transactional
+ public SocialNetworkDataDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
+ final String groupToSetAdminShortName) throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ final Group groupToSetAdmin = groupManager.findByShortName(groupToSetAdminShortName);
+ socialNetworkManager.setCollabAsAdmin(userLogged, groupToSetAdmin, group);
+ return generateResponse(userLogged, group);
+ }
- @Override
- @Authenticated
- @Transactional
- public SocialNetworkDataDTO unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
- final Group group = groupManager.findByShortName(groupToken.getGroup());
- checkIsNotPersonalGroup(group);
- socialNetworkManager.unJoinGroup(userLogged.getUserGroup(), group);
- return generateResponse(userLogged, group);
- }
+ @Override
+ @Authenticated
+ @Transactional
+ public SocialNetworkDataDTO unJoinGroup(final String hash, final StateToken groupToken)
+ throws DefaultException {
+ final UserSession userSession = getUserSession();
+ final User userLogged = userSession.getUser();
+ final Group group = groupManager.findByShortName(groupToken.getGroup());
+ checkIsNotPersonalGroup(group);
+ socialNetworkManager.unJoinGroup(userLogged.getUserGroup(), group);
+ return generateResponse(userLogged, group);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -54,11 +54,9 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.google.inject.Singleton;
import com.google.inject.name.Named;
import com.google.inject.persist.Transactional;
- at Singleton
public class UserRPC implements RPC, UserService {
private final ContentManager contentManager;
@@ -200,6 +198,6 @@
if (!groupToken.getGroup().equals(user.getShortName())) {
throw new AccessViolationException();
}
- user.setSNetVisibility(visibility);
+ userManager.setSNetVisibility(user, visibility);
}
}
Modified: trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/main/java/cc/kune/gspace/client/resources/gSpaceArmorTheme.css 2011-06-18 21:57:55 UTC (rev 1411)
@@ -22,7 +22,7 @@
}
.k-sn-maintitle {
- color: bc3;
+ color: c5;
}
.entityToolsNorth span ,.k-sn-deck div {
Modified: trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-06-16 23:33:52 UTC (rev 1410)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-06-18 21:57:55 UTC (rev 1411)
@@ -37,12 +37,14 @@
import cc.kune.core.server.manager.I18nLanguageManager;
import cc.kune.core.server.mapper.Mapper;
import cc.kune.core.server.properties.DatabaseProperties;
+import cc.kune.core.server.rpc.SocialNetworkRPC;
import cc.kune.core.server.users.UserInfo;
import cc.kune.core.server.users.UserInfoService;
import cc.kune.core.shared.domain.UserSNetVisibility;
import cc.kune.core.shared.dto.GroupDTO;
import cc.kune.core.shared.dto.I18nCountryDTO;
import cc.kune.core.shared.dto.I18nLanguageDTO;
+import cc.kune.core.shared.dto.SocialNetworkDataDTO;
import cc.kune.core.shared.dto.SubscriptionMode;
import cc.kune.core.shared.dto.TimeZoneDTO;
import cc.kune.core.shared.dto.UserDTO;
@@ -50,105 +52,113 @@
import cc.kune.domain.Group;
import com.google.inject.Inject;
+import com.google.inject.persist.UnitOfWork;
public class UserServiceTest extends IntegrationTest {
- private I18nCountryDTO country;
- @Inject
- I18nLanguageManager i18nLangManager;
- private I18nLanguageDTO lang;
- @Inject
- Mapper mapper;
- @Inject
- DatabaseProperties properties;
- private TimeZoneDTO timezone;
- @Inject
- UserInfoService userInfoService;
- @Inject
- UserService userService;
+ private I18nCountryDTO country;
+ @Inject
+ I18nLanguageManager i18nLangManager;
+ private I18nLanguageDTO lang;
+ @Inject
+ Mapper mapper;
+ @Inject
+ DatabaseProperties properties;
+ @Inject
+ SocialNetworkRPC sn;
+ private TimeZoneDTO timezone;
+ @Inject
+ UnitOfWork unitOfWork;
+ @Inject
+ UserInfoService userInfoService;
+ @Inject
+ UserService userService;
- private void assertEqualGroupLists(final List<GroupDTO> listDTO, final List<Group> list) {
- assertEquals(listDTO.size(), list.size());
- for (int i = 0; i < listDTO.size(); i++) {
- final Object object = listDTO.get(i);
- assertEquals(GroupDTO.class, object.getClass());
- final GroupDTO d = (GroupDTO) object;
- final Group l = list.get(i);
- assertNotNull(d);
- assertNotNull(l);
- final GroupDTO map = mapper.map(l, GroupDTO.class);
- assertEquals(map.getShortName(), d.getShortName());
- }
+ private void assertEqualGroupLists(final List<GroupDTO> listDTO, final List<Group> list) {
+ assertEquals(listDTO.size(), list.size());
+ for (int i = 0; i < listDTO.size(); i++) {
+ final Object object = listDTO.get(i);
+ assertEquals(GroupDTO.class, object.getClass());
+ final GroupDTO d = (GroupDTO) object;
+ final Group l = list.get(i);
+ assertNotNull(d);
+ assertNotNull(l);
+ final GroupDTO map = mapper.map(l, GroupDTO.class);
+ assertEquals(map.getShortName(), d.getShortName());
}
+ }
- @Test(expected = EmailAddressInUseException.class)
- public void createUserExistingEmailFails() throws Exception {
- assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", "test", "123456", properties.getAdminEmail(), lang, country, timezone,
- null, true, SubscriptionMode.manual, "blue");
- userService.createUser(user, false);
- }
+ @Test(expected = EmailAddressInUseException.class)
+ public void createUserExistingEmailFails() throws Exception {
+ assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO("test", "test", "123456", properties.getAdminEmail(), lang,
+ country, timezone, null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user, false);
+ }
- @Test(expected = GroupNameInUseException.class)
- public void createUserExistingNameFails() throws Exception {
- assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456", "example1234 at example.com",
- lang, country, timezone, null, true, SubscriptionMode.manual, "blue");
- userService.createUser(user, false);
- }
+ @Test(expected = GroupNameInUseException.class)
+ public void createUserExistingNameFails() throws Exception {
+ assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456",
+ "example1234 at example.com", lang, country, timezone, null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user, false);
+ }
- @Before
- public void init() {
- new IntegrationTestHelper(this);
- lang = new I18nLanguageDTO();
- country = new I18nCountryDTO();
- timezone = new TimeZoneDTO();
- lang.setCode("en");
- country.setCode("GB");
- timezone.setId("GMT");
- }
+ @Before
+ public void init() {
+ new IntegrationTestHelper(this);
+ lang = new I18nLanguageDTO();
+ country = new I18nCountryDTO();
+ timezone = new TimeZoneDTO();
+ lang.setCode("en");
+ country.setCode("GB");
+ timezone.setId("GMT");
+ }
- @Test(expected = SessionExpiredException.class)
- public void testReloadUserInfoNotLogged() throws Exception {
- assertNull(session.getUser().getId());
- userService.reloadUserInfo("AndOldUserHash");
- }
+ @Test(expected = SessionExpiredException.class)
+ public void testReloadUserInfoNotLogged() throws Exception {
+ assertNull(session.getUser().getId());
+ userService.reloadUserInfo("AndOldUserHash");
+ }
- @Test
- public void testSetVisibility() throws Exception {
- assertNull(session.getUser().getId());
- doLogin();
- assertNotNull(session.getUser().getId());
- for (final UserSNetVisibility visibility : UserSNetVisibility.values()) {
- userService.setBuddiesVisibility(token, session.getUser().getStateToken(), visibility);
- assertEquals(visibility, session.getUser().getSNetVisibility());
- }
+ @Test
+ public void testSetVisibility() throws Exception {
+ assertNull(session.getUser().getId());
+ doLogin();
+ assertNotNull(session.getUser().getId());
+ for (final UserSNetVisibility visibility : UserSNetVisibility.values()) {
+ userService.setBuddiesVisibility(token, session.getUser().getStateToken(), visibility);
+ final SocialNetworkDataDTO snRetrieved = sn.getSocialNetwork(token,
+ session.getUser().getStateToken());
+ assertEquals(visibility, snRetrieved.getUserBuddiesVisibility());
+ assertEquals(visibility, session.getUser().getSNetVisibility());
}
+ }
- @Test
- public void testSiteEmailLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminEmail(), properties.getAdminPassword(), token);
- assertNotNull(session.getUser().getId());
- }
+ @Test
+ public void testSiteEmailLogin() throws Exception {
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminEmail(), properties.getAdminPassword(), token);
+ assertNotNull(session.getUser().getId());
+ }
- @Test
- public void testSiteNameLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminShortName(), properties.getAdminPassword(), token);
- assertNotNull(session.getUser().getId());
- }
+ @Test
+ public void testSiteNameLogin() throws Exception {
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminShortName(), properties.getAdminPassword(), token);
+ assertNotNull(session.getUser().getId());
+ }
- @Test
- public void testUserInfo() throws Exception {
- doLogin();
- final UserInfo userInfo = userInfoService.buildInfo(session.getUser(), session.getHash());
+ @Test
+ public void testUserInfo() throws Exception {
+ doLogin();
+ final UserInfo userInfo = userInfoService.buildInfo(session.getUser(), session.getHash());
- final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
- assertEquals(userInfo.getName(), userInfoDTO.getName());
- assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
- final List<Group> adminsGroup = userInfo.getGroupsIsAdmin();
- final List<GroupDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
- assertEqualGroupLists(adminsGroupDTO, adminsGroup);
- }
+ final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
+ assertEquals(userInfo.getName(), userInfoDTO.getName());
+ assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
+ final List<Group> adminsGroup = userInfo.getGroupsIsAdmin();
+ final List<GroupDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
+ assertEqualGroupLists(adminsGroupDTO, adminsGroup);
+ }
}
More information about the kune-commits
mailing list