[kune-commits] r1495 - in trunk/src: main/java/cc/kune/core/client main/java/cc/kune/core/client/auth main/java/cc/kune/core/client/errors main/java/cc/kune/core/client/groups/newgroup main/java/cc/kune/core/public main/java/cc/kune/core/server/content main/java/cc/kune/core/server/manager main/java/cc/kune/core/server/manager/impl main/java/cc/kune/domain main/java/cc/kune/domain/finders test/java/cc/kune/core/server/finders test/java/cc/kune/core/server/integration/site test/java/cc/kune/core/server/manager
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun Aug 14 13:54:12 CEST 2011
Author: vjrj_
Date: 2011-08-14 13:54:12 +0200 (Sun, 14 Aug 2011)
New Revision: 1495
Added:
trunk/src/main/java/cc/kune/core/client/errors/GroupLongNameInUseException.java
trunk/src/main/java/cc/kune/core/client/errors/GroupShortNameInUseException.java
Removed:
trunk/src/main/java/cc/kune/core/client/auth/RegisterView.java
trunk/src/main/java/cc/kune/core/client/auth/SignInView.java
trunk/src/main/java/cc/kune/core/client/errors/GroupNameInUseException.java
Modified:
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/cc/kune/domain/Group.java
trunk/src/main/java/cc/kune/domain/User.java
trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java
trunk/src/main/java/cc/kune/domain/finders/UserFinder.java
trunk/src/test/java/cc/kune/core/server/finders/UserFinderTest.java
trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
Log:
CLOSED - # 85: When user registration fails (for any reason) sometimes we don't clean the welcome wave and similars
http://kune.ourproject.org/issues/ticket/85
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -34,11 +34,11 @@
import cc.kune.core.client.auth.Register;
import cc.kune.core.client.auth.RegisterPanel;
import cc.kune.core.client.auth.RegisterPresenter;
-import cc.kune.core.client.auth.RegisterView;
+import cc.kune.core.client.auth.RegisterPresenter.RegisterView;
import cc.kune.core.client.auth.SignIn;
import cc.kune.core.client.auth.SignInPanel;
import cc.kune.core.client.auth.SignInPresenter;
-import cc.kune.core.client.auth.SignInView;
+import cc.kune.core.client.auth.SignInPresenter.SignInView;
import cc.kune.core.client.auth.UserPassAutocompleteManager;
import cc.kune.core.client.auth.UserPassAutocompleteManagerImpl;
import cc.kune.core.client.cookies.CookiesManager;
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -125,4 +125,16 @@
public Field<String> getShortNameField() {
return shortNameRegField;
}
+
+ public void setEmailFailed(final String msg) {
+ emailRegField.markInvalid(msg);
+ }
+
+ public void setLongNameFailed(final String msg) {
+ longNameRegField.markInvalid(msg);
+ }
+
+ public void setShortNameFailed(final String msg) {
+ shortNameRegField.markInvalid(msg);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -22,6 +22,7 @@
import cc.kune.common.client.notify.NotifyLevelImages;
import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.common.client.ui.dialogs.MessageToolbar;
+import cc.kune.core.client.auth.RegisterPresenter.RegisterView;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.ui.KuneUiUtils;
@@ -33,80 +34,95 @@
public class RegisterPanel extends SignInAbstractPanel implements RegisterView {
- public static final String CANCEL_BUTTON_ID = "k-regp-cb";
+ public static final String CANCEL_BUTTON_ID = "k-regp-cb";
- public static final String ERRMSG = "k-regp-errmsg";
+ public static final String ERRMSG = "k-regp-errmsg";
- public static final String REGISTER_BUTTON_ID = "k-regp-rb";
- public static final String REGISTER_DIALOG = "k-regp-dialog";
- public static final String REGISTER_FORM = "k-regp-p";
- public static final String WELCOME_DIALOG = "k-regp-wdiag";
- public static final String WELCOME_OK_BUTTON = "k-regp-okbt";
- private final RegisterForm registerForm;
+ public static final String REGISTER_BUTTON_ID = "k-regp-rb";
+ public static final String REGISTER_DIALOG = "k-regp-dialog";
+ public static final String REGISTER_FORM = "k-regp-p";
+ public static final String WELCOME_DIALOG = "k-regp-wdiag";
+ public static final String WELCOME_OK_BUTTON = "k-regp-okbt";
+ private final RegisterForm registerForm;
- @Inject
- public RegisterPanel(final I18nTranslationService i18n, final Session session, final MaskWidgetView mask,
- final NotifyLevelImages images) {
- super(REGISTER_DIALOG, mask, i18n, i18n.t(CoreMessages.REGISTER_TITLE), true, true, true, 400, 420, "",
- i18n.t(CoreMessages.REGISTER_TITLE), REGISTER_BUTTON_ID, i18n.tWithNT("Cancel", "used in button"),
- CANCEL_BUTTON_ID, images, ERRMSG, 5);
- registerForm = new RegisterForm(i18n, session);
- registerForm.setWidth(370);
- registerForm.getFormPanel().setId(REGISTER_FORM);
- messageErrorBar = new MessageToolbar(images, errorLabelId);
- registerForm.add(messageErrorBar);
- super.getInnerPanel().add(registerForm.getFormPanel());
- }
+ @Inject
+ public RegisterPanel(final I18nTranslationService i18n, final Session session,
+ final MaskWidgetView mask, final NotifyLevelImages images) {
+ super(REGISTER_DIALOG, mask, i18n, i18n.t(CoreMessages.REGISTER_TITLE), true, true, true, 400, 420,
+ "", i18n.t(CoreMessages.REGISTER_TITLE), REGISTER_BUTTON_ID, i18n.tWithNT("Cancel",
+ "used in button"), CANCEL_BUTTON_ID, images, ERRMSG, 5);
+ registerForm = new RegisterForm(i18n, session);
+ registerForm.setWidth(370);
+ registerForm.getFormPanel().setId(REGISTER_FORM);
+ messageErrorBar = new MessageToolbar(images, errorLabelId);
+ registerForm.add(messageErrorBar);
+ super.getInnerPanel().add(registerForm.getFormPanel());
+ }
- @Override
- public String getEmail() {
- return registerForm.getEmail();
- }
+ @Override
+ public String getEmail() {
+ return registerForm.getEmail();
+ }
- @Override
- public String getLongName() {
- return registerForm.getLongName();
- }
+ @Override
+ public String getLongName() {
+ return registerForm.getLongName();
+ }
- @Override
- public String getRegisterPassword() {
- return registerForm.getRegisterPassword();
- }
+ @Override
+ public String getRegisterPassword() {
+ return registerForm.getRegisterPassword();
+ }
- @Override
- public String getShortName() {
- return registerForm.getShortName();
- }
+ @Override
+ public String getShortName() {
+ return registerForm.getShortName();
+ }
- @Override
- public boolean isRegisterFormValid() {
- return registerForm.isValid();
- }
+ @Override
+ public boolean isRegisterFormValid() {
+ return registerForm.isValid();
+ }
- @Override
- public boolean isValid() {
- return registerForm.isValid();
- }
+ @Override
+ public boolean isValid() {
+ return registerForm.isValid();
+ }
- @Override
- public void reset() {
- Scheduler.get().scheduleDeferred(new ScheduledCommand() {
- @Override
- public void execute() {
- registerForm.reset();
- }
- });
- }
+ @Override
+ public void reset() {
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ registerForm.reset();
+ }
+ });
+ }
- @Override
- public void show() {
- super.show();
- KuneUiUtils.focusOnField(registerForm.getShortNameField());
- }
+ @Override
+ public void setEmailFailed(final String msg) {
+ registerForm.setEmailFailed(msg);
+ }
- @Override
- public void validate() {
- registerForm.validate();
- }
+ @Override
+ public void setLongNameFailed(final String msg) {
+ registerForm.setLongNameFailed(msg);
+ }
+ @Override
+ public void setShortNameFailed(final String msg) {
+ registerForm.setShortNameFailed(msg);
+ }
+
+ @Override
+ public void show() {
+ super.show();
+ KuneUiUtils.focusOnField(registerForm.getShortNameField());
+ }
+
+ @Override
+ public void validate() {
+ registerForm.validate();
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -23,9 +23,11 @@
import cc.kune.common.client.log.Log;
import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.auth.RegisterPresenter.RegisterView;
import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.UserRegistrationException;
import cc.kune.core.client.events.NewUserRegisteredEvent;
import cc.kune.core.client.i18n.I18nUITranslationService;
@@ -61,6 +63,30 @@
@ProxyCodeSplit
public interface RegisterProxy extends Proxy<RegisterPresenter> {
}
+
+ public interface RegisterView extends SignInAbstractView {
+
+ String getEmail();
+
+ String getLongName();
+
+ String getRegisterPassword();
+
+ String getShortName();
+
+ boolean isRegisterFormValid();
+
+ boolean isValid();
+
+ void setEmailFailed(final String msg);
+
+ void setLongNameFailed(final String msg);
+
+ void setShortNameFailed(final String msg);
+
+ void validate();
+
+ }
private final Provider<SignIn> signInProvider;
private final Provider<UserServiceAsync> userServiceProvider;
@@ -123,6 +149,7 @@
}
public void onFormRegister() {
+ getView().hideMessages();
if (getView().isRegisterFormValid()) {
getView().maskProcessing();
@@ -208,9 +235,14 @@
private void onRegistrationFailure(final Throwable caught) {
getView().unMask();
if (caught instanceof EmailAddressInUseException) {
+ getView().setEmailFailed(i18n.t(CoreMessages.EMAIL_IN_USE));
getView().setErrorMessage(i18n.t(CoreMessages.EMAIL_IN_USE), NotifyLevel.error);
- } else if (caught instanceof GroupNameInUseException) {
+ } else if (caught instanceof GroupShortNameInUseException) {
+ getView().setShortNameFailed(i18n.t(CoreMessages.NAME_IN_USE));
getView().setErrorMessage(i18n.t(CoreMessages.NAME_IN_USE), NotifyLevel.error);
+ } else if (caught instanceof GroupLongNameInUseException) {
+ getView().setLongNameFailed(i18n.t(CoreMessages.NAME_IN_USE));
+ getView().setErrorMessage(i18n.t(CoreMessages.NAME_IN_USE), NotifyLevel.error);
} else if (caught instanceof UserRegistrationException) {
getView().setErrorMessage(i18n.t("Error during registration. " + caught.getMessage()),
NotifyLevel.error);
Deleted: trunk/src/main/java/cc/kune/core/client/auth/RegisterView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterView.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterView.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -1,38 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.client.auth;
-
-public interface RegisterView extends SignInAbstractView {
-
- String getEmail();
-
- String getLongName();
-
- String getRegisterPassword();
-
- String getShortName();
-
- boolean isRegisterFormValid();
-
- boolean isValid();
-
- void validate();
-
-}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -23,6 +23,7 @@
import cc.kune.common.client.ui.MaskWidgetView;
import cc.kune.common.client.ui.dialogs.MessageToolbar;
import cc.kune.common.client.utils.OnAcceptCallback;
+import cc.kune.core.client.auth.SignInPresenter.SignInView;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.ui.KuneUiUtils;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -36,106 +37,107 @@
public class SignInPanel extends SignInAbstractPanel implements SignInView {
- public static final String CANCEL_BUTTON_ID = "k-signinp-cb";
- public static final String CREATE_ONE = "k-signinp-create";
- public static final String ERROR_MSG = "k-sigp-errmsg";
- public static final String SIGN_IN_BUTTON_ID = "k-signinp-sib";
- public static final String SIGNIN_DIALOG = "k-signinp-dialog";
- private Label registerLabel;
- private final SignInForm signInForm;
+ public static final String CANCEL_BUTTON_ID = "k-signinp-cb";
+ public static final String CREATE_ONE = "k-signinp-create";
+ public static final String ERROR_MSG = "k-sigp-errmsg";
+ public static final String SIGN_IN_BUTTON_ID = "k-signinp-sib";
+ public static final String SIGNIN_DIALOG = "k-signinp-dialog";
+ private Label registerLabel;
+ private final SignInForm signInForm;
- @Inject
- public SignInPanel(final I18nTranslationService i18n, final MaskWidgetView mask, final NotifyLevelImages images) {
- super(SIGNIN_DIALOG, mask, i18n, i18n.t(CoreMessages.SIGN_IN_TITLE), true, true, true, 360, 430, "",
- i18n.t(CoreMessages.SIGN_IN_TITLE), SIGN_IN_BUTTON_ID, i18n.tWithNT("Cancel", "used in button"),
- CANCEL_BUTTON_ID, images, ERROR_MSG, 102);
+ @Inject
+ public SignInPanel(final I18nTranslationService i18n, final MaskWidgetView mask,
+ final NotifyLevelImages images) {
+ super(SIGNIN_DIALOG, mask, i18n, i18n.t(CoreMessages.SIGN_IN_TITLE), true, true, true, 360, 430, "",
+ i18n.t(CoreMessages.SIGN_IN_TITLE), SIGN_IN_BUTTON_ID, i18n.tWithNT("Cancel", "used in button"),
+ CANCEL_BUTTON_ID, images, ERROR_MSG, 102);
- signInForm = new SignInForm(i18n);
- signInForm.setWidth(370);
- signInForm.add(createNoAccountRegister());
- messageErrorBar = new MessageToolbar(images, errorLabelId);
- signInForm.add(messageErrorBar);
- super.getInnerPanel().add(signInForm.getFormPanel());
- }
+ signInForm = new SignInForm(i18n);
+ signInForm.setWidth(370);
+ signInForm.add(createNoAccountRegister());
+ messageErrorBar = new MessageToolbar(images, errorLabelId);
+ signInForm.add(messageErrorBar);
+ super.getInnerPanel().add(signInForm.getFormPanel());
+ }
- private VerticalPanel createNoAccountRegister() {
- final VerticalPanel noAccRegisterPanel = new VerticalPanel();
- final HorizontalPanel hpanel = new HorizontalPanel();
- final Label dontHaveAccount = new Label(i18n.t("Don't have an account?"));
- registerLabel = new Label(i18n.t("Create one."));
- registerLabel.ensureDebugId(CREATE_ONE);
- registerLabel.addStyleName("kune-Margin-Medium-l");
- registerLabel.addStyleName("k-link");
- registerLabel.addStyleName("k-cursor");
- hpanel.add(dontHaveAccount);
- hpanel.add(registerLabel);
- noAccRegisterPanel.add(hpanel);
- return noAccRegisterPanel;
- }
+ private VerticalPanel createNoAccountRegister() {
+ final VerticalPanel noAccRegisterPanel = new VerticalPanel();
+ final HorizontalPanel hpanel = new HorizontalPanel();
+ final Label dontHaveAccount = new Label(i18n.t("Don't have an account?"));
+ registerLabel = new Label(i18n.t("Create one."));
+ registerLabel.ensureDebugId(CREATE_ONE);
+ registerLabel.addStyleName("kune-Margin-Medium-l");
+ registerLabel.addStyleName("k-link");
+ registerLabel.addStyleName("k-cursor");
+ hpanel.add(dontHaveAccount);
+ hpanel.add(registerLabel);
+ noAccRegisterPanel.add(hpanel);
+ return noAccRegisterPanel;
+ }
- @Override
- public void focusOnNickname() {
- signInForm.focusLogin();
- }
+ @Override
+ public void focusOnNickname() {
+ signInForm.focusLogin();
+ }
- @Override
- public void focusOnPassword() {
- signInForm.focusOnPassword();
- }
+ @Override
+ public void focusOnPassword() {
+ signInForm.focusOnPassword();
+ }
- @Override
- public HasClickHandlers getAccountRegister() {
- return registerLabel;
- }
+ @Override
+ public HasClickHandlers getAccountRegister() {
+ return registerLabel;
+ }
- @Override
- public String getLoginPassword() {
- return signInForm.getLoginPassword();
- }
+ @Override
+ public String getLoginPassword() {
+ return signInForm.getLoginPassword();
+ }
- private Field<String> getNickname() {
- return signInForm.getNickOrEmailField();
- }
+ private Field<String> getNickname() {
+ return signInForm.getNickOrEmailField();
+ }
- @Override
- public String getNickOrEmail() {
- return signInForm.getNickOrEmail();
- }
+ @Override
+ public String getNickOrEmail() {
+ return signInForm.getNickOrEmail();
+ }
- @Override
- public boolean isSignInFormValid() {
- return signInForm.isValid();
- }
+ @Override
+ public boolean isSignInFormValid() {
+ return signInForm.isValid();
+ }
- @Override
- public void reset() {
- signInForm.reset();
- }
+ @Override
+ public void reset() {
+ signInForm.reset();
+ }
- @Override
- public void setLoginPassword(final String password) {
- signInForm.setLoginPassword(password);
- }
+ @Override
+ public void setLoginPassword(final String password) {
+ signInForm.setLoginPassword(password);
+ }
- @Override
- public void setNickOrEmail(final String nickOrEmail) {
- signInForm.setNickOrEmail(nickOrEmail);
- }
+ @Override
+ public void setNickOrEmail(final String nickOrEmail) {
+ signInForm.setNickOrEmail(nickOrEmail);
+ }
- @Override
- public void setOnPasswordReturn(final OnAcceptCallback onAcceptCallback) {
- signInForm.setOnPasswordReturn(onAcceptCallback);
- }
+ @Override
+ public void setOnPasswordReturn(final OnAcceptCallback onAcceptCallback) {
+ signInForm.setOnPasswordReturn(onAcceptCallback);
+ }
- @Override
- public void show() {
- super.show();
- KuneUiUtils.focusOnField(getNickname());
- }
+ @Override
+ public void show() {
+ super.show();
+ KuneUiUtils.focusOnField(getNickname());
+ }
- @Override
- public void validate() {
- signInForm.validate();
- }
+ @Override
+ public void validate() {
+ signInForm.validate();
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -25,6 +25,7 @@
import cc.kune.common.client.utils.TextUtils;
import cc.kune.common.client.utils.TimerWrapper;
import cc.kune.common.client.utils.TimerWrapper.Executer;
+import cc.kune.core.client.auth.SignInPresenter.SignInView;
import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.errors.UserAuthException;
import cc.kune.core.client.i18n.I18nUITranslationService;
@@ -40,6 +41,7 @@
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.CloseEvent;
import com.google.gwt.event.logical.shared.CloseHandler;
import com.google.gwt.event.shared.EventBus;
@@ -51,186 +53,213 @@
import com.gwtplatform.mvp.client.proxy.Proxy;
import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
-public class SignInPresenter extends SignInAbstractPresenter<SignInView, SignInPresenter.SignInProxy> implements SignIn {
+public class SignInPresenter extends SignInAbstractPresenter<SignInView, SignInPresenter.SignInProxy>
+ implements SignIn {
- @ProxyCodeSplit
- public interface SignInProxy extends Proxy<SignInPresenter> {
- }
+ @ProxyCodeSplit
+ public interface SignInProxy extends Proxy<SignInPresenter> {
+ }
- private final EventBus eventBus;
- private final Provider<Register> registerProvider;
- private final TimerWrapper timer;
- private final UserServiceAsync userService;
- private final WaveClientSimpleAuthenticator waveClientAuthenticator;
+ public interface SignInView extends SignInAbstractView {
- @Inject
- public SignInPresenter(final EventBus eventBus, final SignInView view, final SignInProxy proxy,
- final Session session, final StateManager stateManager, final I18nUITranslationService i18n,
- final UserServiceAsync userService, final Provider<Register> registerProvider,
- final CookiesManager cookiesManager, final UserPassAutocompleteManager autocomplete,
- final TimerWrapper timeWrapper, final WaveClientSimpleAuthenticator waveClientAuthenticator) {
- super(eventBus, view, proxy, session, stateManager, i18n, cookiesManager, autocomplete);
- this.eventBus = eventBus;
- this.userService = userService;
- this.registerProvider = registerProvider;
- this.timer = timeWrapper;
- this.waveClientAuthenticator = waveClientAuthenticator;
- }
+ void focusOnNickname();
- @Override
- public void doSignIn(final String nickOrEmail, final String passwd, final AsyncCallback<Void> extCallback) {
- final UserDTO user = new UserDTO();
- user.setShortName(nickOrEmail);
- user.setPassword(passwd);
- saveAutocompleteLoginData(nickOrEmail, passwd);
- waveClientAuthenticator.doLogin(nickOrEmail, passwd, new AsyncCallback<Void>() {
- @Override
- public void onFailure(final Throwable caught) {
- Log.error("SignInPresenter/doLogin fails in Wave auth");
- extCallback.onFailure(caught);
- }
+ void focusOnPassword();
- @Override
- public void onSuccess(final Void arg) {
+ HasClickHandlers getAccountRegister();
- final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
- @Override
- public void onFailure(final Throwable caught) {
- extCallback.onFailure(caught);
- }
+ String getLoginPassword();
- @Override
- public void onSuccess(final UserInfoDTO userInfoDTO) {
- onSignIn(userInfoDTO);
- extCallback.onSuccess(null);
- }
- };
- userService.login(user.getShortName(), user.getPassword(),
- waveClientAuthenticator.getCookieTokenValue(), callback);
- }
- });
- }
+ String getNickOrEmail();
- @Override
- public SignInView getView() {
- return (SignInView) super.getView();
- }
+ boolean isSignInFormValid();
- public void onAccountRegister() {
- getView().reset();
- getView().hideMessages();
- getView().hide();
- stateManager.gotoHistoryToken(SiteTokens.REGISTER);
- }
+ void setLoginPassword(String password);
- @Override
- protected void onBind() {
- super.onBind();
- getView().getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- onFormSignIn();
- }
- });
- getView().setOnPasswordReturn(new OnAcceptCallback() {
- @Override
- public void onSuccess() {
- onFormSignIn();
- }
- });
- getView().getSecondBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- Log.debug("On cancel signin presenter");
- onCancel();
- }
- });
- getView().getClose().addCloseHandler(new CloseHandler<PopupPanel>() {
+ void setNickOrEmail(String nickOrEmail);
- @Override
- public void onClose(final CloseEvent<PopupPanel> event) {
- Log.debug("Closing signin presenter");
- SignInPresenter.this.onClose();
- }
- });
- getView().getAccountRegister().addClickHandler(new ClickHandler() {
+ void setOnPasswordReturn(OnAcceptCallback onAcceptCallback);
- @Override
- public void onClick(final ClickEvent event) {
- onAccountRegister();
- }
- });
- }
+ void validate();
- public void onFormSignIn() {
- getView().validate();
- if (getView().isSignInFormValid()) {
- getView().maskProcessing();
+ }
- final String nickOrEmail = getView().getNickOrEmail();
- final String passwd = getView().getLoginPassword();
- doSignIn(nickOrEmail, passwd, new AsyncCallback<Void>() {
+ private final EventBus eventBus;
+ private final Provider<Register> registerProvider;
+ private final TimerWrapper timer;
+ private final UserServiceAsync userService;
+ private final WaveClientSimpleAuthenticator waveClientAuthenticator;
- @Override
- public void onFailure(final Throwable caught) {
- onSingInFailed(caught);
- }
+ @Inject
+ public SignInPresenter(final EventBus eventBus, final SignInView view, final SignInProxy proxy,
+ final Session session, final StateManager stateManager, final I18nUITranslationService i18n,
+ final UserServiceAsync userService, final Provider<Register> registerProvider,
+ final CookiesManager cookiesManager, final UserPassAutocompleteManager autocomplete,
+ final TimerWrapper timeWrapper, final WaveClientSimpleAuthenticator waveClientAuthenticator) {
+ super(eventBus, view, proxy, session, stateManager, i18n, cookiesManager, autocomplete);
+ this.eventBus = eventBus;
+ this.userService = userService;
+ this.registerProvider = registerProvider;
+ this.timer = timeWrapper;
+ this.waveClientAuthenticator = waveClientAuthenticator;
+ }
- @Override
- public void onSuccess(final Void result) {
- getView().hide();
- getView().unMask();
- }
- });
+ @Override
+ public void doSignIn(final String nickOrEmail, final String passwd,
+ final AsyncCallback<Void> extCallback) {
+ final UserDTO user = new UserDTO();
+ user.setShortName(nickOrEmail);
+ user.setPassword(passwd);
+ saveAutocompleteLoginData(nickOrEmail, passwd);
+ waveClientAuthenticator.doLogin(nickOrEmail, passwd, new AsyncCallback<Void>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ Log.error("SignInPresenter/doLogin fails in Wave auth");
+ extCallback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(final Void arg) {
+
+ final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ extCallback.onFailure(caught);
+ }
+
+ @Override
+ public void onSuccess(final UserInfoDTO userInfoDTO) {
+ onSignIn(userInfoDTO);
+ extCallback.onSuccess(null);
+ }
+ };
+ userService.login(user.getShortName(), user.getPassword(),
+ waveClientAuthenticator.getCookieTokenValue(), callback);
+ }
+ });
+ }
+
+ @Override
+ public SignInView getView() {
+ return (SignInView) super.getView();
+ }
+
+ public void onAccountRegister() {
+ getView().reset();
+ getView().hideMessages();
+ getView().hide();
+ stateManager.gotoHistoryToken(SiteTokens.REGISTER);
+ }
+
+ @Override
+ protected void onBind() {
+ super.onBind();
+ getView().getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ onFormSignIn();
+ }
+ });
+ getView().setOnPasswordReturn(new OnAcceptCallback() {
+ @Override
+ public void onSuccess() {
+ onFormSignIn();
+ }
+ });
+ getView().getSecondBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ Log.debug("On cancel signin presenter");
+ onCancel();
+ }
+ });
+ getView().getClose().addCloseHandler(new CloseHandler<PopupPanel>() {
+
+ @Override
+ public void onClose(final CloseEvent<PopupPanel> event) {
+ Log.debug("Closing signin presenter");
+ SignInPresenter.this.onClose();
+ }
+ });
+ getView().getAccountRegister().addClickHandler(new ClickHandler() {
+
+ @Override
+ public void onClick(final ClickEvent event) {
+ onAccountRegister();
+ }
+ });
+ }
+
+ public void onFormSignIn() {
+ getView().validate();
+ if (getView().isSignInFormValid()) {
+ getView().maskProcessing();
+
+ final String nickOrEmail = getView().getNickOrEmail();
+ final String passwd = getView().getLoginPassword();
+ doSignIn(nickOrEmail, passwd, new AsyncCallback<Void>() {
+
+ @Override
+ public void onFailure(final Throwable caught) {
+ onSingInFailed(caught);
}
- }
- private void onSingInFailed(final Throwable caught) {
- getView().unMask();
- eventBus.fireEvent(new ProgressHideEvent());
- if (caught instanceof UserAuthException) {
- getView().setErrorMessage(i18n.t(CoreMessages.INCORRECT_NICKNAME_EMAIL_OR_PASSWORD), NotifyLevel.error);
- } else {
- getView().setErrorMessage("Error in login", NotifyLevel.error);
- Log.error("Other kind of exception in SignInPresenter/doLogin");
+ @Override
+ public void onSuccess(final Void result) {
+ getView().hide();
+ getView().unMask();
}
+ });
}
+ }
- @Override
- protected void revealInParent() {
- RevealRootContentEvent.fire(this, this);
+ private void onSingInFailed(final Throwable caught) {
+ getView().unMask();
+ eventBus.fireEvent(new ProgressHideEvent());
+ if (caught instanceof UserAuthException) {
+ getView().setErrorMessage(i18n.t(CoreMessages.INCORRECT_NICKNAME_EMAIL_OR_PASSWORD),
+ NotifyLevel.error);
+ } else {
+ getView().setErrorMessage("Error in login", NotifyLevel.error);
+ Log.error("Other kind of exception in SignInPresenter/doLogin");
}
+ }
- @Override
- public void setErrorMessage(final String message, final NotifyLevel level) {
- getView().setErrorMessage(message, level);
- }
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
- @Override
- public void showSignInDialog() {
- registerProvider.get().hide();
- if (session.isLogged()) {
- stateManager.restorePreviousToken();
- } else {
- eventBus.fireEvent(new ProgressShowEvent());
- getView().show();
- // getView().center();
- eventBus.fireEvent(new ProgressHideEvent());
- getView().focusOnNickname();
- timer.configure(new Executer() {
- @Override
- public void execute() {
- final String savedLogin = autocomplete.getNickOrEmail();
- final String savedPasswd = autocomplete.getPassword();
- if (TextUtils.notEmpty(savedLogin)) {
- getView().setNickOrEmail(savedLogin);
- getView().setLoginPassword(savedPasswd);
- getView().focusOnPassword();
- }
- }
- });
- timer.schedule(500);
+ @Override
+ public void setErrorMessage(final String message, final NotifyLevel level) {
+ getView().setErrorMessage(message, level);
+ }
+
+ @Override
+ public void showSignInDialog() {
+ registerProvider.get().hide();
+ if (session.isLogged()) {
+ stateManager.restorePreviousToken();
+ } else {
+ eventBus.fireEvent(new ProgressShowEvent());
+ getView().show();
+ // getView().center();
+ eventBus.fireEvent(new ProgressHideEvent());
+ getView().focusOnNickname();
+ timer.configure(new Executer() {
+ @Override
+ public void execute() {
+ final String savedLogin = autocomplete.getNickOrEmail();
+ final String savedPasswd = autocomplete.getPassword();
+ if (TextUtils.notEmpty(savedLogin)) {
+ getView().setNickOrEmail(savedLogin);
+ getView().setLoginPassword(savedPasswd);
+ getView().focusOnPassword();
+ }
}
+ });
+ timer.schedule(500);
}
+ }
}
Deleted: trunk/src/main/java/cc/kune/core/client/auth/SignInView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInView.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInView.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.client.auth;
-
-import cc.kune.common.client.utils.OnAcceptCallback;
-
-import com.google.gwt.event.dom.client.HasClickHandlers;
-
-public interface SignInView extends SignInAbstractView {
-
- void focusOnNickname();
-
- void focusOnPassword();
-
- HasClickHandlers getAccountRegister();
-
- String getLoginPassword();
-
- String getNickOrEmail();
-
- boolean isSignInFormValid();
-
- void setLoginPassword(String password);
-
- void setNickOrEmail(String nickOrEmail);
-
- void setOnPasswordReturn(OnAcceptCallback onAcceptCallback);
-
- void validate();
-
-}
Added: trunk/src/main/java/cc/kune/core/client/errors/GroupLongNameInUseException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/GroupLongNameInUseException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/GroupLongNameInUseException.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.errors;
+
+public class GroupLongNameInUseException extends DefaultException {
+ private static final long serialVersionUID = -1211473220006162132L;
+}
Deleted: trunk/src/main/java/cc/kune/core/client/errors/GroupNameInUseException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/GroupNameInUseException.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/errors/GroupNameInUseException.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -1,24 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.core.client.errors;
-
-public class GroupNameInUseException extends DefaultException {
- private static final long serialVersionUID = -4746775725822225687L;
-}
Copied: trunk/src/main/java/cc/kune/core/client/errors/GroupShortNameInUseException.java (from rev 1489, trunk/src/main/java/cc/kune/core/client/errors/GroupNameInUseException.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/GroupShortNameInUseException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/GroupShortNameInUseException.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.errors;
+
+public class GroupShortNameInUseException extends DefaultException {
+ private static final long serialVersionUID = -4746775725822225687L;
+}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPanel.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -51,7 +51,6 @@
public static final String ERROR_MSG_BAR = "k-ngp-error-mb";
private static final int LABEL_WIDTH = 100;
public static final String LONGNAME_FIELD = "k-ngp-long_name";
- private static final String MARGIN_LEFT_105PX = "margin-left: 105px";
public static final String NEWGROUP_WIZARD = "k-ngp-wiz";
public static final String ORG_GROUP_TYPE_ID = "k-ngp-type_of_group_org";
public static final String PROJ_GROUP_TYPE_ID = "k-ngp-type_of_group_proj";
@@ -83,7 +82,7 @@
public NewGroupPanel(final I18nTranslationService i18n, final NotifyLevelImages img,
final MaskWidgetView mask) {
final Builder builder = new BasicTopDialog.Builder(NEWGROUP_WIZARD, false, true).autoscroll(true).height(
- "340px").title(i18n.t("Register a new group"));
+ 340).title(i18n.t("Register a new group"));
builder.icon("k-newgroup-icon");
builder.firstButtonTitle(i18n.t("Register")).firstButtonId(REGISTER_BUTTON);
builder.sndButtonTitle(i18n.t("Cancel")).sndButtonId(CANCEL_BUTTON);
@@ -299,11 +298,21 @@
}
@Override
+ public void setLongNameFailed(final String msg) {
+ longNameField.markInvalid(msg);
+ }
+
+ @Override
public void setMessage(final String message, final NotifyLevel level) {
messageErrorBar.setErrorMessage(message, level);
}
@Override
+ public void setShortNameFailed(final String msg) {
+ shortNameField.markInvalid(msg);
+ }
+
+ @Override
public void show() {
dialog.showCentered();
}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -23,7 +23,8 @@
import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.auth.SignIn;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.resources.CoreMessages;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.GroupServiceAsync;
@@ -155,6 +156,7 @@
}
public void onRegister() {
+ getView().hideMessage();
if (getView().isFormValid()) {
getView().maskProcessing();
final String shortName = getView().getShortName();
@@ -167,9 +169,16 @@
final AsyncCallback<StateToken> callback = new AsyncCallback<StateToken>() {
@Override
public void onFailure(final Throwable caught) {
- if (caught instanceof GroupNameInUseException) {
+ if (caught instanceof GroupShortNameInUseException) {
getView().unMask();
- setMessage(i18n.t(CoreMessages.NAME_IN_ALREADY_IN_USE), NotifyLevel.error);
+ final String msg = i18n.t(CoreMessages.NAME_IN_ALREADY_IN_USE);
+ getView().setShortNameFailed(msg);
+ setMessage(msg, NotifyLevel.error);
+ } else if (caught instanceof GroupLongNameInUseException) {
+ getView().unMask();
+ final String msg = i18n.t(CoreMessages.NAME_IN_ALREADY_IN_USE);
+ getView().setLongNameFailed(msg);
+ setMessage(msg, NotifyLevel.error);
} else {
getView().unMask();
setMessage(i18n.t("Error creating group"), NotifyLevel.error);
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupView.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -62,8 +62,12 @@
void maskProcessing();
+ void setLongNameFailed(final String msg);
+
void setMessage(String message, NotifyLevel level);
+ void setShortNameFailed(final String msg);
+
void show();
void unMask();
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-08-14 11:54:12 UTC (rev 1495)
@@ -729,8 +729,8 @@
.k-error-tb {
background: #FFB380 none repeat scroll 0% 50%;
/* color: #250; */
- padding: 10px;
- margin: 16px -20px -20px -20px;
+ padding: 7px 10px;
+ margin: 16px -20px -10px -20px;
}
.k-error-tb img {
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -96,7 +96,7 @@
public void addAuthor(final User user, final Long contentId, final String authorShortName)
throws DefaultException {
final Content content = finder.getContent(contentId);
- final User author = userFinder.getByShortName(authorShortName);
+ final User author = userFinder.findByShortName(authorShortName);
if (author == null) {
throw new UserNotFoundException();
}
@@ -221,7 +221,7 @@
public void removeAuthor(final User user, final Long contentId, final String authorShortName)
throws DefaultException {
final Content content = finder.getContent(contentId);
- final User author = userFinder.getByShortName(authorShortName);
+ final User author = userFinder.findByShortName(authorShortName);
if (author == null) {
throw new UserNotFoundException();
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/server/manager/GroupManager.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -24,7 +24,7 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
import cc.kune.core.server.manager.impl.SearchResult;
import cc.kune.domain.Content;
@@ -37,14 +37,16 @@
void changeWsTheme(User user, Group group, String theme) throws AccessViolationException;
+ void checkIfNamesAreInUse(String shortName, String longName);
+
void clearGroupBackImage(Group group);
- Group createGroup(Group group, User user, String publicDescrip) throws GroupNameInUseException,
+ Group createGroup(Group group, User user, String publicDescrip) throws GroupShortNameInUseException,
UserMustBeLoggedException;
- Group createUserGroup(User user) throws GroupNameInUseException, EmailAddressInUseException;
+ Group createUserGroup(User user) throws GroupShortNameInUseException, EmailAddressInUseException;
- Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupNameInUseException,
+ Group createUserGroup(User user, boolean wantPersonalHomepage) throws GroupShortNameInUseException,
EmailAddressInUseException;
Set<Group> findAdminInGroups(Long groupId);
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -35,7 +35,8 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
import cc.kune.core.server.manager.FileManager;
import cc.kune.core.server.manager.GroupManager;
@@ -128,7 +129,8 @@
@Override
public Group createGroup(final Group group, final User user, final String publicDescrip)
- throws GroupNameInUseException, UserMustBeLoggedException {
+ throws GroupShortNameInUseException, GroupLongNameInUseException, UserMustBeLoggedException {
+ checkIfNamesAreInUse(group.getShortName(), group.getLongName());
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
if (User.isKnownUser(user)) {
GroupListMode publicVisibility = GroupListMode.EVERYONE;
@@ -160,21 +162,21 @@
}
@Override
- public Group createUserGroup(final User user) throws GroupNameInUseException,
+ public Group createUserGroup(final User user) throws GroupShortNameInUseException,
EmailAddressInUseException {
return createUserGroup(user, true);
}
@Override
public Group createUserGroup(final User user, final boolean wantPersonalHomepage)
- throws GroupNameInUseException, EmailAddressInUseException {
+ throws GroupShortNameInUseException, EmailAddressInUseException {
final String defaultSiteWorkspaceTheme = kuneProperties.get(KuneProperties.WS_THEMES_DEF);
final License licenseDef = licenseManager.getDefLicense();
final Group userGroup = new Group(user.getShortName(), user.getName(), licenseDef,
GroupType.PERSONAL);
User userSameEmail = null;
try {
- userSameEmail = userFinder.getByEmail(user.getEmail());
+ userSameEmail = userFinder.findByEmail(user.getEmail());
} catch (final NoResultException e) {
// Ok, no more with this email
}
@@ -195,7 +197,7 @@
super.persist(user, User.class);
} catch (final PersistenceException e) {
if (e.getCause() instanceof ConstraintViolationException) {
- throw new GroupNameInUseException();
+ throw new GroupShortNameInUseException();
}
throw e;
}
@@ -234,14 +236,14 @@
}
private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable,
- final Object... vars) throws GroupNameInUseException {
+ final Object... vars) throws GroupShortNameInUseException {
try {
persist(group);
} catch (final IllegalStateException e) {
e.printStackTrace();
} catch (final PersistenceException e) {
if (e.getCause() instanceof ConstraintViolationException) {
- throw new GroupNameInUseException();
+ throw new GroupShortNameInUseException();
}
throw e;
}
@@ -309,4 +311,13 @@
toolConfiguration.setEnabled(enabled);
}
+ public void checkIfNamesAreInUse(final String shortName, final String longName) {
+ if (finder.countByShortName(shortName) != 0) {
+ throw new GroupShortNameInUseException();
+ }
+ if (finder.countByLongName(longName) != 0) {
+ throw new GroupLongNameInUseException();
+ }
+ }
+
}
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-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -39,7 +39,9 @@
import org.waveprotocol.box.server.persistence.AccountStore;
import org.waveprotocol.wave.model.waveref.WaveRef;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.EmailAddressInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.client.errors.UserRegistrationException;
import cc.kune.core.server.manager.GroupManager;
@@ -71,13 +73,13 @@
private final ChatProperties chatProperties;
private final I18nCountryManager countryManager;
- private final UserFinder finder;
private final GroupManager groupManager;
private final I18nTranslationService i18n;
private final KuneWaveManager kuneWaveManager;
private final I18nLanguageManager languageManager;
private final ParticipantUtils participantUtils;
private final KuneBasicProperties properties;
+ private final UserFinder userFinder;
private final AccountStore waveAccountStore;
private final CustomUserRegistrationServlet waveUserRegister;
private final XmppManager xmppManager;
@@ -91,7 +93,7 @@
final ParticipantUtils participantUtils, final KuneBasicProperties properties,
final GroupManager groupManager) {
super(provider, User.class);
- this.finder = finder;
+ this.userFinder = finder;
this.languageManager = languageManager;
this.countryManager = countryManager;
this.xmppManager = xmppManager;
@@ -112,6 +114,16 @@
I18nLanguage language;
I18nCountry country;
TimeZone tz;
+ if (userFinder.countByShortName(shortName) != 0) {
+ throw new GroupShortNameInUseException();
+ }
+ if (userFinder.countByLongName(longName) != 0) {
+ throw new GroupLongNameInUseException();
+ }
+ groupManager.checkIfNamesAreInUse(shortName, longName);
+ if (userFinder.countByEmail(email) != 0) {
+ throw new EmailAddressInUseException();
+ }
try {
language = languageManager.findByCode(langCode);
country = countryManager.findByCode(countryCode);
@@ -124,23 +136,8 @@
try {
createWaveAccount(shortName, passwdDigest);
} catch (final UserRegistrationException e) {
- try {
- if (finder.getByShortName(shortName) != null) {
- throw new GroupNameInUseException();
- } else {
- // Other kind of exception
- throw e;
- }
- } catch (final NoResultException e2) {
- // Other kind of exception
- throw e;
- }
+ throw e;
}
- // if (userPropGroup == null) {
- // userPropGroup = propGroupManager.find(User.PROPS_ID);
- // }
- // final Properties userProp = new Properties(userPropGroup);
- // propManager.persist(userProp);
WaveRef welcome = null;
try {
final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(),
@@ -183,7 +180,7 @@
@Override
public User find(final Long userId) {
try {
- return finder.getById(userId);
+ return userFinder.findById(userId);
} catch (final NoResultException e) {
return User.UNKNOWN_USER;
}
@@ -191,11 +188,11 @@
@Override
public User findByShortname(final String shortName) {
- return finder.getByShortName(shortName);
+ return userFinder.findByShortName(shortName);
}
public List<User> getAll() {
- return finder.getAll();
+ return userFinder.getAll();
}
@Override
@@ -209,7 +206,7 @@
final String domain = "@" + chatProperties.getDomain();
final UserBuddiesData buddiesData = new UserBuddiesData();
- final User user = finder.getByShortName(shortName);
+ final User user = userFinder.findByShortName(shortName);
Collection<RosterEntry> roster;
try {
final ChatConnection connection = xmppManager.login(user.getShortName() + domain,
@@ -230,7 +227,7 @@
// local user
try {
final String username = entry.getUser().substring(0, index);
- final User buddie = finder.getByShortName(username);
+ final User buddie = userFinder.findByShortName(username);
buddiesData.getBuddies().add(buddie);
} catch (final NoResultException e) {
// No existent buddie, skip
@@ -248,10 +245,10 @@
public User login(final String nickOrEmail, final String passwd) {
User user;
try {
- user = finder.getByShortName(nickOrEmail);
+ user = userFinder.findByShortName(nickOrEmail);
} catch (final NoResultException e) {
try {
- user = finder.getByEmail(nickOrEmail);
+ user = userFinder.findByEmail(nickOrEmail);
} catch (final NoResultException e2) {
return null;
}
Modified: trunk/src/main/java/cc/kune/domain/Group.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/Group.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/domain/Group.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -93,7 +93,7 @@
private BasicMimeType logoMime;
@Field(index = Index.TOKENIZED, store = Store.NO)
- @Column(unique = true)
+ @Column(nullable = false, unique = true)
@Length(min = 3, max = 50, message = "The longName must be between 3 and 50 characters of length")
private String longName;
Modified: trunk/src/main/java/cc/kune/domain/User.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/User.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/domain/User.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -54,248 +54,248 @@
@Table(name = "kusers")
public class User implements HasId {
- // public static final String PROPS_ID = "userprops";
- // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
- // Never expect or return null
- public static final User UNKNOWN_USER = new User();
+ // public static final String PROPS_ID = "userprops";
+ // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
+ // Never expect or return null
+ public static final User UNKNOWN_USER = new User();
- public static boolean isKnownUser(final User user) {
- return !user.equals(UNKNOWN_USER);
- }
+ public static boolean isKnownUser(final User user) {
+ return !user.equals(UNKNOWN_USER);
+ }
- @Enumerated(EnumType.STRING)
- private UserSNetVisibility sNetVisibility;
+ @ManyToOne
+ @NotNull
+ private I18nCountry country;
- @ManyToOne
- @NotNull
- private I18nCountry country;
+ @Basic(optional = false)
+ private final Long createdOn;
- @Basic(optional = false)
- private final Long createdOn;
+ @Basic
+ @Lob
+ @Column(nullable = false)
+ private byte[] diggest;
- // @OneToOne(cascade = CascadeType.REMOVE)
- // private final CustomProperties customProperties;
+ // @OneToOne(cascade = CascadeType.REMOVE)
+ // private final CustomProperties customProperties;
- @Basic
- @Lob
- @Column(nullable = false)
- private byte[] diggest;
+ @Column(unique = true, nullable = false)
+ @Email
+ @Length(min = 1)
+ private String email;
- @Column(unique = true, nullable = false)
- @Email
- @Length(min = 1)
- private String email;
+ @Id
+ @DocumentId
+ @GeneratedValue
+ private Long id;
- @Id
- @DocumentId
- @GeneratedValue
- private Long id;
+ @ManyToOne
+ @NotNull
+ private I18nLanguage language;
- @ManyToOne
- @NotNull
- private I18nLanguage language;
+ @Basic
+ private Long lastLogin;
- @Basic
- private Long lastLogin;
+ @Field(index = Index.TOKENIZED, store = Store.NO)
+ @Column(nullable = false, unique = true)
+ @Length(min = 3, max = 50)
+ private String name;
- @Field(index = Index.TOKENIZED, store = Store.NO)
- @Column(nullable = false)
- @Length(min = 3, max = 50)
- private String name;
+ @Column(nullable = false)
+ @Length(min = 6, max = 40)
+ private String password;
- @Column(nullable = false)
- @Length(min = 6, max = 40)
- private String password;
+ @Basic
+ @Lob
+ @Column(nullable = false)
+ private byte[] salt;
- @Basic
- @Lob
- @Column(nullable = false)
- private byte[] salt;
+ @Field(index = Index.UN_TOKENIZED, store = Store.NO)
+ @Column(unique = true)
+ // http://www.hibernate.org/hib_docs/validator/reference/en/html/validator-defineconstraints.html
+ @Length(min = 3, max = 15)
+ @Pattern(regex = "^[a-z0-9]+$", message = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes")
+ private String shortName;
- @Field(index = Index.UN_TOKENIZED, store = Store.NO)
- @Column(unique = true)
- // http://www.hibernate.org/hib_docs/validator/reference/en/html/validator-defineconstraints.html
- @Length(min = 3, max = 15)
- @Pattern(regex = "^[a-z0-9]+$", message = "The name must be between 3 and 15 lowercase characters. It can only contain Western characters, numbers, and dashes")
- private String shortName;
+ @Enumerated(EnumType.STRING)
+ private UserSNetVisibility sNetVisibility;
- @NotNull
- private TimeZone timezone;
+ @NotNull
+ private TimeZone timezone;
- @OneToOne(cascade = CascadeType.REMOVE)
- private Group userGroup;
+ @OneToOne(cascade = CascadeType.REMOVE)
+ private Group userGroup;
- // @OneToOne
- // @OnDelete(action = OnDeleteAction.CASCADE)
- // private Properties properties;
+ // @OneToOne
+ // @OnDelete(action = OnDeleteAction.CASCADE)
+ // private Properties properties;
- public User() {
- this(null, null, null, null, null, null, null, null, null);
- }
+ public User() {
+ this(null, null, null, null, null, null, null, null, null);
+ }
- //
- // public User(final String shortName, final String longName, final String
- // email, final String passwd,
- // final I18nLanguage language, final I18nCountry country, final TimeZone
- // timezone) {
- // this(shortName, longName, email, passwd, language, country, timezone,
- // null);
- // }
+ //
+ // public User(final String shortName, final String longName, final String
+ // email, final String passwd,
+ // final I18nLanguage language, final I18nCountry country, final TimeZone
+ // timezone) {
+ // this(shortName, longName, email, passwd, language, country, timezone,
+ // null);
+ // }
- public User(final String shortName, final String longName, final String email, final String passwd,
- final byte[] diggets, final byte[] salt, final I18nLanguage language, final I18nCountry country,
- final TimeZone timezone) {
- this.shortName = shortName;
- this.name = longName;
- this.email = email;
- this.password = passwd;
- this.diggest = diggets;
- this.salt = salt;
- this.userGroup = null;
- this.language = language;
- this.country = country;
- this.timezone = timezone;
- // customProperties = new CustomProperties();
- sNetVisibility = UserSNetVisibility.anyone;
- this.createdOn = System.currentTimeMillis();
- this.lastLogin = null;
- // this.properties = properties;
- }
+ public User(final String shortName, final String longName, final String email, final String passwd,
+ final byte[] diggets, final byte[] salt, final I18nLanguage language, final I18nCountry country,
+ final TimeZone timezone) {
+ this.shortName = shortName;
+ this.name = longName;
+ this.email = email;
+ this.password = passwd;
+ this.diggest = diggets;
+ this.salt = salt;
+ this.userGroup = null;
+ this.language = language;
+ this.country = country;
+ this.timezone = timezone;
+ // customProperties = new CustomProperties();
+ sNetVisibility = UserSNetVisibility.anyone;
+ this.createdOn = System.currentTimeMillis();
+ this.lastLogin = null;
+ // this.properties = properties;
+ }
- public UserSNetVisibility getSNetVisibility() {
- return sNetVisibility;
- }
+ public I18nCountry getCountry() {
+ return country;
+ }
- public I18nCountry getCountry() {
- return country;
- }
+ public Long getCreatedOn() {
+ return createdOn;
+ }
- public Long getCreatedOn() {
- return createdOn;
- }
+ public byte[] getDiggest() {
+ return diggest;
+ }
- // public CustomProperties getCustomProperties() {
- // return customProperties;
- // }
+ // public CustomProperties getCustomProperties() {
+ // return customProperties;
+ // }
- public byte[] getDiggest() {
- return diggest;
- }
+ public String getEmail() {
+ return email;
+ }
- public String getEmail() {
- return email;
- }
+ public boolean getHasLogo() {
+ return hasLogo();
+ }
- public boolean getHasLogo() {
- return hasLogo();
- }
+ @Override
+ public Long getId() {
+ return id;
+ }
- @Override
- public Long getId() {
- return id;
- }
+ public I18nLanguage getLanguage() {
+ return language;
+ }
- public I18nLanguage getLanguage() {
- return language;
- }
+ public Long getLastLogin() {
+ return lastLogin;
+ }
- public Long getLastLogin() {
- return lastLogin;
- }
+ public String getName() {
+ return name;
+ }
- public String getName() {
- return name;
- }
+ public String getPassword() {
+ return password;
+ }
- // public Properties getProperties() {
- // return properties;
- // }
+ // public Properties getProperties() {
+ // return properties;
+ // }
- public String getPassword() {
- return password;
- }
+ public byte[] getSalt() {
+ return salt;
+ }
- public byte[] getSalt() {
- return salt;
- }
+ public String getShortName() {
+ return shortName;
+ }
- public String getShortName() {
- return shortName;
- }
+ public UserSNetVisibility getSNetVisibility() {
+ return sNetVisibility;
+ }
- @Transient
- public StateToken getStateToken() {
- return userGroup.getStateToken();
- }
+ @Transient
+ public StateToken getStateToken() {
+ return userGroup.getStateToken();
+ }
- public TimeZone getTimezone() {
- return timezone;
- }
+ public TimeZone getTimezone() {
+ return timezone;
+ }
- public Group getUserGroup() {
- return userGroup;
- }
+ public Group getUserGroup() {
+ return userGroup;
+ }
- @Transient
- public boolean hasLogo() {
- return getUserGroup().hasLogo();
- }
+ @Transient
+ public boolean hasLogo() {
+ return getUserGroup().hasLogo();
+ }
- public void setSNetVisibility(final UserSNetVisibility sNetVisibility) {
- this.sNetVisibility = sNetVisibility;
- }
+ public void setCountry(final I18nCountry country) {
+ this.country = country;
+ }
- public void setCountry(final I18nCountry country) {
- this.country = country;
- }
+ public void setDiggest(final byte[] diggest) {
+ this.diggest = diggest;
+ }
- public void setDiggest(final byte[] diggest) {
- this.diggest = diggest;
- }
+ public void setEmail(final String email) {
+ this.email = email;
+ }
- public void setEmail(final String email) {
- this.email = email;
- }
+ @Override
+ public void setId(final Long id) {
+ this.id = id;
+ }
- @Override
- public void setId(final Long id) {
- this.id = id;
- }
+ public void setLanguage(final I18nLanguage language) {
+ this.language = language;
+ }
- public void setLanguage(final I18nLanguage language) {
- this.language = language;
- }
+ public void setLastLogin(final Long lastLogin) {
+ this.lastLogin = lastLogin;
+ }
- public void setLastLogin(final Long lastLogin) {
- this.lastLogin = lastLogin;
- }
+ public void setName(final String name) {
+ this.name = name;
+ }
- public void setName(final String name) {
- this.name = name;
- }
+ public void setPassword(final String password) {
+ this.password = password;
+ }
- public void setPassword(final String password) {
- this.password = password;
- }
+ public void setSalt(final byte[] salt) {
+ this.salt = salt;
+ }
- public void setSalt(final byte[] salt) {
- this.salt = salt;
- }
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
- public void setShortName(final String shortName) {
- this.shortName = shortName;
- }
+ public void setSNetVisibility(final UserSNetVisibility sNetVisibility) {
+ this.sNetVisibility = sNetVisibility;
+ }
- public void setTimezone(final TimeZone timezone) {
- this.timezone = timezone;
- }
+ public void setTimezone(final TimeZone timezone) {
+ this.timezone = timezone;
+ }
- public void setUserGroup(final Group userGroup) {
- this.userGroup = userGroup;
- }
+ public void setUserGroup(final Group userGroup) {
+ this.userGroup = userGroup;
+ }
- @Override
- public String toString() {
- return "User[" + shortName + "]";
- }
+ @Override
+ public String toString() {
+ return "User[" + shortName + "]";
+ }
}
Modified: trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/domain/finders/GroupFinder.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -31,10 +31,19 @@
public interface GroupFinder {
+ @Finder(query = "SELECT count(*) FROM Group g WHERE g.longName = :longName")
+ public Long countByLongName(@Named("longName") final String longName);
+
+ @Finder(query = "SELECT count(*) FROM Group g WHERE g.shortName = :shortName")
+ public Long countByShortName(@Named("shortName") final String shortName);
+
@Finder(query = "FROM Group g WHERE g.id IN (SELECT g.id "
+ "FROM g.socialNetwork.accessLists.admins.list adm WHERE adm.id = :groupid)", returnAs = HashSet.class)
public Set<Group> findAdminInGroups(@Named("groupid") final Long groupId);
+ @Finder(query = "FROM Group g WHERE g.longName = :longName")
+ public Group findByLongName(@Named("longName") final String longName);
+
@Finder(query = "FROM Group g WHERE g.shortName = :shortName")
public Group findByShortName(@Named("shortName") final String shortName);
Modified: trunk/src/main/java/cc/kune/domain/finders/UserFinder.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/finders/UserFinder.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/main/java/cc/kune/domain/finders/UserFinder.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -29,16 +29,27 @@
public interface UserFinder {
- @Finder(query = "from User", returnAs = ArrayList.class)
- public List<User> getAll();
+ @Finder(query = "select count (*) from User where email = :email")
+ public Long countByEmail(@Named("email") final String email);
- @Finder(query = "from User where email = :email")
- public User getByEmail(@Named("email") final String email);
+ @Finder(query = "select count (*) from User where name = :name")
+ public Long countByLongName(@Named("name") final String name);
- @Finder(query = "from User where id = :id")
- public User getById(@Named("id") final Long id);
+ @Finder(query = "select count (*) from User where shortName = :shortName")
+ public Long countByShortName(@Named("shortName") final String shortName);
- @Finder(query = "from User where shortName = :shortName")
- public User getByShortName(@Named("shortName") final String shortName);
+ @Finder(query = "from User where email = :email")
+ public User findByEmail(@Named("email") final String email);
+ @Finder(query = "from User where id = :id")
+ public User findById(@Named("id") final Long id);
+
+ @Finder(query = "from User where name = :name")
+ public User findByLongName(@Named("name") final String name);
+
+ @Finder(query = "from User where shortName = :shortName")
+ public User findByShortName(@Named("shortName") final String shortName);
+
+ @Finder(query = "from User", returnAs = ArrayList.class)
+ public List<User> getAll();
}
Modified: trunk/src/test/java/cc/kune/core/server/finders/UserFinderTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/finders/UserFinderTest.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/test/java/cc/kune/core/server/finders/UserFinderTest.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -46,7 +46,7 @@
@Test
public void findByEmail() {
- final User user = finder.getByEmail("one at here.com");
+ final User user = finder.findByEmail("one at here.com");
assertNotNull(user);
}
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-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -30,7 +30,8 @@
import org.junit.Test;
import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.server.integration.IntegrationTest;
@@ -90,14 +91,22 @@
@Test(expected = EmailAddressInUseException.class)
public void createUserExistingEmailFails() throws Exception {
assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", "test", "123456", properties.getAdminEmail(), lang,
+ final UserDTO user = new UserDTO("test2", "test2", "123456", properties.getAdminEmail(), lang,
country, timezone, null, true, SubscriptionMode.manual, "blue");
userService.createUser(user, false);
}
- @Test(expected = GroupNameInUseException.class)
- public void createUserExistingNameFails() throws Exception {
+ @Test(expected = GroupLongNameInUseException.class)
+ public void createUserExistingLongNameFails() throws Exception {
assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO(properties.getAdminUserName(), "test", "123456",
+ "example1234 at example.com", lang, country, timezone, null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user, false);
+ }
+
+ @Test(expected = GroupShortNameInUseException.class)
+ public void createUserExistingShortNameFails() 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);
Modified: trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/test/java/cc/kune/core/server/manager/GroupManagerDefaultTest.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -29,7 +29,8 @@
import org.junit.Test;
import cc.kune.core.client.errors.EmailAddressInUseException;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupLongNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.client.errors.UserRegistrationException;
import cc.kune.core.server.PersistencePreLoadedDataTest;
@@ -79,7 +80,7 @@
rollbackTransaction();
}
- @Test(expected = GroupNameInUseException.class)
+ @Test(expected = GroupLongNameInUseException.class)
public void createGroupWithExistingLongName() throws Exception {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
@@ -93,7 +94,7 @@
rollbackTransaction();
}
- @Test(expected = GroupNameInUseException.class)
+ @Test(expected = GroupShortNameInUseException.class)
public void createGroupWithExistingShortName() throws Exception {
final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
GroupType.PROJECT);
@@ -113,7 +114,7 @@
}
@Test(expected = EmailAddressInUseException.class)
- public void createUserExistingEmail() throws I18nNotFoundException, GroupNameInUseException,
+ public void createUserExistingEmail() throws I18nNotFoundException, GroupShortNameInUseException,
EmailAddressInUseException {
userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en", "GB",
"GMT", true);
@@ -121,8 +122,8 @@
"GMT", true);
}
- @Test(expected = GroupNameInUseException.class)
- public void createUserExistingLongName() throws I18nNotFoundException, GroupNameInUseException,
+ @Test(expected = GroupLongNameInUseException.class)
+ public void createUserExistingLongName() throws I18nNotFoundException, GroupShortNameInUseException,
EmailAddressInUseException {
userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en", "GB",
"GMT", true);
@@ -130,8 +131,8 @@
"GMT", true);
}
- @Test(expected = GroupNameInUseException.class)
- public void createUserExistingShortName() throws I18nNotFoundException, GroupNameInUseException,
+ @Test(expected = GroupShortNameInUseException.class)
+ public void createUserExistingShortName() throws I18nNotFoundException, GroupShortNameInUseException,
EmailAddressInUseException {
userManager.createUser("test", "test 1 name", "test21 at example.com", "some password", "en", "GB",
"GMT", true);
@@ -146,14 +147,14 @@
rollbackTransaction();
}
- @Test(expected = GroupNameInUseException.class)
+ @Test(expected = GroupLongNameInUseException.class)
public void createUserWithExistingLongName() throws Exception {
userManager.createUser("username2", USER_LONG_NAME, "email2 at example.com", "userPassword", "en",
"GB", TimeZone.getDefault().getID(), true);
rollbackTransaction();
}
- @Test(expected = GroupNameInUseException.class)
+ @Test(expected = GroupShortNameInUseException.class)
public void createUserWithExistingShortName() throws Exception {
userManager.createUser(USER_SHORT_NAME, "the user name 2", "email2 at example.com", "userPassword",
"en", "GB", TimeZone.getDefault().getID(), true);
Modified: trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java 2011-08-14 01:21:47 UTC (rev 1494)
+++ trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java 2011-08-14 11:54:12 UTC (rev 1495)
@@ -31,7 +31,7 @@
import org.hibernate.validator.InvalidStateException;
import org.junit.Test;
-import cc.kune.core.client.errors.GroupNameInUseException;
+import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.server.PersistencePreLoadedDataTest;
import cc.kune.core.server.manager.impl.SearchResult;
@@ -99,7 +99,7 @@
* This was not working:
* http://opensource.atlassian.com/projects/hibernate/browse/EJB-382
*/
- @Test(expected = GroupNameInUseException.class)
+ @Test(expected = GroupShortNameInUseException.class)
public void testUserExist() throws I18nNotFoundException {
final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com",
"some password", "en", "GB", "GMT", true);
More information about the kune-commits
mailing list