[kune-commits] r770 - in trunk: . script
src/main/java/org/ourproject/kune/app
src/main/java/org/ourproject/kune/app/client
src/main/java/org/ourproject/kune/app/server
src/main/java/org/ourproject/kune/chat
src/main/java/org/ourproject/kune/chat/client
src/main/java/org/ourproject/kune/chat/client/actions
src/main/java/org/ourproject/kune/chat/client/cnt
src/main/java/org/ourproject/kune/platf/client/app
src/main/java/org/ourproject/kune/platf/client/dto
src/main/java/org/ourproject/kune/platf/client/rpc
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/server/domain
src/main/java/org/ourproject/kune/workspace/client/actions
src/main/java/org/ourproject/kune/workspace/client/i18n
src/main/java/org/ourproject/kune/workspace/client/sitebar/login
src/test/java/org/ourproject/kune/platf/integration/content
src/test/java/org/ourproject/kune/platf/integration/site
src/test/java/org/ourproject/kune/platf/server/finders
src/test/java/org/ourproject/kune/platf/server/manager
src/test/java/org/ourproject/kune/platf/server/mapper
vjrj
vjrj at ourproject.org
Sat May 31 22:03:35 CEST 2008
Author: vjrj
Date: 2008-05-31 22:03:25 +0200 (Sat, 31 May 2008)
New Revision: 770
Added:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
Removed:
trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java
Modified:
trunk/TODO
trunk/pom.xml
trunk/script/copy_deploy.sh
trunk/script/css-update.sh
trunk/script/deploy_gwt.cmd
trunk/script/deploy_gwt.sh
trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
trunk/src/main/java/org/ourproject/kune/chat/Kune-Chat.gwt.xml
trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java
trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java
trunk/src/main/java/org/ourproject/kune/chat/client/actions/InitChatEngineAction.java
trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
Log:
First emite modules use, gwt1.5rc, new emite version
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/TODO 2008-05-31 20:03:25 UTC (rev 770)
@@ -11,6 +11,7 @@
- " Desktop
- LoginPanel issues
- NGPanel issues
+ - use of http://google-web-toolkit-doc-1-5.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/rpc/StatusCodeException.html
--> vjrj
<vjrj/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/pom.xml 2008-05-31 20:03:25 UTC (rev 770)
@@ -31,13 +31,13 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
- <version>0.0.2415</version>
+ <version>1.5.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
- <version>0.0.2415</version>
+ <version>1.5.0</version>
</dependency>
<!-- Use new repo -->
<!-- http://code.google.com/p/gwt-ext/issues/detail?id=180 -->
@@ -49,17 +49,17 @@
<dependency>
<groupId>com.gwtext</groupId>
<artifactId>gwtext</artifactId>
- <version>2.0.4-beta1</version>
+ <version>2.0.4-beta2</version>
</dependency>
<dependency>
<groupId>com.allen_sauer.gwt.log.gwt-log</groupId>
<artifactId>gwt-log</artifactId>
- <version>1.5.6</version>
+ <version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.allen_sauer.gwt.voices.gwt-voices</groupId>
<artifactId>gwt-voices</artifactId>
- <version>1.0.0</version>
+ <version>1.5.1</version>
</dependency>
<!-- utilities -->
@@ -242,8 +242,10 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.3.1</version>
- <scope>test</scope>
+ <version>4.4</version>
+ <!--
+ <scope>test</scope>
+ -->
</dependency>
<dependency>
<groupId>org.easymock</groupId>
@@ -268,12 +270,12 @@
<dependency>
<groupId>com.calclab.emite</groupId>
<artifactId>emite</artifactId>
- <version>0.2.3</version>
+ <version>0.2.8</version>
</dependency>
<dependency>
<groupId>com.calclab.emite</groupId>
- <artifactId>emiteuiplugin</artifactId>
- <version>0.2.3</version>
+ <artifactId>emiteuimodule</artifactId>
+ <version>0.2.8</version>
</dependency>
</dependencies>
<!-- http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plugin/index.html -->
@@ -301,16 +303,6 @@
<url>http://www.gwt-ext.com/maven2/</url>
</repository>
</repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>gwt-maven</id>
- <url>http://gwt-maven.googlecode.com/svn/trunk/mavenrepo/</url>
- </pluginRepository>
- <pluginRepository>
- <id>kune-maven</id>
- <url>http://kune.ourproject.org/mavenrepo/</url>
- </pluginRepository>
- </pluginRepositories>
<build>
<plugins>
<plugin>
@@ -318,7 +310,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3</version>
</plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Modified: trunk/script/copy_deploy.sh
===================================================================
--- trunk/script/copy_deploy.sh 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/script/copy_deploy.sh 2008-05-31 20:03:25 UTC (rev 770)
@@ -4,4 +4,4 @@
script/css-update.sh
rm src/main/webapp/gwt/org.ourproject.kune.app.Kune/ -R
-cp target/org.ourproject.kune-0.0.3/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/ -R
+cp target/org.ourproject.kune-0.0.4/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/ -R
Modified: trunk/script/css-update.sh
===================================================================
--- trunk/script/css-update.sh 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/script/css-update.sh 2008-05-31 20:03:25 UTC (rev 770)
@@ -1,7 +1,7 @@
#!/bin/bash
APPPUB=src/main/java/org/ourproject/kune/app/public
WEBAPP=src/main/webapp/gwt/org.ourproject.kune.app.Kune
-TARGET=target/org.ourproject.kune-0.0.3/org.ourproject.kune.app.Kune
+TARGET=target/org.ourproject.kune-0.0.4/org.ourproject.kune.app.Kune
$PWD/script/css-compact-and-tidy.css
Modified: trunk/script/deploy_gwt.cmd
===================================================================
--- trunk/script/deploy_gwt.cmd 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/script/deploy_gwt.cmd 2008-05-31 20:03:25 UTC (rev 770)
@@ -1 +1 @@
-copy target\org.ourproject.kune-0.0.3\org.ourproject.kune.Main\* src\main\webapp\gwt\org.ourproject.kune
+copy target\org.ourproject.kune-0.0.4\org.ourproject.kune.Main\* src\main\webapp\gwt\org.ourproject.kune
Modified: trunk/script/deploy_gwt.sh
===================================================================
--- trunk/script/deploy_gwt.sh 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/script/deploy_gwt.sh 2008-05-31 20:03:25 UTC (rev 770)
@@ -1,7 +1,7 @@
#!/bin/bash
-find target/org.ourproject.kune-0.0.3/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
+find target/org.ourproject.kune-0.0.4/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
#script/css-compact-and-tidy.css
script/css-update.sh
-unison -silent -batch -auto -ui text target/org.ourproject.kune-0.0.3/org.ourproject.kune.app.Kune src/main/webapp/gwt/org.ourproject.kune.app.Kune
+unison -silent -batch -auto -ui text target/org.ourproject.kune-0.0.4/org.ourproject.kune.app.Kune src/main/webapp/gwt/org.ourproject.kune.app.Kune
Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-05-31 20:03:25 UTC (rev 770)
@@ -19,31 +19,13 @@
<inherits name='org.ourproject.kune.blogs.Kune-Blogs' />
<inherits name="com.allen_sauer.gwt.log.gwt-log" />
- <!--
- The default log level is `OFF`. In development you'll usually want
- to switch to `DEBUG` level logging.
- -->
+
<extend-property name="log_level" values="DEBUG" />
<set-property name="log_level" value="DEBUG" />
<set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_FirebugLogger" value="ENABLED" />
- <!--
- <set-property name="log_RemoteLogger" value="ENABLED" />
- -->
<!--
- Alternatively, you may want to generate two or more combinations,
- at the cost of increased compile time.
-
- However, please note that the runtime default will still be `OFF`.
-
- To compile both an `OFF` (production) and a `DEBUG` (development)
- version of your application:
-
- <extend-property name="log_level" values="DEBUG,OFF" />
- -->
-
- <!--
<extend-property name="locale" values="es" />
<extend-property name="locale" values="ar" />
-->
Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -24,7 +24,6 @@
import org.ourproject.kune.platf.client.app.ApplicationBuilder;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.services.Kune;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
@@ -39,23 +38,11 @@
}
public void onModuleLoad() {
- /*
- * Install an UncaughtExceptionHandler which will produce <code>FATAL</code>
- * log messages
- */
+ Log.setUncaughtExceptionHandler();
- /*
- * Currently we let firebug to catch the error:
- * Log.setUncaughtExceptionHandler();
- */
-
// At the moment, in runtime:
Log.setCurrentLogLevel(Log.LOG_LEVEL_DEBUG);
- /*
- * Use a deferred command so that the UncaughtExceptionHandler catches
- * any exceptions in onModuleLoadCont()
- */
DeferredCommand.addCommand(new Command() {
public void execute() {
onModuleLoadCont();
@@ -77,8 +64,8 @@
Log.debug("Workspace adaptation to your language failed");
}
- public void onSuccess(final HashMap<String, String> result) {
- I18nUITranslationService.getInstance().setLexicon(result);
+ public void onSuccess(final HashMap<String, String> lexicon) {
+ Kune.I18N.setLexicon(lexicon);
new ApplicationBuilder().build(userHash, initialLang);
}
});
Modified: trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -57,6 +57,10 @@
private final Module configModule;
+ public KuneRackModule() {
+ this("development", "kune.properties", null);
+ }
+
public KuneRackModule(final String jpaUnit, final String propertiesFileName, final Scope sessionScope) {
configModule = new AbstractModule() {
public void configure() {
@@ -70,10 +74,7 @@
};
}
- public KuneRackModule() {
- this("development", "kune.properties", null);
- }
-
+ @SuppressWarnings("unchecked")
public void configure(final RackBuilder builder) {
installGuiceModules(builder);
Modified: trunk/src/main/java/org/ourproject/kune/chat/Kune-Chat.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/Kune-Chat.gwt.xml 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/Kune-Chat.gwt.xml 2008-05-31 20:03:25 UTC (rev 770)
@@ -2,5 +2,5 @@
<inherits name='org.ourproject.kune.platf.Kune-Platform' />
<inherits name='org.ourproject.kune.workspace.Kune-Workspace' />
<inherits name="com.calclab.emite.Emite" />
- <inherits name="com.calclab.emiteuiplugin.EmiteUIPlugin" />
+ <inherits name="com.calclab.emiteuimodule.EmiteUIModule" />
</module>
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -33,20 +33,18 @@
private final ChatToolComponents components;
private ChatEngine chat;
+ private final Kune kune;
- public ChatClientTool() {
+ public ChatClientTool(final Kune kune) {
super(Kune.I18N.t("chat rooms"));
- components = new ChatToolComponents();
+ this.kune = kune;
+ components = new ChatToolComponents(kune.getEmiteUIDialog());
}
public ChatEngine getChat() {
return chat;
}
- public void initEngine(final ChatState state) {
- this.chat = new ChatEngineXmpp(state);
- }
-
public WorkspaceComponent getContent() {
return components.getContent();
}
@@ -59,6 +57,10 @@
return NAME;
}
+ public void initEngine(final ChatOptions options) {
+ this.chat = new ChatEngineXmpp(kune.getEmiteUIDialog(), options);
+ }
+
public void setContent(final StateDTO state) {
components.getContent().setState(state);
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -20,11 +20,11 @@
package org.ourproject.kune.chat.client;
public interface ChatEngine {
- void login(String chatName, String chatPassword);
+ ChatOptions getChatOptions();
- ChatState getState();
-
void joinRoom(String roomName, String userAlias);
+ void login(String chatName, String chatPassword);
+
void logout();
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -21,63 +21,75 @@
import java.util.Date;
-import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.services.Kune;
import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.emite.client.core.bosh.BoshOptions;
+import com.calclab.emite.client.core.signal.Listener;
import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.calclab.emite.client.xmpp.stanzas.XmppURI;
-import com.calclab.emiteuiplugin.client.EmiteUIPlugin;
-import com.calclab.emiteuiplugin.client.UserChatOptions;
-import com.calclab.emiteuiplugin.client.dialog.OwnPresence;
-import com.calclab.emiteuiplugin.client.dialog.OwnPresence.OwnStatus;
-import com.calclab.emiteuiplugin.client.params.AvatarProvider;
-import com.calclab.emiteuiplugin.client.params.MultiChatCreationParam;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
+import com.calclab.emiteuimodule.client.UserChatOptions;
+import com.calclab.emiteuimodule.client.params.AvatarProvider;
+import com.calclab.emiteuimodule.client.params.MultiChatCreationParam;
+import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
+import com.google.gwt.user.client.Window;
class ChatEngineXmpp implements ChatEngine {
- private final ChatState state;
+ private final ChatOptions chatOptions;
+ private final EmiteUIDialog emiteDialog;
- public ChatEngineXmpp(final ChatState state) {
- this.state = state;
+ public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatOptions chatOptions) {
+ this.emiteDialog = emiteUIDialog;
+ this.chatOptions = chatOptions;
}
- public ChatState getState() {
- return state;
+ public ChatOptions getChatOptions() {
+ return chatOptions;
}
public void joinRoom(final String roomName, final String userAlias) {
- // FIXME muc nick support
- DefaultDispatcher.getInstance().fire(
- EmiteUIPlugin.ROOMOPEN,
- XmppURI.uri(roomName + "@" + state.roomHost + "/" + XmppURI.jid(state.userOptions.getUserJid()))
- .getNode());
+ XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
+ + XmppURI.jid(chatOptions.userOptions.getUserJid()));
+ emiteDialog.joinRoom(roomURI);
}
public void login(final String chatName, final String chatPassword) {
final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
// getGwtMetaProperty(GWT_PROPERTY_RELEASE);
- final UserChatOptions userChatOptions = new UserChatOptions(chatName + "@" + state.domain, chatPassword,
- resource, "blue", SubscriptionMode.autoAcceptAll);
+ // FIXME, get this from user profile
+ final UserChatOptions userChatOptions = new UserChatOptions(chatName + "@" + chatOptions.domain, chatPassword,
+ resource, "blue", SubscriptionMode.autoAcceptAll, true);
// FIXME: Avatar provider
final AvatarProvider avatarProvider = new AvatarProvider() {
public String getAvatarURL(XmppURI userURI) {
return "images/person-def.gif";
}
};
- state.userOptions = userChatOptions;
- DefaultDispatcher.getInstance().fire(
- EmiteUIPlugin.CREATE_CHAT_DIALOG,
- new MultiChatCreationParam(Kune.I18N.t("Chat"), new BoshOptions(state.httpBase), state.roomHost,
- Kune.I18N, avatarProvider, state.userOptions));
+
+ final String initialWindowTitle = Window.getTitle();
+ emiteDialog.onConversationAttended(new Listener<String>() {
+ public void onEvent(final String parameter) {
+ Window.setTitle(initialWindowTitle);
+ }
+ });
+ emiteDialog.onConversationUnattended(new Listener<String>() {
+ public void onEvent(final String chatTitle) {
+ Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
+ }
+ });
+ chatOptions.userOptions = userChatOptions;
+
+ emiteDialog.getChatDialog(new MultiChatCreationParam(Kune.I18N.t("Chat"), chatOptions.roomHost, avatarProvider,
+ chatOptions.userOptions));
Log.debug("LOGIN CHAT: " + chatName + "[" + chatPassword + "]");
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.SHOW_CHAT_DIALOG, null);
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.HIDE_CHAT_DIALOG, null);
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.SET_OWN_PRESENCE, new OwnPresence(OwnStatus.online));
+ emiteDialog.show(OwnStatus.online);
+ emiteDialog.hide();
}
public void logout() {
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.SET_OWN_PRESENCE, new OwnPresence(OwnStatus.offline));
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.CLOSE_ALLCHATS, new Boolean(false));
+ if (emiteDialog.isStarted()) {
+ emiteDialog.closeAllChats(false);
+ emiteDialog.setOwnPresence(OwnStatus.offline);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -39,11 +39,13 @@
import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel;
import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
+
public class ChatFactory {
- public static ChatContent createChatContent() {
+ public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog) {
WorkspaceDeckPanel panel = new WorkspaceDeckPanel();
- ChatContentPresenter presenter = new ChatContentPresenter(panel);
+ ChatContentPresenter presenter = new ChatContentPresenter(emiteUIDialog, panel);
return presenter;
}
@@ -53,9 +55,14 @@
return presenter;
}
- public static RoomsAdmin createRoomsAdmin() {
- ContextItems contextItems = WorkspaceFactory.createContextItems();
- RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems);
+ public static ChatInfo createChatInfo(final ChatRoomListener listener) {
+ ChatInfoPanel panel = new ChatInfoPanel(listener);
+ return panel;
+ }
+
+ public static ChatRoomControl createChatRoomControlViewer(final ChatRoomListener listener) {
+ ChatRoomControlPanel panel = new ChatRoomControlPanel(listener);
+ ChatRoomControlPresenter presenter = new ChatRoomControlPresenter(panel);
return presenter;
}
@@ -65,15 +72,10 @@
return presenter;
}
- public static ChatRoomControl createChatRoomControlViewer(final ChatRoomListener listener) {
- ChatRoomControlPanel panel = new ChatRoomControlPanel(listener);
- ChatRoomControlPresenter presenter = new ChatRoomControlPresenter(panel);
+ public static RoomsAdmin createRoomsAdmin() {
+ ContextItems contextItems = WorkspaceFactory.createContextItems();
+ RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems);
return presenter;
}
- public static ChatInfo createChatInfo(final ChatRoomListener listener) {
- ChatInfoPanel panel = new ChatInfoPanel(listener);
- return panel;
- }
-
}
Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java (from rev 741, trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java 2008-05-06 23:25:52 UTC (rev 741)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatOptions.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -0,0 +1,36 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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 org.ourproject.kune.chat.client;
+
+import com.calclab.emiteuimodule.client.UserChatOptions;
+
+public class ChatOptions {
+ public UserChatOptions userOptions;
+ public final String httpBase;
+ public final String domain;
+ public final String roomHost;
+
+ public ChatOptions(final String httpBase, final String domain, final String roomHost) {
+ this.httpBase = httpBase;
+ this.domain = domain;
+ this.roomHost = roomHost;
+ userOptions = null;
+ }
+}
Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatState.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -1,36 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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 org.ourproject.kune.chat.client;
-
-import com.calclab.emiteuiplugin.client.UserChatOptions;
-
-public class ChatState {
- public UserChatOptions userOptions;
- public final String httpBase;
- public final String domain;
- public final String roomHost;
-
- public ChatState(final String httpBase, final String domain, final String roomHost) {
- this.httpBase = httpBase;
- this.domain = domain;
- this.roomHost = roomHost;
- userOptions = null;
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -23,16 +23,20 @@
import org.ourproject.kune.chat.client.cnt.ChatContent;
import org.ourproject.kune.chat.client.ctx.ChatContext;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
+
class ChatToolComponents {
private ChatContent content;
private ChatContext context;
+ private final EmiteUIDialog emiteUIDialog;
- public ChatToolComponents() {
+ public ChatToolComponents(final EmiteUIDialog emiteUIDialog) {
+ this.emiteUIDialog = emiteUIDialog;
}
public ChatContent getContent() {
if (content == null) {
- content = ChatFactory.createChatContent();
+ content = ChatFactory.createChatContent(emiteUIDialog);
}
return content;
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/actions/InitChatEngineAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/actions/InitChatEngineAction.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/actions/InitChatEngineAction.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -20,7 +20,7 @@
package org.ourproject.kune.chat.client.actions;
import org.ourproject.kune.chat.client.ChatClientTool;
-import org.ourproject.kune.chat.client.ChatState;
+import org.ourproject.kune.chat.client.ChatOptions;
import org.ourproject.kune.platf.client.dispatch.Action;
import org.ourproject.kune.platf.client.dto.InitDataDTO;
@@ -34,9 +34,9 @@
public void execute(final InitDataDTO value) {
InitDataDTO initData = value;
- ChatState state = new ChatState(initData.getChatHttpBase(), initData.getChatDomain(), initData
+ ChatOptions chatOptions = new ChatOptions(initData.getChatHttpBase(), initData.getChatDomain(), initData
.getChatRoomHost());
- chatTool.initEngine(state);
+ chatTool.initEngine(chatOptions);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatContentPresenter.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -34,17 +34,19 @@
import org.ourproject.kune.workspace.client.component.WorkspaceDeckView;
import com.calclab.emite.client.xmpp.stanzas.XmppURI;
-import com.calclab.emiteuiplugin.client.EmiteUIPlugin;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
public class ChatContentPresenter implements ChatContent, ChatRoomListener {
private final WorkspaceDeckView view;
private final ChatComponents components;
private StateDTO state;
+ private final EmiteUIDialog emiteUIDialog;
- public ChatContentPresenter(final WorkspaceDeckView view) {
- this.view = view;
- this.components = new ChatComponents(this);
+ public ChatContentPresenter(final EmiteUIDialog emiteUIDialog, final WorkspaceDeckView view) {
+ this.emiteUIDialog = emiteUIDialog;
+ this.view = view;
+ this.components = new ChatComponents(this);
}
public void attach() {
@@ -54,37 +56,36 @@
}
public View getView() {
- return view;
+ return view;
}
- public void setState(final StateDTO state) {
- this.state = state;
- String typeId = state.getTypeId();
- if (typeId.equals(ChatClientTool.TYPE_ROOT)) {
- ChatInfo info = components.getChatInfo();
- view.show(info.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET, ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- } else if (typeId.equals(ChatClientTool.TYPE_ROOM)) {
- ChatRoom viewer = components.getChatRoom();
- view.show(viewer.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET, ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- DefaultDispatcher.getInstance().fire(
- PlatformEvents.ATTACH_TO_EXTENSIBLE_WIDGET,
- new ExtensibleWidgetChild(ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT, components.getChatRoomControl()
- .getView()));
- } else {
- view.show(UnknowComponent.instance.getView());
- DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET, ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
- }
+ public void onEnterRoom() {
+ String roomName = state.getFolder().getName();
+ emiteUIDialog.joinRoom(XmppURI.uri(roomName));
}
- public void onEnterRoom() {
- String roomName = state.getFolder().getName();
- // FIXME Moderator?
- // Room room = getRoom(roomName, "me" + new Date().getTime(),
- // RoomUser.MODERADOR);
-
- DefaultDispatcher.getInstance().fire(EmiteUIPlugin.ROOMOPEN, XmppURI.uri(roomName));
+ public void setState(final StateDTO state) {
+ this.state = state;
+ String typeId = state.getTypeId();
+ if (typeId.equals(ChatClientTool.TYPE_ROOT)) {
+ ChatInfo info = components.getChatInfo();
+ view.show(info.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ } else if (typeId.equals(ChatClientTool.TYPE_ROOM)) {
+ ChatRoom viewer = components.getChatRoom();
+ view.show(viewer.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ DefaultDispatcher.getInstance().fire(
+ PlatformEvents.ATTACH_TO_EXTENSIBLE_WIDGET,
+ new ExtensibleWidgetChild(ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT, components.getChatRoomControl()
+ .getView()));
+ } else {
+ view.show(UnknowComponent.instance.getView());
+ DefaultDispatcher.getInstance().fire(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET,
+ ExtensibleWidgetId.CONTENT_TOOLBAR_LEFT);
+ }
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -35,7 +35,6 @@
import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager;
-import org.ourproject.kune.platf.client.extend.PluginManager;
import org.ourproject.kune.platf.client.rpc.ContentService;
import org.ourproject.kune.platf.client.services.Kune;
import org.ourproject.kune.platf.client.services.KuneErrorHandler;
@@ -50,7 +49,6 @@
import org.ourproject.kune.workspace.client.sitebar.Site;
import org.ourproject.kune.workspace.client.workspace.Workspace;
-import com.calclab.emiteuiplugin.client.EmiteUIPlugin;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowCloseListener;
@@ -61,8 +59,10 @@
}
public void build(final String userHash, final I18nLanguageDTO initialLang) {
+ final Kune kune = Kune.getInstance();
+
final KunePlatform platform = new KunePlatform();
- final ChatClientTool chatClientTool = new ChatClientTool();
+ final ChatClientTool chatClientTool = new ChatClientTool(kune);
platform.addTool(new DocumentClientTool());
platform.addTool(chatClientTool);
// platform.addTool(new BlogClientTool());
@@ -99,9 +99,10 @@
application.init(dispatcher, stateManager);
subscribeActions(dispatcher, platform.getActions());
- final PluginManager pluginManager = new PluginManager(dispatcher, extensionPointManager, Kune.I18N);
+ // final PluginManager pluginManager = new PluginManager(dispatcher,
+ // extensionPointManager, Kune.I18N);
// pluginManager.install(new HelloWorldPlugin());
- pluginManager.install(new EmiteUIPlugin());
+ // pluginManager.install(new EmiteUIPlugin());
Window.addWindowCloseListener(new WindowCloseListener() {
public void onWindowClosed() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserDTO.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -19,6 +19,7 @@
*/
package org.ourproject.kune.platf.client.dto;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.gwt.user.client.rpc.IsSerializable;
public class UserDTO implements IsSerializable {
@@ -30,13 +31,19 @@
private TimeZoneDTO timezone;
private String password;
private String email;
+ private String avatar;
+ private boolean publishRoster;
+ private SubscriptionMode subscriptionMode;
+ private String chatColor;
public UserDTO() {
- this(null, null, null, null, null, null, null);
+ this(null, null, null, null, null, null, null, null, true, null, null);
}
public UserDTO(final String name, final String shortName, final String password, final String email,
- final I18nLanguageDTO language, final I18nCountryDTO country, final TimeZoneDTO timezone) {
+ final I18nLanguageDTO language, final I18nCountryDTO country, final TimeZoneDTO timezone,
+ final String avatar, final boolean publishRoster, final SubscriptionMode subscriptionMode,
+ final String chatColor) {
this.name = name;
this.shortName = shortName;
this.password = password;
@@ -44,70 +51,106 @@
this.language = language;
this.country = country;
this.timezone = timezone;
+ this.avatar = avatar;
+ this.publishRoster = publishRoster;
+ this.subscriptionMode = subscriptionMode;
+ this.chatColor = chatColor;
}
+ public String getAvatar() {
+ return avatar;
+ }
+
+ public String getChatColor() {
+ return chatColor;
+ }
+
+ public I18nCountryDTO getCountry() {
+ return country;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
public Long getId() {
return id;
}
- public void setId(final Long id) {
- this.id = id;
+ public I18nLanguageDTO getLanguage() {
+ return language;
}
public String getName() {
return name;
}
- public void setName(final String name) {
- this.name = name;
+ public String getPassword() {
+ return password;
}
public String getShortName() {
return shortName;
}
- public void setShortName(final String shortName) {
- this.shortName = shortName;
+ public SubscriptionMode getSubscriptionMode() {
+ return subscriptionMode;
}
- public I18nLanguageDTO getLanguage() {
- return language;
+ public TimeZoneDTO getTimezone() {
+ return timezone;
}
- public void setLanguage(final I18nLanguageDTO language) {
- this.language = language;
+ public boolean isPublishRoster() {
+ return publishRoster;
}
- public I18nCountryDTO getCountry() {
- return country;
+ public void setAvatar(final String avatar) {
+ this.avatar = avatar;
}
+ public void setChatColor(final String chatColor) {
+ this.chatColor = chatColor;
+ }
+
public void setCountry(final I18nCountryDTO country) {
this.country = country;
}
- public TimeZoneDTO getTimezone() {
- return timezone;
+ public void setEmail(final String email) {
+ this.email = email;
}
- public void setTimezone(final TimeZoneDTO timezone) {
- this.timezone = timezone;
+ public void setId(final Long id) {
+ this.id = id;
}
- public String getPassword() {
- return password;
+ public void setLanguage(final I18nLanguageDTO language) {
+ this.language = language;
}
+ public void setName(final String name) {
+ this.name = name;
+ }
+
public void setPassword(final String password) {
this.password = password;
}
- public String getEmail() {
- return email;
+ public void setPublishRoster(final boolean publishRoster) {
+ this.publishRoster = publishRoster;
}
- public void setEmail(final String email) {
- this.email = email;
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
}
+ public void setSubscriptionMode(final SubscriptionMode subscriptionMode) {
+ this.subscriptionMode = subscriptionMode;
+ }
+
+ public void setTimezone(final TimeZoneDTO timezone) {
+ this.timezone = timezone;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/rpc/ContentServiceAsync.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -56,7 +56,7 @@
void getSummaryTags(String userHash, String groupShortName, AsyncCallback<List<TagResultDTO>> asyncCallback);
- CommentDTO markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId,
+ void markCommentAsAbuse(String userHash, String groupShortName, String documentId, Long commentId,
AsyncCallback<CommentDTO> asyncCallback);
void rateContent(String userHash, String groupShortName, String documentId, Double value,
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -22,20 +22,52 @@
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
-public class Kune {
+import com.calclab.emite.client.modular.Container;
+import com.calclab.emite.client.modular.DelegatedContainer;
+import com.calclab.emite.client.modular.Module;
+import com.calclab.emite.client.modular.ModuleBuilder;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
+import com.calclab.emiteuimodule.client.EmiteUIModule;
+
+public class Kune extends DelegatedContainer {
+
+ public static final ColorTheme theme = getInstance().getColorTheme();
+
+ public static final I18nUITranslationService I18N = getInstance().getI18N();
+
private static Kune instance;
- public static final I18nUITranslationService I18N = I18nUITranslationService.getInstance();
- public ColorTheme theme;
- private Kune() {
- theme = new ColorTheme();
+ public static Kune create() {
+ return create(new KuneModule(), new EmiteUIModule());
}
+ public static Kune create(final Module... modules) {
+ final ModuleBuilder container = new ModuleBuilder();
+ container.add(modules);
+ return container.getInstance(Kune.class);
+ }
+
public static Kune getInstance() {
if (instance == null) {
- instance = new Kune();
+ instance = create();
}
return instance;
}
+ protected Kune(final Container container) {
+ super(container);
+ }
+
+ public ColorTheme getColorTheme() {
+ return this.getInstance(ColorTheme.class);
+ }
+
+ public EmiteUIDialog getEmiteUIDialog() {
+ return this.getInstance(EmiteUIDialog.class);
+ }
+
+ public I18nUITranslationService getI18N() {
+ return this.getInstance(I18nUITranslationService.class);
+ }
+
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -0,0 +1,43 @@
+package org.ourproject.kune.platf.client.services;
+
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+
+import com.calclab.emite.client.modular.Container;
+import com.calclab.emite.client.modular.Module;
+import com.calclab.emite.client.modular.ModuleBuilder;
+import com.calclab.emite.client.modular.Provider;
+import com.calclab.emite.client.modular.Scopes;
+
+public class KuneModule implements Module {
+
+ public static Kune getKune(final Container container) {
+ return container.getInstance(Kune.class);
+ }
+
+ public Class<? extends Module> getType() {
+ return KuneModule.class;
+ }
+
+ public void onLoad(final ModuleBuilder builder) {
+ builder.add(new KuneModule());
+ builder.registerProvider(Kune.class, new Provider<Kune>() {
+ public Kune get() {
+ return new Kune(builder);
+ }
+
+ }, Scopes.SINGLETON);
+
+ builder.registerProvider(I18nUITranslationService.class, new Provider<I18nUITranslationService>() {
+ public I18nUITranslationService get() {
+ return new I18nUITranslationService();
+ }
+ }, Scopes.SINGLETON);
+
+ builder.registerProvider(ColorTheme.class, new Provider<ColorTheme>() {
+ public ColorTheme get() {
+ return new ColorTheme();
+ }
+ }, Scopes.SINGLETON);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -42,6 +42,8 @@
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;
+import com.calclab.emite.client.im.roster.RosterManager;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.inject.name.Named;
import com.wideplay.warp.persist.dao.Finder;
@@ -49,6 +51,17 @@
@Indexed
@Table(name = "kusers")
public class User implements HasId {
+
+ // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
+ // Never expect or return null
+ public static final User UNKNOWN_USER = new User();
+
+ private static final String DEF_CHAT_COLOR = "green";
+
+ public static boolean isKnownUser(final User user) {
+ return user != UNKNOWN_USER;
+ }
+
@Id
@DocumentId
@GeneratedValue
@@ -89,10 +102,17 @@
@NotNull
private TimeZone timezone;
- // see: http://docs.codehaus.org/display/PICO/Good+Citizen:
- // Never expect or return null
- public static final User UNKNOWN_USER = new User();
+ private String avatar;
+ @NotNull
+ private boolean publishRoster;
+
+ @NotNull
+ private SubscriptionMode subscriptionMode;
+
+ @NotNull
+ private String chatColor;
+
public User() {
this(null, null, null, null, null, null, null);
}
@@ -107,6 +127,9 @@
this.language = language;
this.country = country;
this.timezone = timezone;
+ this.publishRoster = true;
+ this.subscriptionMode = SubscriptionMode.manual;
+ this.chatColor = DEF_CHAT_COLOR;
}
@Finder(query = "from User")
@@ -114,6 +137,10 @@
return null;
}
+ public String getAvatar() {
+ return avatar;
+ }
+
@Finder(query = "from User where email = :email")
public User getByEmail(@Named("email")
final String email) {
@@ -126,82 +153,106 @@
return null;
}
- public Long getId() {
- return id;
+ public String getChatColor() {
+ return chatColor;
}
- public void setId(final Long id) {
- this.id = id;
+ public I18nCountry getCountry() {
+ return country;
}
public String getEmail() {
return email;
}
- public void setEmail(final String email) {
- this.email = email;
+ public Long getId() {
+ return id;
}
+ public I18nLanguage getLanguage() {
+ return language;
+ }
+
+ public String getName() {
+ return name;
+ }
+
public String getPassword() {
return password;
}
- public void setPassword(final String password) {
- this.password = password;
- // http://www.dynamic.net.au/christos/crypt/
- // Use UnixCrypt (jetty)
+ public String getShortName() {
+ return shortName;
}
+ public RosterManager.SubscriptionMode getSubscriptionMode() {
+ return subscriptionMode;
+ }
+
+ public TimeZone getTimezone() {
+ return timezone;
+ }
+
public Group getUserGroup() {
return userGroup;
}
- public void setUserGroup(final Group userGroup) {
- this.userGroup = userGroup;
+ public boolean isPublishRoster() {
+ return publishRoster;
}
- public String getName() {
- return name;
+ public void setAvatar(final String avatar) {
+ this.avatar = avatar;
}
- public void setName(final String name) {
- this.name = name;
+ public void setChatColor(final String chatColor) {
+ this.chatColor = chatColor;
}
- public String getShortName() {
- return shortName;
+ public void setCountry(final I18nCountry country) {
+ this.country = country;
}
- public void setShortName(final String shortName) {
- this.shortName = shortName;
+ public void setEmail(final String email) {
+ this.email = email;
}
- public static boolean isKnownUser(final User user) {
- return user != UNKNOWN_USER;
+ public void setId(final Long id) {
+ this.id = id;
}
- public I18nLanguage getLanguage() {
- return language;
- }
-
public void setLanguage(final I18nLanguage language) {
this.language = language;
}
- public I18nCountry getCountry() {
- return country;
+ public void setName(final String name) {
+ this.name = name;
}
- public void setCountry(final I18nCountry country) {
- this.country = country;
+ public void setPassword(final String password) {
+ this.password = password;
+ // http://www.dynamic.net.au/christos/crypt/
+ // Use UnixCrypt (jetty)
}
- public TimeZone getTimezone() {
- return timezone;
+ public void setPublishRoster(final boolean publishRoster) {
+ this.publishRoster = publishRoster;
}
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
+
+ public void setSubscriptionMode(final RosterManager.SubscriptionMode subscriptionMode) {
+ this.subscriptionMode = subscriptionMode;
+ }
+
public void setTimezone(final TimeZone timezone) {
this.timezone = timezone;
}
+ public void setUserGroup(final Group userGroup) {
+ this.userGroup = userGroup;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -24,9 +24,9 @@
import org.ourproject.kune.platf.client.dispatch.Action;
import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.services.Kune;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.sitebar.Site;
import com.google.gwt.user.client.Cookies;
@@ -50,7 +50,7 @@
Site.sitebar.showLoggedUser(userInfoDTO);
I18nLanguageDTO language = userInfoDTO.getLanguage();
stateManager.reload();
- I18nUITranslationService.getInstance().setCurrentLanguage(language.getCode());
+ Kune.I18N.setCurrentLanguage(language.getCode());
session.setCurrentLanguage(language);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -36,14 +36,27 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
public class I18nUITranslationService extends I18nTranslationService {
- // Also in I18nTranslation
- private static final String UNTRANSLATED_VALUE = null;
-
- private static I18nUITranslationService instance;
private HashMap<String, String> lexicon;
private String currentLanguage;
+
private I18nChangeListenerCollection i18nChangeListeners;
+ /*
+ * If a UI element need to be fired when (for instance) the language changes
+ * use this. Useful if you widget have to take in account text language
+ * direction, for instance.
+ */
+ public void addI18nChangeListener(final I18nChangeListener listener) {
+ if (i18nChangeListeners == null) {
+ i18nChangeListeners = new I18nChangeListenerCollection();
+ }
+ i18nChangeListeners.add(listener);
+ }
+
+ public String getCurrentLanguage() {
+ return currentLanguage;
+ }
+
public void getInitialLanguage(final AsyncCallback<I18nLanguageDTO> callback) {
Location loc = WindowUtils.getLocation();
String locale = loc.getParameter("locale");
@@ -57,16 +70,14 @@
server.getLexicon(currentLanguage, callback);
}
- public static I18nUITranslationService getInstance() {
- if (instance == null) {
- instance = new I18nUITranslationService();
- }
- return instance;
+ public HashMap<String, String> getLexicon() {
+ return lexicon;
}
- public void setLexicon(final HashMap<String, String> lexicon) {
- this.lexicon = lexicon;
- fireI18nLanguageChange();
+ public void removeI18nChangeListener(final I18nChangeListener listener) {
+ if (i18nChangeListeners != null) {
+ i18nChangeListeners.remove(listener);
+ }
}
public void setCurrentLanguage(final String newLanguage) {
@@ -78,10 +89,16 @@
}
}
- public HashMap<String, String> getLexicon() {
- return lexicon;
+ public void setLexicon(final HashMap<String, String> lexicon) {
+ this.lexicon = lexicon;
+ fireI18nLanguageChange();
}
+ public void setTranslationAfterSave(final String text, final String translation) {
+ lexicon.put(text, translation);
+ fireI18nLanguageChange();
+ }
+
/**
* In production, this method uses a hashmap. In development, if the text is
* not in the hashmap, it makes a server petition (that stores the text
@@ -112,39 +129,6 @@
return decodeHtml(translation);
}
- public void setTranslationAfterSave(final String text, final String translation) {
- lexicon.put(text, translation);
- fireI18nLanguageChange();
- }
-
- /*
- * If a UI element need to be fired when (for instance) the language changes
- * use this. Useful if you widget have to take in account text language
- * direction, for instance.
- */
- public void addI18nChangeListener(final I18nChangeListener listener) {
- if (i18nChangeListeners == null) {
- i18nChangeListeners = new I18nChangeListenerCollection();
- }
- i18nChangeListeners.add(listener);
- }
-
- public void removeI18nChangeListener(final I18nChangeListener listener) {
- if (i18nChangeListeners != null) {
- i18nChangeListeners.remove(listener);
- }
- }
-
- public String getCurrentLanguage() {
- return currentLanguage;
- }
-
- private void fireI18nLanguageChange() {
- if (i18nChangeListeners != null) {
- i18nChangeListeners.fireI18nLanguageChange();
- }
- }
-
/**
*
* See in:
@@ -190,4 +174,10 @@
//head.appendChild(script);
}-*/;
+ private void fireI18nLanguageChange() {
+ if (i18nChangeListeners != null) {
+ i18nChangeListeners.fireI18nLanguageChange();
+ }
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -37,6 +37,7 @@
import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType;
import org.ourproject.kune.workspace.client.sitebar.Site;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -49,134 +50,134 @@
private final Session session;
public LoginPresenter(final Session session, final LoginListener listener) {
- this.session = session;
- this.listener = listener;
+ this.session = session;
+ this.listener = listener;
}
public void doLogin() {
- if (view.isSignInFormValid()) {
- view.maskProcessing();
+ if (view.isSignInFormValid()) {
+ view.maskProcessing();
- final String nickOrEmail = view.getNickOrEmail();
- final String passwd = view.getLoginPassword();
+ final String nickOrEmail = view.getNickOrEmail();
+ final String passwd = view.getLoginPassword();
- final UserDTO user = new UserDTO();
- user.setShortName(nickOrEmail);
- user.setPassword(passwd);
+ final UserDTO user = new UserDTO();
+ user.setShortName(nickOrEmail);
+ user.setPassword(passwd);
- final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
- public void onFailure(final Throwable caught) {
- view.unMask();
- Site.hideProgress();
- try {
- throw caught;
- } catch (final UserAuthException e) {
- view.setSignInMessage(Kune.I18N.t("Incorrect nickname/email or password"), SiteErrorType.error);
- } catch (final Throwable e) {
- view.setSignInMessage("Error in login", SiteErrorType.error);
- GWT.log("Other kind of exception in LoginFormPresenter/doLogin", null);
- throw new RuntimeException();
- }
- }
+ final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
+ public void onFailure(final Throwable caught) {
+ view.unMask();
+ Site.hideProgress();
+ try {
+ throw caught;
+ } catch (final UserAuthException e) {
+ view.setSignInMessage(Kune.I18N.t("Incorrect nickname/email or password"), SiteErrorType.error);
+ } catch (final Throwable e) {
+ view.setSignInMessage("Error in login", SiteErrorType.error);
+ GWT.log("Other kind of exception in LoginFormPresenter/doLogin", null);
+ throw new RuntimeException();
+ }
+ }
- public void onSuccess(final UserInfoDTO response) {
- listener.userLoggedIn(response);
- view.unMask();
- }
- };
+ public void onSuccess(final UserInfoDTO response) {
+ listener.userLoggedIn(response);
+ view.unMask();
+ }
+ };
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_LOGIN,
- new ParamCallback<UserDTO, UserInfoDTO>(user, callback));
- }
+ DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_LOGIN,
+ new ParamCallback<UserDTO, UserInfoDTO>(user, callback));
+ }
}
public void doRegister() {
- if (view.isRegisterFormValid()) {
- view.maskProcessing();
+ if (view.isRegisterFormValid()) {
+ view.maskProcessing();
- final I18nLanguageDTO language = new I18nLanguageDTO();
- language.setCode(view.getLanguage());
+ final I18nLanguageDTO language = new I18nLanguageDTO();
+ language.setCode(view.getLanguage());
- final I18nCountryDTO country = new I18nCountryDTO();
- country.setCode(view.getCountry());
+ final I18nCountryDTO country = new I18nCountryDTO();
+ country.setCode(view.getCountry());
- final TimeZoneDTO timezone = new TimeZoneDTO();
- timezone.setId(view.getTimezone());
+ final TimeZoneDTO timezone = new TimeZoneDTO();
+ timezone.setId(view.getTimezone());
- final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(), view
- .getEmail(), language, country, timezone);
- final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
- public void onFailure(final Throwable caught) {
- view.unMask();
- try {
- throw caught;
- } catch (final EmailAddressInUseException e) {
- view.setRegisterMessage(Kune.I18N.t("This email in in use by other person, try with another."),
- SiteErrorType.error);
- } catch (final GroupNameInUseException e) {
- view.setRegisterMessage(Kune.I18N.t("This name in already in use, try with a different name."),
- SiteErrorType.error);
- } catch (final Throwable e) {
- view.setRegisterMessage(Kune.I18N.t("Error during registration."), SiteErrorType.error);
- GWT.log("Other kind of exception in user registration", null);
- throw new RuntimeException();
- }
- }
+ final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(), view
+ .getEmail(), language, country, timezone, null, true, SubscriptionMode.manual, "blue");
+ final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
+ public void onFailure(final Throwable caught) {
+ view.unMask();
+ try {
+ throw caught;
+ } catch (final EmailAddressInUseException e) {
+ view.setRegisterMessage(Kune.I18N.t("This email in in use by other person, try with another."),
+ SiteErrorType.error);
+ } catch (final GroupNameInUseException e) {
+ view.setRegisterMessage(Kune.I18N.t("This name in already in use, try with a different name."),
+ SiteErrorType.error);
+ } catch (final Throwable e) {
+ view.setRegisterMessage(Kune.I18N.t("Error during registration."), SiteErrorType.error);
+ GWT.log("Other kind of exception in user registration", null);
+ throw new RuntimeException();
+ }
+ }
- public void onSuccess(final UserInfoDTO userInfoDTO) {
- listener.userLoggedIn(userInfoDTO);
- view.unMask();
- view.showWelcolmeDialog();
- DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, userInfoDTO.getShortName());
- }
- };
- DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_REGISTER,
- new ParamCallback<UserDTO, UserInfoDTO>(user, callback));
- }
+ public void onSuccess(final UserInfoDTO userInfoDTO) {
+ listener.userLoggedIn(userInfoDTO);
+ view.unMask();
+ view.showWelcolmeDialog();
+ DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, userInfoDTO.getShortName());
+ }
+ };
+ DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_REGISTER,
+ new ParamCallback<UserDTO, UserInfoDTO>(user, callback));
+ }
}
public Object[][] getCountries() {
- return session.getCountriesArray();
+ return session.getCountriesArray();
}
public I18nLanguageDTO getCurrentLanguage() {
- return session.getCurrentLanguage();
+ return session.getCurrentLanguage();
}
public Object[][] getLanguages() {
- return session.getLanguagesArray();
+ return session.getLanguagesArray();
}
public Object[][] getTimezones() {
- return session.getTimezones();
+ return session.getTimezones();
}
public View getView() {
- return view;
+ return view;
}
public void init(final LoginView loginview) {
- this.view = loginview;
+ this.view = loginview;
}
public void onCancel() {
- resetMessages();
- reset();
- listener.onLoginCancelled();
+ resetMessages();
+ reset();
+ listener.onLoginCancelled();
}
public void onClose() {
- reset();
- view.hideMessages();
- listener.onLoginClose();
+ reset();
+ view.hideMessages();
+ listener.onLoginClose();
}
private void reset() {
- view.reset();
+ view.reset();
}
private void resetMessages() {
- view.hideMessages();
+ view.hideMessages();
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -15,34 +15,34 @@
@Before
public void init() throws Exception {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(this);
- defaultContent = getDefaultContent();
- groupName = defaultContent.getGroup().getShortName();
- doLogin();
+ defaultContent = getDefaultContent();
+ groupName = defaultContent.getGroup().getShortName();
+ doLogin();
}
@Test
public void testSaveAndRetrieve() throws Exception {
- final String text = "Lorem ipsum dolor sit amet";
- final int version = defaultContent.getVersion();
- final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
- assertEquals(version + 2, currentVersion);
- final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
- assertEquals(text, again.getContent());
- assertEquals(0, again.getRateByUsers());
- assertEquals(0, again.getRate());
+ final String text = "Lorem ipsum dolor sit amet";
+ final int version = defaultContent.getVersion();
+ final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+ assertEquals(version + 2, currentVersion);
+ final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+ assertEquals(text, again.getContent());
+ assertEquals(0, (int) again.getRateByUsers());
+ assertEquals(0, (double) again.getRate());
}
@Test
public void testSaveAndRetrieveBig() throws Exception {
- final String text = TestDomainHelper.createBigText();
- ;
- final int version = defaultContent.getVersion();
- final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
- assertEquals(version + 2, currentVersion);
- final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
- assertEquals(text, again.getContent());
+ final String text = TestDomainHelper.createBigText();
+ ;
+ final int version = defaultContent.getVersion();
+ final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+ assertEquals(version + 2, currentVersion);
+ final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+ assertEquals(text, again.getContent());
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -22,166 +22,166 @@
@Test
public void addRemoveAuthor() throws Exception {
- final List<UserSimpleDTO> authors = defaultContent.getAuthors();
- assertEquals(1, authors.size());
- final UserSimpleDTO author = authors.get(0);
- final String authorShortName = author.getShortName();
- contentService.removeAuthor(getHash(), groupShortName, defDocument, authorShortName);
- final List<UserSimpleDTO> authors2 = getDefaultContent().getAuthors();
- assertEquals(0, authors2.size());
- contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
- final List<UserSimpleDTO> authors3 = getDefaultContent().getAuthors();
- assertEquals(1, authors3.size());
- contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
- final List<UserSimpleDTO> authors4 = getDefaultContent().getAuthors();
- assertEquals(1, authors4.size());
+ final List<UserSimpleDTO> authors = defaultContent.getAuthors();
+ assertEquals(1, authors.size());
+ final UserSimpleDTO author = authors.get(0);
+ final String authorShortName = author.getShortName();
+ contentService.removeAuthor(getHash(), groupShortName, defDocument, authorShortName);
+ final List<UserSimpleDTO> authors2 = getDefaultContent().getAuthors();
+ assertEquals(0, authors2.size());
+ contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+ final List<UserSimpleDTO> authors3 = getDefaultContent().getAuthors();
+ assertEquals(1, authors3.size());
+ contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+ final List<UserSimpleDTO> authors4 = getDefaultContent().getAuthors();
+ assertEquals(1, authors4.size());
}
@Test
public void contentRateAndRetrieve() throws Exception {
- contentService.rateContent(getHash(), groupShortName, defDocument, 4.5);
- final StateDTO again = contentService.getContent(getHash(), groupShortName, defaultContent.getStateToken());
- assertEquals(true, again.isRateable());
- assertEquals(4.5, again.getCurrentUserRate());
- assertEquals(4.5, again.getRate());
- assertEquals(1, again.getRateByUsers());
+ contentService.rateContent(getHash(), groupShortName, defDocument, 4.5);
+ final StateDTO again = contentService.getContent(getHash(), groupShortName, defaultContent.getStateToken());
+ assertEquals(true, again.isRateable());
+ assertEquals(4.5, (double) again.getCurrentUserRate());
+ assertEquals(4.5, (double) again.getRate());
+ assertEquals(1, (double) again.getRateByUsers());
}
@Test
public void contentSetLanguage() throws Exception {
- contentService.setLanguage(getHash(), groupShortName, defDocument, "es");
- final StateDTO contentRetrieved = contentService.getContent(getHash(), groupShortName, defaultContent
- .getStateToken());
- assertEquals("es", contentRetrieved.getLanguage().getCode());
+ contentService.setLanguage(getHash(), groupShortName, defDocument, "es");
+ final StateDTO contentRetrieved = contentService.getContent(getHash(), groupShortName, defaultContent
+ .getStateToken());
+ assertEquals("es", contentRetrieved.getLanguage().getCode());
}
@Test
public void folderRename() throws Exception {
- doLogin();
- defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ doLogin();
+ defaultContent = getDefaultContent();
+ final ContainerDTO folder = defaultContent.getFolder();
- final String oldTitle = "some title";
- String newTitle = "folder new name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+ final String oldTitle = "some title";
+ String newTitle = "folder new name";
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
- final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
+ final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
- assertEquals(oldTitle, newFolder.getName());
+ assertEquals(oldTitle, newFolder.getName());
- final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
- newFolder.getId().toString(), null);
- String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+ final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+ newFolder.getId().toString(), null);
+ String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
- assertEquals(newTitle, result);
+ assertEquals(newTitle, result);
- final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
- newFolder.getId().toString(), null);
- StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+ final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+ newFolder.getId().toString(), null);
+ StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getFolder().getName());
- newTitle = "folder last name";
+ newTitle = "folder last name";
- result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+ result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
- folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+ folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getFolder().getName());
}
@Test(expected = AccessViolationException.class)
public void folderRenameOtherGroupFails() throws Exception {
- doLogin();
- defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
- final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
- .getId().toString(), null);
+ doLogin();
+ defaultContent = getDefaultContent();
+ final ContainerDTO folder = defaultContent.getFolder();
+ final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
+ .getId().toString(), null);
- final String newTitle = "folder new name";
- contentService.rename(getHash(), super.getSiteAdminShortName(), folderToken.getEncoded(), newTitle);
+ final String newTitle = "folder new name";
+ contentService.rename(getHash(), super.getSiteAdminShortName(), folderToken.getEncoded(), newTitle);
}
@Test(expected = RuntimeException.class)
public void folderRootRenameMustFail() throws Exception {
- doLogin();
- defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ doLogin();
+ defaultContent = getDefaultContent();
+ final ContainerDTO folder = defaultContent.getFolder();
- final String newTitle = "folder new name";
- final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
- .getId().toString(), null);
- final String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+ final String newTitle = "folder new name";
+ final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
+ .getId().toString(), null);
+ final String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
- assertEquals(newTitle, result);
+ assertEquals(newTitle, result);
- final ContainerDTO folderAgain = getDefaultContent().getFolder();
+ final ContainerDTO folderAgain = getDefaultContent().getFolder();
- assertEquals(newTitle, folderAgain.getName());
+ assertEquals(newTitle, folderAgain.getName());
}
@Before
public void init() throws Exception {
- new IntegrationTestHelper(this);
- doLogin();
- defaultContent = getDefaultContent();
- groupShortName = defaultContent.getStateToken().getGroup();
- defDocument = defaultContent.getStateToken().getDocument();
+ new IntegrationTestHelper(this);
+ doLogin();
+ defaultContent = getDefaultContent();
+ groupShortName = defaultContent.getStateToken().getGroup();
+ defDocument = defaultContent.getStateToken().getDocument();
}
@Test
public void setTagsAndResults() throws Exception {
- contentService.setTags(getHash(), groupShortName, defDocument, "bfoo cfoa afoo2");
- final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), groupShortName);
- assertEquals(3, summaryTags.size());
+ contentService.setTags(getHash(), groupShortName, defDocument, "bfoo cfoa afoo2");
+ final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), groupShortName);
+ assertEquals(3, summaryTags.size());
- TagResultDTO tagResultDTO = summaryTags.get(0);
- assertEquals("afoo2", tagResultDTO.getName());
- assertEquals(1, tagResultDTO.getCount());
+ TagResultDTO tagResultDTO = summaryTags.get(0);
+ assertEquals("afoo2", tagResultDTO.getName());
+ assertEquals(1, (long) tagResultDTO.getCount());
- tagResultDTO = summaryTags.get(1);
- assertEquals("bfoo", tagResultDTO.getName());
- assertEquals(1, tagResultDTO.getCount());
+ tagResultDTO = summaryTags.get(1);
+ assertEquals("bfoo", tagResultDTO.getName());
+ assertEquals(1, (long) tagResultDTO.getCount());
- tagResultDTO = summaryTags.get(2);
- assertEquals("cfoa", tagResultDTO.getName());
- assertEquals(1, tagResultDTO.getCount());
+ tagResultDTO = summaryTags.get(2);
+ assertEquals("cfoa", tagResultDTO.getName());
+ assertEquals(1, (long) tagResultDTO.getCount());
}
@Test
public void setTagsAndRetrieve() throws Exception {
- contentService.setTags(getHash(), groupShortName, defDocument, "foo foa foo");
- final String tagsRetrieved = getDefaultContent().getTags();
- assertEquals("foo foa", tagsRetrieved);
+ contentService.setTags(getHash(), groupShortName, defDocument, "foo foa foo");
+ final String tagsRetrieved = getDefaultContent().getTags();
+ assertEquals("foo foa", tagsRetrieved);
}
@Test
public void tokenRename() throws Exception {
- doLogin();
- defaultContent = getDefaultContent();
- final ContainerDTO folder = defaultContent.getFolder();
+ doLogin();
+ defaultContent = getDefaultContent();
+ final ContainerDTO folder = defaultContent.getFolder();
- final String oldTitle = "some title";
- String newTitle = "folder new name";
- final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+ final String oldTitle = "some title";
+ String newTitle = "folder new name";
+ final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
- final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
+ final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
- assertEquals(oldTitle, newFolder.getName());
+ assertEquals(oldTitle, newFolder.getName());
- final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
- newFolder.getId().toString(), null);
+ final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+ newFolder.getId().toString(), null);
- newTitle = "folder last name";
+ newTitle = "folder last name";
- final String result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+ final String result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
- assertEquals(newTitle, result);
+ assertEquals(newTitle, result);
- final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+ final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
- assertEquals(newTitle, folderAgain.getFolder().getName());
+ assertEquals(newTitle, folderAgain.getFolder().getName());
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/site/UserServiceTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -28,6 +28,7 @@
import org.ourproject.kune.platf.server.users.UserInfoService;
import org.ourproject.kune.workspace.client.sitebar.rpc.UserService;
+import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.inject.Inject;
public class UserServiceTest extends IntegrationTest {
@@ -49,77 +50,78 @@
@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);
- userService.createUser(user);
+ 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);
}
@Test(expected = GroupNameInUseException.class)
public void createUserExistingNameFails() throws Exception {
- assertNull(session.getUser().getId());
- final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456", "example at example.com", lang,
- country, timezone);
- userService.createUser(user);
+ assertNull(session.getUser().getId());
+ final UserDTO user = new UserDTO("test", properties.getAdminShortName(), "123456", "example at example.com", lang,
+ country, timezone, null, true, SubscriptionMode.manual, "blue");
+ userService.createUser(user);
}
@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");
+ 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");
+ assertNull(session.getUser().getId());
+ userService.reloadUserInfo("AndOldUserHash");
}
@Test
public void testSiteEmailLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminEmail(), properties.getAdminPassword());
- assertNotNull(session.getUser().getId());
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminEmail(), properties.getAdminPassword());
+ assertNotNull(session.getUser().getId());
}
@Test
public void testSiteNameLogin() throws Exception {
- assertNull(session.getUser().getId());
- userService.login(properties.getAdminShortName(), properties.getAdminPassword());
- assertNotNull(session.getUser().getId());
+ assertNull(session.getUser().getId());
+ userService.login(properties.getAdminShortName(), properties.getAdminPassword());
+ assertNotNull(session.getUser().getId());
}
@Test
public void testUserInfo() throws Exception {
- doLogin();
- final UserInfo userInfo = userInfoService.buildInfo(session.getUser(), session.getHash());
+ 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());
- assertEquals(userInfo.getChatPassword(), userInfoDTO.getChatPassword());
- final List<Link> adminsGroup = userInfo.getGroupsIsAdmin();
- final List<LinkDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
- assertEqualListsLink(adminsGroupDTO, adminsGroup);
+ final UserInfoDTO userInfoDTO = mapper.map(userInfo, UserInfoDTO.class);
+ assertEquals(userInfo.getName(), userInfoDTO.getName());
+ assertEquals(userInfo.getChatName(), userInfoDTO.getChatName());
+ assertEquals(userInfo.getChatPassword(), userInfoDTO.getChatPassword());
+ final List<Link> adminsGroup = userInfo.getGroupsIsAdmin();
+ final List<LinkDTO> adminsGroupDTO = userInfoDTO.getGroupsIsAdmin();
+ assertEqualListsLink(adminsGroupDTO, adminsGroup);
}
private void assertEqualListsLink(final List<LinkDTO> listDTO, final List<Link> list) {
- assertEquals(listDTO.size(), list.size());
- for (int i = 0; i < listDTO.size(); i++) {
- final Object object = listDTO.get(i);
- assertEquals(LinkDTO.class, object.getClass());
- final LinkDTO d = (LinkDTO) object;
- final Link l = list.get(i);
- assertNotNull(d);
- assertNotNull(l);
- final LinkDTO map = mapper.map(l, LinkDTO.class);
- assertEquals(map.getShortName(), d.getShortName());
- assertEquals(map.getLink(), d.getLink());
- }
+ assertEquals(listDTO.size(), list.size());
+ for (int i = 0; i < listDTO.size(); i++) {
+ final Object object = listDTO.get(i);
+ assertEquals(LinkDTO.class, object.getClass());
+ final LinkDTO d = (LinkDTO) object;
+ final Link l = list.get(i);
+ assertNotNull(d);
+ assertNotNull(l);
+ final LinkDTO map = mapper.map(l, LinkDTO.class);
+ assertEquals(map.getShortName(), d.getShortName());
+ assertEquals(map.getLink(), d.getLink());
+ }
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -34,75 +34,75 @@
@After
public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Before
public void insertData() throws Exception {
- english = new I18nLanguage(new Long(1819), "English", "English", "en");
- languageManager.persist(english);
- gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
- countryManager.persist(gb);
+ english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ languageManager.persist(english);
+ gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+ countryManager.persist(gb);
}
@Test
public void testContentNotRated() {
- final EntityManager manager = openTransaction();
+ final EntityManager manager = openTransaction();
- final Content cd = new Content();
- cd.setLanguage(english);
- cd.setPublishedOn(new Date());
- manager.persist(cd);
+ final Content cd = new Content();
+ cd.setLanguage(english);
+ cd.setPublishedOn(new Date());
+ manager.persist(cd);
- closeTransaction();
- final Double rate = rateFinder.calculateRate(cd);
- final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
- assertEquals(0, rateByUsers);
+ closeTransaction();
+ final Double rate = rateFinder.calculateRate(cd);
+ final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
+ assertEquals(0, (long) rateByUsers);
- // FIXME: Why null? in other tests this return zero
- assertEquals(null, rate);
+ // FIXME: Why null? in other tests this return zero
+ assertEquals(null, rate);
}
@Test
public void testContentRateAverage() {
- final EntityManager manager = openTransaction();
+ final EntityManager manager = openTransaction();
- final User user1 = TestDomainHelper.createUser(1);
- final User user2 = TestDomainHelper.createUser(2);
+ final User user1 = TestDomainHelper.createUser(1);
+ final User user2 = TestDomainHelper.createUser(2);
- user1.setLanguage(english);
- user2.setLanguage(english);
+ user1.setLanguage(english);
+ user2.setLanguage(english);
- user1.setCountry(gb);
- user2.setCountry(gb);
+ user1.setCountry(gb);
+ user2.setCountry(gb);
- manager.persist(user1);
- manager.persist(user2);
+ manager.persist(user1);
+ manager.persist(user2);
- final Content cd = new Content();
- cd.setLanguage(english);
- cd.setPublishedOn(new Date());
- manager.persist(cd);
+ final Content cd = new Content();
+ cd.setLanguage(english);
+ cd.setPublishedOn(new Date());
+ manager.persist(cd);
- manager.persist(new Rate(user1, cd, 1.3));
- manager.persist(new Rate(user2, cd, 3.3));
- // same user and content other rate
- final Rate rateFinded = rateFinder.find(user2, cd);
- rateFinded.setValue(4.3);
- manager.persist(rateFinded);
+ manager.persist(new Rate(user1, cd, 1.3));
+ manager.persist(new Rate(user2, cd, 3.3));
+ // same user and content other rate
+ final Rate rateFinded = rateFinder.find(user2, cd);
+ rateFinded.setValue(4.3);
+ manager.persist(rateFinded);
- closeTransaction();
- final Double rate = rateFinder.calculateRate(cd);
- final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
- final Double average = (1.3 + 4.3) / 2;
- assertEquals(average, rate);
- assertEquals(2, rateByUsers);
- final Rate newRate1 = rateFinder.find(user1, cd);
- final Rate newRate2 = rateFinder.find(user2, cd);
- assertEquals(1.3, newRate1.getValue());
- assertEquals(4.3, newRate2.getValue());
+ closeTransaction();
+ final Double rate = rateFinder.calculateRate(cd);
+ final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
+ final Double average = (1.3 + 4.3) / 2;
+ assertEquals(average, rate);
+ assertEquals(new Long(2), rateByUsers);
+ final Rate newRate1 = rateFinder.find(user1, cd);
+ final Rate newRate2 = rateFinder.find(user2, cd);
+ assertEquals(1.3, (double) newRate1.getValue());
+ assertEquals(4.3, (double) newRate2.getValue());
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/GroupManagerTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -48,169 +48,169 @@
@After
public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Test
public void createdGroupShoudHaveValidSocialNetwork() throws Exception {
- final Group group = new Group("short", "longName", defLicense, GroupType.PROJECT);
- groupManager.createGroup(group, user);
- final SocialNetwork socialNetwork = group.getSocialNetwork();
- final AccessLists lists = socialNetwork.getAccessLists();
- assertTrue(lists.getAdmins().includes(user.getUserGroup()));
- assertTrue(lists.getEditors().isEmpty());
- assertTrue(lists.getViewers().isEmpty());
- closeTransaction();
+ final Group group = new Group("short", "longName", defLicense, GroupType.PROJECT);
+ groupManager.createGroup(group, user);
+ final SocialNetwork socialNetwork = group.getSocialNetwork();
+ final AccessLists lists = socialNetwork.getAccessLists();
+ assertTrue(lists.getAdmins().includes(user.getUserGroup()));
+ assertTrue(lists.getEditors().isEmpty());
+ assertTrue(lists.getViewers().isEmpty());
+ closeTransaction();
}
@Test
public void createGroup() throws Exception {
- final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(group, user);
- final Group otherGroup = groupManager.findByShortName("ysei");
+ final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(group, user);
+ final Group otherGroup = groupManager.findByShortName("ysei");
- assertEquals(group.getLongName(), otherGroup.getLongName());
- assertEquals(group.getShortName(), otherGroup.getShortName());
- closeTransaction();
+ assertEquals(group.getLongName(), otherGroup.getLongName());
+ assertEquals(group.getShortName(), otherGroup.getShortName());
+ closeTransaction();
}
@Test
public void createGroupAndSearch() throws Exception, ParseException {
- final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(group, user);
- groupManager.reIndex();
- final SearchResult<Group> result = groupManager.search("ysei");
- assertEquals(1, result.getSize());
- assertEquals("ysei", result.getList().get(0).getShortName());
- rollbackTransaction();
+ final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(group, user);
+ groupManager.reIndex();
+ final SearchResult<Group> result = groupManager.search("ysei");
+ assertEquals(1, (long) result.getSize());
+ assertEquals("ysei", result.getList().get(0).getShortName());
+ rollbackTransaction();
}
@Test(expected = GroupNameInUseException.class)
public void createGroupWithExistingLongName() throws Exception {
- final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(group, user);
- final Group group2 = new Group("ysei2", "Yellow Submarine Environmental Initiative", defLicense,
- GroupType.PROJECT);
- group2.setDefaultLicense(defLicense);
- groupManager.createGroup(group2, user);
+ final Group group2 = new Group("ysei2", "Yellow Submarine Environmental Initiative", defLicense,
+ GroupType.PROJECT);
+ group2.setDefaultLicense(defLicense);
+ groupManager.createGroup(group2, user);
- rollbackTransaction();
+ rollbackTransaction();
}
@Test(expected = GroupNameInUseException.class)
public void createGroupWithExistingShortName() throws Exception {
- final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(group, user);
+ final Group group = new Group("ysei", "Yellow Submarine Environmental Initiative", defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(group, user);
- final Group group2 = new Group("ysei", "Yellow Submarine Environmental Initiative 2", defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(group2, user);
+ final Group group2 = new Group("ysei", "Yellow Submarine Environmental Initiative 2", defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(group2, user);
- rollbackTransaction();
+ rollbackTransaction();
}
@Test(expected = EmailAddressInUseException.class)
public void createUserExistingEmail() throws I18nNotFoundException, GroupNameInUseException,
- EmailAddressInUseException {
- final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user1);
- final User user2 = userManager.createUser("test2", "test 2 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user2);
+ EmailAddressInUseException {
+ final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user1);
+ final User user2 = userManager.createUser("test2", "test 2 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user2);
}
@Test(expected = GroupNameInUseException.class)
public void createUserExistingLongName() throws I18nNotFoundException, GroupNameInUseException,
- EmailAddressInUseException {
- final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user1);
- final User user2 = userManager.createUser("test2", "test 1 name", "test2 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user2);
+ EmailAddressInUseException {
+ final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user1);
+ final User user2 = userManager.createUser("test2", "test 1 name", "test2 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user2);
}
@Test(expected = GroupNameInUseException.class)
public void createUserExistingShortName() throws I18nNotFoundException, GroupNameInUseException,
- EmailAddressInUseException {
- final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user1);
- final User user2 = userManager.createUser("test", "test 2 name", "test2 at example.com", "some password", "en",
- "GB", "GMT");
- groupManager.createUserGroup(user2);
+ EmailAddressInUseException {
+ final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user1);
+ final User user2 = userManager.createUser("test", "test 2 name", "test2 at example.com", "some password", "en",
+ "GB", "GMT");
+ groupManager.createUserGroup(user2);
}
@Test(expected = EmailAddressInUseException.class)
public void createUserWithExistingEmail() throws Exception {
- final User user2 = userManager.createUser("username2", "the user name 2", "email at example.com", "userPassword",
- "en", "GB", TimeZone.getDefault().getID());
- groupManager.createUserGroup(user2);
- rollbackTransaction();
+ final User user2 = userManager.createUser("username2", "the user name 2", "email at example.com", "userPassword",
+ "en", "GB", TimeZone.getDefault().getID());
+ groupManager.createUserGroup(user2);
+ rollbackTransaction();
}
@Test(expected = GroupNameInUseException.class)
public void createUserWithExistingLongName() throws Exception {
- final User user2 = userManager.createUser("username2", "the user name", "email2 at example.com", "userPassword",
- "en", "GB", TimeZone.getDefault().getID());
- groupManager.createUserGroup(user2);
- rollbackTransaction();
+ final User user2 = userManager.createUser("username2", "the user name", "email2 at example.com", "userPassword",
+ "en", "GB", TimeZone.getDefault().getID());
+ groupManager.createUserGroup(user2);
+ rollbackTransaction();
}
@Test(expected = GroupNameInUseException.class)
public void createUserWithExistingShortName() throws Exception {
- final User user2 = userManager.createUser("username", "the user name 2", "email2 at example.com", "userPassword",
- "en", "GB", TimeZone.getDefault().getID());
- groupManager.createUserGroup(user2);
- rollbackTransaction();
+ final User user2 = userManager.createUser("username", "the user name 2", "email2 at example.com", "userPassword",
+ "en", "GB", TimeZone.getDefault().getID());
+ groupManager.createUserGroup(user2);
+ rollbackTransaction();
}
@Test
public void groupSearchPagination() throws Exception, ParseException {
- for (int i = 1; i < 10; i++) {
- createTestGroup(i);
- }
- groupManager.reIndex();
- final SearchResult<Group> result = groupManager.search("Yellow", 0, 5);
- assertEquals(9, result.getSize());
- assertEquals(5, result.getList().size());
- final SearchResult<Group> result2 = groupManager.search("Yellow", 5, 5);
- assertEquals(9, result2.getSize());
- assertEquals(4, result2.getList().size());
- rollbackTransaction();
+ for (int i = 1; i < 10; i++) {
+ createTestGroup(i);
+ }
+ groupManager.reIndex();
+ final SearchResult<Group> result = groupManager.search("Yellow", 0, 5);
+ assertEquals(9, (long) result.getSize());
+ assertEquals(5, result.getList().size());
+ final SearchResult<Group> result2 = groupManager.search("Yellow", 5, 5);
+ assertEquals(9, (long) result2.getSize());
+ assertEquals(4, result2.getList().size());
+ rollbackTransaction();
}
@Before
public void insertData() throws Exception {
- openTransaction();
- assertEquals(0, userFinder.getAll().size());
- assertEquals(0, groupFinder.getAll().size());
- assertEquals(0, licenseFinder.getAll().size());
- final I18nLanguage english = new I18nLanguage(new Long(1819), "English", "English", "en");
- languageManager.persist(english);
- final I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
- "western", ",");
- countryManager.persist(gb);
- user = userManager.createUser("username", "the user name", "email at example.com", "userPassword", "en", "GB",
- TimeZone.getDefault().getID());
- defLicense = new License("by-sa", "Creative Commons Attribution-ShareAlike", "",
- "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
- licenseManager.persist(defLicense);
- groupManager.createUserGroup(user);
+ openTransaction();
+ assertEquals(0, userFinder.getAll().size());
+ assertEquals(0, groupFinder.getAll().size());
+ assertEquals(0, licenseFinder.getAll().size());
+ final I18nLanguage english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ languageManager.persist(english);
+ final I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+ "western", ",");
+ countryManager.persist(gb);
+ user = userManager.createUser("username", "the user name", "email at example.com", "userPassword", "en", "GB",
+ TimeZone.getDefault().getID());
+ defLicense = new License("by-sa", "Creative Commons Attribution-ShareAlike", "",
+ "http://creativecommons.org/licenses/by-sa/3.0/", true, true, false, "", "");
+ licenseManager.persist(defLicense);
+ groupManager.createUserGroup(user);
}
private void createTestGroup(final int number) throws Exception {
- final Group g = new Group("ysei" + number, "Yellow Submarine Environmental Initiative " + number, defLicense,
- GroupType.PROJECT);
- groupManager.createGroup(g, user);
+ final Group g = new Group("ysei" + number, "Yellow Submarine Environmental Initiative " + number, defLicense,
+ GroupType.PROJECT);
+ groupManager.createGroup(g, user);
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/UserManagerTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -46,99 +46,99 @@
@After
public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Test
public void emailCorrect() {
- user = new User("test1", "test1 name", "test at example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "test at example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = InvalidStateException.class)
public void emailEmpty() {
- user = new User("test1", "test1 name", "", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = InvalidStateException.class)
public void emailIncorrect() {
- user = new User("test1", "test1 name", "falseEmail@", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "falseEmail@", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Before
public void insertData() throws Exception {
- openTransaction();
- assertEquals(0, userFinder.getAll().size());
- assertEquals(0, groupFinder.getAll().size());
- english = new I18nLanguage(new Long(1819), "English", "English", "en");
- languageManager.persist(english);
- gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
- countryManager.persist(gb);
- user = new User(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, english, gb, getTimeZone());
- persist(user);
+ openTransaction();
+ assertEquals(0, userFinder.getAll().size());
+ assertEquals(0, groupFinder.getAll().size());
+ english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ languageManager.persist(english);
+ gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+ countryManager.persist(gb);
+ user = new User(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, english, gb, getTimeZone());
+ persist(user);
}
@Test
public void loginIncorrect() {
- final User result = userManager.login("test", "test");
- assertNull(result);
+ final User result = userManager.login("test", "test");
+ assertNull(result);
}
@Test
public void loginWithEmailCorrect() {
- final User result = userManager.login(USER_EMAIL, USER_PASSWORD);
- assertNotNull(result.getId());
+ final User result = userManager.login(USER_EMAIL, USER_PASSWORD);
+ assertNotNull(result.getId());
}
@Test
public void loginWithNickCorrect() {
- final User result = userManager.login(USER_SHORT_NAME, USER_PASSWORD);
- assertNotNull(result.getId());
+ final User result = userManager.login(USER_SHORT_NAME, USER_PASSWORD);
+ assertNotNull(result.getId());
}
@Test(expected = InvalidStateException.class)
public void passwdLengthIncorrect() {
- user = new User("test1", "test1 name", "test at example.com", "pass", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "test1 name", "test at example.com", "pass", english, gb, getTimeZone());
+ persist(user);
}
@Test(expected = EntityExistsException.class)
public void testUserExist() throws I18nNotFoundException {
- final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- persist(user1);
- final User user2 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
- "GB", "GMT");
- persist(user2);
+ final User user1 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ persist(user1);
+ final User user2 = userManager.createUser("test", "test 1 name", "test1 at example.com", "some password", "en",
+ "GB", "GMT");
+ persist(user2);
}
@Test(expected = InvalidStateException.class)
public void userNameLengthIncorrect() {
- user = new User("test1", "te", "test at example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1", "te", "test at example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
@Test
public void userSearch() throws Exception, ParseException {
- userManager.reIndex();
- final SearchResult<User> result = userManager.search(USER_SHORT_NAME);
- assertEquals(1, result.getSize());
- assertEquals(USER_SHORT_NAME, result.getList().get(0).getShortName());
- rollbackTransaction();
+ userManager.reIndex();
+ final SearchResult<User> result = userManager.search(USER_SHORT_NAME);
+ assertEquals(1, (long) result.getSize());
+ assertEquals(USER_SHORT_NAME, result.getList().get(0).getShortName());
+ rollbackTransaction();
}
@Test(expected = InvalidStateException.class)
public void userShortNameIncorrect() {
- user = new User("test1A", "test1 name", "test at example.com", "some passwd", english, gb, getTimeZone());
- persist(user);
+ user = new User("test1A", "test1 name", "test at example.com", "some passwd", english, gb, getTimeZone());
+ persist(user);
}
private TimeZone getTimeZone() {
- return TimeZone.getDefault();
+ return TimeZone.getDefault();
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-05-30 15:20:21 UTC (rev 769)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/mapper/MapperTest.java 2008-05-31 20:03:25 UTC (rev 770)
@@ -91,7 +91,7 @@
d.addRevision(revision);
final ContentDTO dto = mapper.map(d, ContentDTO.class);
- assertEquals(1l, dto.getId());
+ assertEquals(1, (long) dto.getId());
assertEquals("title", dto.getTitle());
}
More information about the kune-commits
mailing list