r1311 - in trunk/src: main/java/cc/kune/core/server/init main/java/cc/kune/core/server/manager/impl main/java/cc/kune/core/server/rpc main/java/cc/kune/docs/server main/java/cc/kune/wave/server test/java/cc/kune/core/server/integration test/java/cc/kune/core/server/manager test/java/cc/kune/docs/server test/java/cc/kune/wave/server
Author: vjrj_ Date: 2011-04-13 17:41:45 +0200 (Wed, 13 Apr 2011) New Revision: 1311 Added: trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java Removed: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java trunk/src/test/java/cc/kune/core/server/manager/UserManagerTest.java Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java Log: WIAB in server doc manager Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -14,6 +14,7 @@ import cc.kune.core.server.manager.I18nTranslationManager; import cc.kune.core.server.manager.LicenseManager; import cc.kune.core.server.manager.UserManager; +import cc.kune.core.server.manager.impl.ContentConstants; import cc.kune.core.server.properties.DatabaseProperties; import cc.kune.core.shared.domain.ContentStatus; import cc.kune.core.shared.dto.GroupType; @@ -24,7 +25,7 @@ import cc.kune.domain.I18nTranslation; import cc.kune.domain.License; import cc.kune.domain.User; -import cc.kune.wave.server.CustomUserRegistrationServlet; +import cc.kune.wave.server.KuneWaveManager; import com.google.inject.Inject; import com.google.inject.persist.Transactional; @@ -33,19 +34,19 @@ private final ContentManager contentManager; private final I18nCountryManager countryManager; private final GroupManager groupManager; + private final KuneWaveManager kuneWaveManager; private final I18nLanguageManager languageManager; private final LicenseManager licenseManager; private final DatabaseProperties properties; private final I18nTranslationManager translationManager; private final UserManager userManager; - private final CustomUserRegistrationServlet waveUserRegister; @Inject public DatabaseInitializer(final DatabaseProperties properties, final UserManager userManager, final GroupManager groupManager, final LicenseManager licenseManager, final I18nLanguageManager languageManager, final I18nCountryManager countryManager, final I18nTranslationManager translationManager, final ContentManager contentManager, - final CustomUserRegistrationServlet waveUserRegister) { + final KuneWaveManager kuneWaveManager) { this.properties = properties; this.userManager = userManager; this.groupManager = groupManager; @@ -54,7 +55,7 @@ this.countryManager = countryManager; this.translationManager = translationManager; this.contentManager = contentManager; - this.waveUserRegister = waveUserRegister; + this.kuneWaveManager = kuneWaveManager; } private void createDefUsersGroup() throws Exception, UserMustBeLoggedException { @@ -86,30 +87,10 @@ groupManager.reIndex(); final Content defaultContent = siteGroup.getDefaultContent(); - contentManager.save(user, defaultContent, "<img src=\"http://kune.ourproject.org/kimages/logo-header.png\" " - + "align=\"right\">This a initial demo of " + "<a href=\"http://kune.ourproject.org\">kune</a>." - + "<br><div style=\"text-align: right;\"><br></div>" - + "Kune is currently under initial development.<br>" - + "<br>To test it, <a href=\"#signin\">sign in registering an user</a>, " - + "but take into account that:<br><ul><li>kune is not optimized yet, " - + "then the initial load and other operations maybe are slow.</li>" - + "<li>Don\'t use passwords that you are using in other sites " - + "(kune isn\'t secure yet storing passwords).</li>" - + "<li>The site is divided in two main areas: the public " + "space and the workspace:</li><ul>" - + "<li>The workspace is the most important part of kune, " - + "because is where users collaborate and communicates which each others. " - + "This part is the most dynamic and we are using modern " - + "(and sometimes experimental) web technologies to improve the end user " - + "experience. I heavily under development.<br></li>" - + "<li>The public space is currently lest developed. " - + "Our main goal is to offer customs and configurable styles " - + "for groups/users contents.</li></ul></ul><font size=\"4\"><br>" - + "We need your feedback<br><br></font>Please help us to improve this software " - + "reporting <a href=\"http://kune.ourproject.org/issues/\">bugs and/or " - + "suggestions</a>. Also you <a href=\"#translate\">help us to translate it</a> " - + "into other languages.<br><br>Thank you,<br>" + "<br>--<br><span style=\"font-style: italic;\">" - + "The kune development team</span><br><br>"); - contentManager.renameContent(user, defaultContent.getId(), "Welcome to kune demo"); + final String waveId = kuneWaveManager.createWave( + ContentConstants.INITIAL_CONTENT.replaceAll("\\[%s\\]", siteName), user.getShortName()); + contentManager.save(user, defaultContent, waveId); + contentManager.setStatus(defaultContent.getId(), ContentStatus.publishedOnline); } Added: trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java (rev 0) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -0,0 +1,172 @@ +package cc.kune.core.server.manager.impl; + +public class ContentConstants { + + public static final String INITIAL_CONTENT = "<span style=\"font-weight: bold;\">Welcome to [%s]</span><br/>" + + " <br/>" + " This site is powered by <a target=\"_blank\"" + + "href=\"http://kune.ourproject.org/\">Kune</a>.<br/>" + " <br/>" + + " Kune is currently under development.<br/>" + " <br/>" + + " To test it, <a href=\"#signin\">sign in registering" + + " an user</a>, but take into account that:<br/>" + " <ul>" + + " <li>This site is not optimized yet, then the initial load and" + + " other operations maybe are slow.</li>" + + " <li>Don't use passwords that you are using in other sites (this" + + " site isn't secure yet storing passwords).</li>" + + " <li>We need your feedback. Please help us to improve this" + + " software reporting <a target=\"_blank\"" + "href=\"http://kune.ourproject.org/issues/\">bugs" + + " and/or suggestions</a>. Also you <a target=\"_blank\"" + + " href=\"&\">help us to" + " translate it</a> into other languages.</li>" + + " </ul>" + " Thank you,<br/>" + " --<br/>" + + " <span style=\"font-style: italic;\">The Kune development team</span>"; + + public static final String WELCOME_WAVE_CONTENT = "<span style=\"font-weight: bold;\">Welcome to [%s]. Some tips to getting started</span><br/>" + + " <br/>" + + " Check out some tips to get you started in this site.<br/>" + + " <br/>" + + " <span style=\"font-weight: bold;\">The Basics</span><br/>" + + " <br/>" + + " This site have several spaces:<br/>" + + " <br/>" + + " <ul>" + + " <li><span style=\"text-decoration: underline;\">the Home Space</span>:" + + " your welcome page, with news and contents related to your" + + " groups, and where you can see your friends and others activity.</li>" + + " <li><span style=\"text-decoration: underline;\">the User Space</span>:" + + " the same way that your email Inbox shows a list of emails (old" + + " and new), this space shows a list of all your documents and" + + " contents in which you participate, highlighting the old ones" + + " with new contents. From here you can communicate with others," + + " but also generate contents together that you can publish later.</li>" + + " <li><span style=\"text-decoration: underline;\">the Group &" + + " Personal Space</span>: the contents you built can be part of" + + " your personal or specific group web space. You can have one" + + " personal space (like your blog, or your academic CV, etc), and" + + " belong to multiple group spaces (like initiatives you" + + " participate in your neighbourhood, or some scholar or" + + " proffesional initiatives, etc).</li>" + + " <li><span style=\"text-decoration: underline;\">the Public Space</span>:" + + " any content from the previous space, when finished, can be" + + " published in the web so anyone can see it. In this space you can" + + " see a preview of how the Personal or Group Space looks like on" + + " the web, outside the [%s] site.</li>" + + " </ul>" + + " <br/>" + + " In sum, your contents will be<br/>" + + " <ul>" + + " <li>somehow <span style=\"text-decoration: underline;\">private</span>" + + " (chat with your friends, private contents created with them," + + " shared photos, draft documents, etc)</li>" + + " <li><span style=\"text-decoration: underline;\">public</span> (works" + + " you want to share with everyone, finished documents, public" + + " photos/videos) </li>" + + " </ul>" + + " <br/>" + + " Here we are talking about \"contents\", but in fact those will be" + + " called \"waves\", a new way of communicating with others. Let us" + + " introduce it...<br/>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Here comes the Wave</span><br/>" + + " <br/>" + + " A \"wave\" is a special document (like in a word processor text) where" + + " you can include comments and conversations (like in a forum). Any" + + " wave can be edited by you like any document, but it will be saved" + + " online instead of in your computer. Besides, anyone you \"share\" the" + + " wave with (your friends Layla and Xavier, for example) can also edit" + + " the same document, improving and extending what you wrote. You can" + + " turn off your computer, come back the next day, and see how others" + + " changed the wave while you were away.<br/>" + + " <br/>" + + " Thus, all your contents will be different \"waves\", regardless if it" + + " is a photo gallery, a discussion, a blog post, a meeting" + + " announcement, or a CV.<br/>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Starting a new wave</span><br/>" + + " <br/>" + + " Anyone can create a new wave (like a blank document). For starting a" + + " wave, just click on the <span style=\"font-style: italic;\">New Wave</span>" + + " button in your Inbox. You can share this wave with any of your" + + " friends. On the other hand, the waves that your friends created and" + + " shared with you, will directly appear in your inbox. <br/>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Replying to a wave</span><br/>" + + " <br/>" + + " Layla and Xavier can also make comments to the text, in any" + + " paragraph or sentence they want to comment. Any of you can reply to" + + " every comment, establishing discussions about certain parts of the" + + " document. <br/>" + + " <ul>" + + " <li>For making a comment on the bottom of the wave:</li>" + + " <ul>" + + " <li><span style=\"font-style: italic;\">with your mouse</span>:" + + " click on the \"Click here to reply\" in the bottom, or</li>" + + " <li><span style=\"font-style: italic;\">with the keyboard</span>:" + + " press the \"Enter\" key.</li>" + + " </ul>" + + " <li> For making a comment on a specific part of the text:</li>" + + " <ul>" + + " <li><span style=\"font-style: italic;\">with your mouse</span>:" + + " Double click on the point you want to insert the comment and" + + " click \"Reply\", or</li>" + + " <li><span style=\"font-style: italic;\">with the keyboard</span>:" + + " Select that text (or comment) and press the \"Enter\" key</li>" + + " </ul>" + + " </ul>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Editing waves</span><br/>" + + " <br/>" + + " All participants on a wave can edit any part of the wave, at the" + + " same time. You don't need to wait until Layla finishes a section to" + + " begin editing, you can all do it at once. <br/>" + + " <ul>" + + " <li>For editing a wave:</li>" + + " <ul>" + + " <li><span style=\"font-style: italic;\">with your mouse</span>:" + + " Double click on the wave (or comment) and click \"Edit\", or</li>" + + " <li><span style=\"font-style: italic;\">with your keyboard</span>:" + + " Select where you want to edit, and press at once the keys" + + " \"Ctrl\" and \"E\"</li>" + + " </ul>" + + " <li>To finish the edition of the wave or a comment:</li>" + + " <ul>" + + " <li><span style=\"font-style: italic;\">with your mouse</span>:" + + " Click on the \"Done\" button at the bottom of your wave, or</li>" + + " <li><span style=\"font-style: italic;\">with your keyboard</span>:" + + " press at once the keys \"Shift\" and \"Enter\"</li>" + + " </ul>" + + " </ul>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Reading through waves</span><br/>" + + " <br/>" + + " When you open a wave that others edited, there will be comment you" + + " already read before, and new comments they wrote when you were away." + + " The unread comments are highlighted so you can easily know what's" + + " new. <br/>" + + " <ul>" + + " <li>For surfing quickly through the next unread comments, you can</li>" + + " <ul>" + + " <li><span style=\"font-style: italic;\">with your keyboard:</span>" + + " press the \"Spacebar\" key.</li>" + + " </ul>" + + " </ul>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Rich contents and add-ons</span><br/>" + + " <br/>" + + " Any wave can have not only text, but also images or videos... and" + + " much more. It's easy to insert add-ons in your waves, that allow you" + + " to include other \"rich content\" (polls, maps...), extra" + + " functionalities (translations, word-counters, spelling...) or" + + " integration with other sites (newspapers, twitter...)<br/>" + + " <br/>" + + " <a target=\"_blank\"" + + "href=\"http://wave-samples-gallery.appspot.com\">Visit" + + " the Google Wave sample extensions</a><br/>" + + " <br/>" + + " <span style=\"font-weight: bold;\">Finding one specific wave</span><br/>" + + " <br/>" + + " In the Inbox you have your list of waves, the ones you created or" + + " the ones others shared with you. You can use the search box to" + + " search through all your waves, using specific keywords.<br/>"; + + private ContentConstants() { + } +} Property changes on: trunk/src/main/java/cc/kune/core/server/manager/impl/ContentConstants.java ___________________________________________________________________ Name: svn:mime-type + text/plain Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -43,6 +43,7 @@ import cc.kune.core.server.manager.I18nLanguageManager; import cc.kune.core.server.manager.UserManager; import cc.kune.core.server.properties.ChatProperties; +import cc.kune.core.server.properties.DatabaseProperties; import cc.kune.core.server.xmpp.ChatConnection; import cc.kune.core.server.xmpp.ChatException; import cc.kune.core.server.xmpp.XmppManager; @@ -62,13 +63,15 @@ @Singleton public class UserManagerDefault extends DefaultManager<User, Long> implements UserManager { + + private final ChatProperties chatProperties; private final I18nCountryManager countryManager; + private final DatabaseProperties databaseProperties; private final UserFinder finder; private final I18nTranslationService i18n; private final KuneWaveManager kuneWaveManager; private final I18nLanguageManager languageManager; private final ParticipantUtils participantUtils; - private final ChatProperties properties; private final AccountStore waveAccountStore; // private final PropertiesManager propManager; private final CustomUserRegistrationServlet waveUserRegister; @@ -77,20 +80,22 @@ @Inject public UserManagerDefault(final Provider<EntityManager> provider, final UserFinder finder, final I18nLanguageManager languageManager, final I18nCountryManager countryManager, - final XmppManager xmppManager, final ChatProperties properties, final I18nTranslationService i18n, + final XmppManager xmppManager, final ChatProperties chatProperties, final I18nTranslationService i18n, final CustomUserRegistrationServlet waveUserRegister, final AccountStore waveAccountStore, - final KuneWaveManager kuneWaveManager, final ParticipantUtils participantUtils) { + final KuneWaveManager kuneWaveManager, final ParticipantUtils participantUtils, + final DatabaseProperties databaseProperties) { super(provider, User.class); this.finder = finder; this.languageManager = languageManager; this.countryManager = countryManager; this.xmppManager = xmppManager; - this.properties = properties; + this.chatProperties = chatProperties; this.i18n = i18n; this.waveUserRegister = waveUserRegister; this.waveAccountStore = waveAccountStore; this.kuneWaveManager = kuneWaveManager; this.participantUtils = participantUtils; + this.databaseProperties = databaseProperties; } @Override @@ -131,7 +136,9 @@ try { final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(), passwdDigest.getSalt(), language, country, tz); - kuneWaveManager.createWave(shortName, "Test wave"); + kuneWaveManager.createWave( + ContentConstants.WELCOME_WAVE_CONTENT.replaceAll("\\[%s\\]", + databaseProperties.getDefaultSiteName()), databaseProperties.getAdminShortName(), shortName); return user; } catch (final RuntimeException e) { try { @@ -178,7 +185,7 @@ // two db at the same time). This compromise solution is server // independent. // In the future cache this. - final String domain = "@" + properties.getDomain(); + final String domain = "@" + chatProperties.getDomain(); final UserBuddiesData buddiesData = new UserBuddiesData(); final User user = finder.getByShortName(shortName); @@ -231,10 +238,10 @@ if (user.getLastLogin() == null) { xmppManager.sendMessage( user.getShortName(), - i18n.t("This is the chat window. \n" - + "\n" - + "Here you can communicate with other users of this site but also with other users with compatible accounts (like gmail accounts). \n" - + "\n" + "Just add some buddie and start to chat.")); + i18n.t("This is the chat window. " + + "" + + "Here you can communicate with other users of this site but also with other users with compatible accounts (like gmail accounts). " + + "" + "Just add some buddie and start to chat.")); } user.setLastLogin(System.currentTimeMillis()); return user; Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -19,7 +19,6 @@ */ package cc.kune.core.server.rpc; - import cc.kune.core.client.errors.DefaultException; import cc.kune.core.client.rpcservices.GroupService; import cc.kune.core.server.UserSession; @@ -36,9 +35,11 @@ import cc.kune.core.shared.domain.utils.StateToken; import cc.kune.core.shared.dto.GroupDTO; import cc.kune.core.shared.dto.LicenseDTO; +import cc.kune.core.shared.i18n.I18nTranslationService; import cc.kune.domain.Content; import cc.kune.domain.Group; import cc.kune.domain.User; +import cc.kune.wave.server.KuneWaveManagerDefault; import com.google.inject.Inject; import com.google.inject.Provider; @@ -49,16 +50,21 @@ public class GroupRPC implements RPC, GroupService { private final ContentManager contentManager; private final GroupManager groupManager; + private final I18nTranslationService i18n; + private final KuneWaveManagerDefault kuneWaveManager; private final Mapper mapper; private final Provider<UserSession> userSessionProvider; @Inject public GroupRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager, - final ContentManager contentManager, final Mapper mapper) { + final ContentManager contentManager, final Mapper mapper, final KuneWaveManagerDefault kuneWaveManager, + final I18nTranslationService i18n) { this.userSessionProvider = userSessionProvider; this.groupManager = groupManager; this.contentManager = contentManager; this.mapper = mapper; + this.kuneWaveManager = kuneWaveManager; + this.i18n = i18n; } @Override @@ -100,9 +106,10 @@ final User user = getUserLogged(); final Group group = mapper.map(groupDTO, Group.class); final Group newGroup = groupManager.createGroup(group, user); - final Long defContentId = newGroup.getDefaultContent().getId(); - contentManager.save(user, newGroup.getDefaultContent(), publicDesc); - contentManager.setTags(user, defContentId, tags); + final String waveId = kuneWaveManager.createWave("<h1>" + i18n.t("About [%s]", groupDTO.getLongName()) + + "</h1>" + publicDesc, user.getShortName()); + contentManager.save(user, newGroup.getDefaultContent(), waveId); + // contentManager.setTags(user, defContentId, tags); return newGroup.getDefaultContent().getStateToken(); }; Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -35,6 +35,7 @@ import cc.kune.core.server.auth.Authenticated; import cc.kune.core.server.auth.Authorizated; import cc.kune.core.server.auth.SessionService; +import cc.kune.core.server.content.ContentManager; import cc.kune.core.server.manager.GroupManager; import cc.kune.core.server.manager.UserManager; import cc.kune.core.server.mapper.Mapper; @@ -46,9 +47,11 @@ import cc.kune.core.shared.dto.UserDTO; import cc.kune.core.shared.dto.UserInfoDTO; import cc.kune.core.shared.dto.WaveClientParams; +import cc.kune.core.shared.i18n.I18nTranslationService; import cc.kune.domain.Group; import cc.kune.domain.User; import cc.kune.wave.server.CustomWaveClientServlet; +import cc.kune.wave.server.KuneWaveManager; import com.google.inject.Inject; import com.google.inject.Provider; @@ -59,7 +62,10 @@ @Singleton public class UserRPC implements RPC, UserService { + private final ContentManager contentManager; private final GroupManager groupManager; + private final I18nTranslationService i18n; + private final KuneWaveManager kuneWaveManager; private final Mapper mapper; private final Provider<SessionService> sessionServiceProvider; private final UserInfoService userInfoService; @@ -74,7 +80,8 @@ final Provider<UserSession> userSessionProvider, final UserManager userManager, @Named(CoreSettings.USE_SOCKETIO) final Boolean useSocketIO, final GroupManager groupManager, final UserInfoService userInfoService, final Mapper mapper, final SessionManager waveSessionManager, - final CustomWaveClientServlet waveClientServlet) { + final CustomWaveClientServlet waveClientServlet, final I18nTranslationService i18n, + final KuneWaveManager kuneWaveManager, final ContentManager contentManager) { this.sessionServiceProvider = sessionServiceProvider; this.userSessionProvider = userSessionProvider; @@ -85,6 +92,9 @@ this.mapper = mapper; this.waveSessionManager = waveSessionManager; this.waveClientServlet = waveClientServlet; + this.i18n = i18n; + this.kuneWaveManager = kuneWaveManager; + this.contentManager = contentManager; } @Override @@ -93,7 +103,10 @@ final User user = userManager.createUser(userDTO.getShortName(), userDTO.getName(), userDTO.getEmail(), userDTO.getPassword(), userDTO.getLanguage().getCode(), userDTO.getCountry().getCode(), userDTO.getTimezone().getId()); - groupManager.createUserGroup(user, wantPersonalHomepage); + final Group userGroup = groupManager.createUserGroup(user, wantPersonalHomepage); + final String waveId = kuneWaveManager.createWave("<h1>" + i18n.t("[%s] Bio", userDTO.getName()) + "</h1>" + + i18n.t("This user has not written its biography yet"), user.getShortName()); + contentManager.save(user, userGroup.getDefaultContent(), waveId); } @Override Modified: trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java =================================================================== --- trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/docs/server/DocumentServerTool.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -36,7 +36,6 @@ import cc.kune.domain.Group; import cc.kune.domain.ToolConfiguration; import cc.kune.domain.User; -import cc.kune.wave.server.KuneWaveManager; import com.google.inject.Inject; @@ -48,23 +47,18 @@ public static final String TYPE_ROOT = NAME + "." + "root"; public static final String TYPE_UPLOADEDFILE = NAME + "." + ServerTool.UPLOADEDFILE_SUFFIX; - public static final String TYPE_WAVE = NAME + "." + ServerTool.WAVE_SUFFIX; - private final ToolConfigurationManager configurationManager; private final ContainerManager containerManager; private final ContentManager contentManager; private final I18nTranslationService i18n; - private final KuneWaveManager kuneWaveManager; @Inject public DocumentServerTool(final ContentManager contentManager, final ContainerManager containerManager, - final ToolConfigurationManager configurationManager, final I18nTranslationService translationService, - final KuneWaveManager kuneWaveManager) { + final ToolConfigurationManager configurationManager, final I18nTranslationService translationService) { this.contentManager = contentManager; this.containerManager = containerManager; this.configurationManager = configurationManager; this.i18n = translationService; - this.kuneWaveManager = kuneWaveManager; } void checkContainerTypeId(final String parentTypeId, final String typeId) { @@ -81,10 +75,9 @@ } void checkContentTypeId(final String parentTypeId, final String typeId) { - if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE) || typeId.equals(TYPE_WAVE)) { + if (typeId.equals(TYPE_DOCUMENT) || typeId.equals(TYPE_UPLOADEDFILE)) { // ok valid content if ((typeId.equals(TYPE_DOCUMENT) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER))) - || (typeId.equals(TYPE_WAVE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER))) || (typeId.equals(TYPE_UPLOADEDFILE) && (parentTypeId.equals(TYPE_ROOT) || parentTypeId.equals(TYPE_FOLDER)))) { // ok } else { @@ -137,7 +130,6 @@ content.setStatus(ContentStatus.publishedOnline); content.setPublishedOn(new Date()); group.setDefaultContent(content); - kuneWaveManager.createWave(user.getShortName(), "<h1>" + i18n.t("About [%s]" + "</h1>", longName)); return group; } Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -1,8 +1,7 @@ package cc.kune.wave.server; - public interface KuneWaveManager { - void createWave(String user, String message); + String createWave(String message, String... participants); } Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -20,8 +20,9 @@ import com.google.inject.Inject; import com.google.inject.name.Named; +import com.google.wave.api.Blip; +import com.google.wave.api.JsonRpcConstant.ParamsProperty; import com.google.wave.api.JsonRpcResponse; -import com.google.wave.api.Markup; import com.google.wave.api.OperationQueue; import com.google.wave.api.OperationRequest; import com.google.wave.api.ProtocolVersion; @@ -36,7 +37,6 @@ private final String domain; private final OperationServiceRegistry operationRegistry; private final ParticipantUtils participantUtils; - private final WaveletProvider waveletProvider; @Inject @@ -53,24 +53,43 @@ } @Override - public void createWave(final String username, final String message) { - final ParticipantId user = participantUtils.of(username); + public String createWave(final String message, final String... participantArray) { + String newWaveId = null; + final Set<String> participants = new HashSet<String>(); + for (final String participant : participantArray) { + participants.add(participantUtils.of(participant).toString()); + } + final ParticipantId user = participantUtils.of(participantArray[0]); final OperationQueue opQueue = new OperationQueue(); - final Set<String> participants = new HashSet<String>(); - participants.add(user.toString()); final Wavelet newWavelet = opQueue.createWavelet(domain, participants); - // newWavelet.getRootBlip().append(Markup.of(message)); - opQueue.appendMarkupToDocument(newWavelet.getRootBlip(), Markup.of(message).getMarkup()); - + // opQueue.appendMarkupToDocument(newWavelet.getRootBlip(), + // Markup.of(message).getMarkup()); + // opQueue.appendBlipToWavelet(newWavelet, + // Markup.of(message).getMarkup()); + // + final Blip rootBlip = newWavelet.getRootBlip(); + // rootBlip.append(Markup.of(message)); + rootBlip.append(new com.google.wave.api.Markup("<b>kk</b>")); + // opQueue.modifyDocument(rootBlip).addParameter( + // Parameter.of(ParamsProperty.MODIFY_ACTION, ModifyHow.INSERT_AFTER)); final OperationContextImpl context = new OperationContextImpl(waveletProvider, converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil); - for (final OperationRequest req : opQueue.getPendingOperations()) { OperationUtil.executeOperation(req, operationRegistry, context, user); final String reqId = req.getId(); final JsonRpcResponse response = context.getResponse(reqId); - if (response != null && response.isError()) { - onFailure(context.getResponse(reqId).getErrorMessage()); + if (response != null) { + if (response.isError()) { + onFailure(context.getResponse(reqId).getErrorMessage()); + } else { + final Object responseWaveId = response.getData().get(ParamsProperty.WAVE_ID); + if (responseWaveId != null) { + // This is serialized use + // ApiIdSerializer.instance().deserialiseWaveId (see + // WaveService) + newWaveId = (String) responseWaveId; + } + } } } OperationUtil.submitDeltas(context, waveletProvider, new SubmitRequestListener() { @@ -84,6 +103,7 @@ LOG.info("Wave creation success: " + arg1); } }); + return newWaveId; } private void onFailure(final String message) { Deleted: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -1,125 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package cc.kune.core.server.integration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.ourproject.kune.chat.server.ChatServerTool; - -import cc.kune.core.server.content.ContainerManager; -import cc.kune.core.server.content.ContentManager; -import cc.kune.core.server.manager.GroupManager; -import cc.kune.core.server.manager.I18nCountryManager; -import cc.kune.core.server.manager.I18nLanguageManager; -import cc.kune.core.server.manager.I18nTranslationManager; -import cc.kune.core.server.manager.LicenseManager; -import cc.kune.docs.server.DocumentServerTool; -import cc.kune.domain.Container; -import cc.kune.domain.Content; -import cc.kune.domain.Group; -import cc.kune.domain.ToolConfiguration; - -import com.google.inject.Inject; -import com.google.inject.persist.Transactional; - -public class DatabaseInitializationTest { - @Inject - GroupManager groupManager; - @Inject - LicenseManager licenseManager; - @Inject - I18nTranslationManager transManager; - @Inject - I18nLanguageManager languageManager; - @Inject - I18nCountryManager countryManager; - @Inject - ContentManager contentManager; - @Inject - ContainerManager containerManager; - - private Group defaultGroup; - - /** - * If this test fails, see database configuration in INSTALL (the collation - * part) and http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html - * - * Title must be created as something like `title` varchar(255) collate - * utf8_bin default NULL - * - */ - @Test - public void caseSensitive() { - final Content defaultContent = defaultGroup.getDefaultContent(); - assertTrue(contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo")); - assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "welcome to kune Demo")); - assertTrue(!contentManager.findIfExistsTitle(defaultContent.getContainer(), "Welcome to kune demo ")); - } - - @Transactional - @Before - public void init() { - new IntegrationTestHelper(this); - defaultGroup = groupManager.getSiteDefaultGroup(); - } - - @Test - public void testDefaultContentAndLicenses() { - assertNotNull(defaultGroup.getDefaultContent()); - assertTrue(licenseManager.getAll().size() > 0); - assertNotNull(defaultGroup.getDefaultLicense()); - } - - @Test - public void testDefaultDocumentContent() { - final Content content = defaultGroup.getDefaultContent(); - assertEquals(DocumentServerTool.TYPE_DOCUMENT, content.getTypeId()); - final Container rootDocFolder = content.getContainer(); - assertEquals(true, rootDocFolder.isRoot()); - } - - @Test - public void testI18n() { - assertNotNull(countryManager.find(Long.valueOf(75))); - assertNotNull(languageManager.findByCode("en")); - assertNotNull(languageManager.find(Long.valueOf(1819))); - } - - @Test - public void testToolConfiguration() { - assertNotNull(defaultGroup); - final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(DocumentServerTool.NAME); - assertNotNull(docToolConfig); - assertTrue(docToolConfig.isEnabled()); - final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatServerTool.NAME); - assertNotNull(chatToolConfig); - assertTrue(chatToolConfig.isEnabled()); - final List<String> enabledTools = groupManager.findEnabledTools(defaultGroup.getId()); - assertNotNull(enabledTools); - assertTrue(enabledTools.size() > 0); - } - -} Copied: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java (from rev 1306, trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializationTest.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -0,0 +1,109 @@ +/* + * + * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package cc.kune.core.server.integration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.ourproject.kune.chat.server.ChatServerTool; + +import cc.kune.core.server.content.ContainerManager; +import cc.kune.core.server.content.ContentManager; +import cc.kune.core.server.manager.GroupManager; +import cc.kune.core.server.manager.I18nCountryManager; +import cc.kune.core.server.manager.I18nLanguageManager; +import cc.kune.core.server.manager.I18nTranslationManager; +import cc.kune.core.server.manager.LicenseManager; +import cc.kune.docs.server.DocumentServerTool; +import cc.kune.domain.Container; +import cc.kune.domain.Content; +import cc.kune.domain.Group; +import cc.kune.domain.ToolConfiguration; + +import com.google.inject.Inject; +import com.google.inject.persist.Transactional; + +public class DatabaseInitializerTest { + @Inject + ContainerManager containerManager; + @Inject + ContentManager contentManager; + @Inject + I18nCountryManager countryManager; + private Group defaultGroup; + @Inject + GroupManager groupManager; + @Inject + I18nLanguageManager languageManager; + @Inject + LicenseManager licenseManager; + + @Inject + I18nTranslationManager transManager; + + @Transactional + @Before + public void init() { + new IntegrationTestHelper(this); + defaultGroup = groupManager.getSiteDefaultGroup(); + } + + @Test + public void testDefaultContentAndLicenses() { + assertNotNull(defaultGroup.getDefaultContent()); + assertTrue(licenseManager.getAll().size() > 0); + assertNotNull(defaultGroup.getDefaultLicense()); + } + + @Test + public void testDefaultDocumentContent() { + final Content content = defaultGroup.getDefaultContent(); + assertEquals(DocumentServerTool.TYPE_DOCUMENT, content.getTypeId()); + final Container rootDocFolder = content.getContainer(); + assertEquals(true, rootDocFolder.isRoot()); + } + + @Test + public void testI18n() { + assertNotNull(countryManager.find(Long.valueOf(75))); + assertNotNull(languageManager.findByCode("en")); + assertNotNull(languageManager.find(Long.valueOf(1819))); + } + + @Test + public void testToolConfiguration() { + assertNotNull(defaultGroup); + final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(DocumentServerTool.NAME); + assertNotNull(docToolConfig); + assertTrue(docToolConfig.isEnabled()); + final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatServerTool.NAME); + assertNotNull(chatToolConfig); + assertTrue(chatToolConfig.isEnabled()); + final List<String> enabledTools = groupManager.findEnabledTools(defaultGroup.getId()); + assertNotNull(enabledTools); + assertTrue(enabledTools.size() > 0); + } + +} Copied: trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java (from rev 1306, trunk/src/test/java/cc/kune/core/server/manager/UserManagerTest.java) =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java (rev 0) +++ trunk/src/test/java/cc/kune/core/server/manager/UserManagerDefaultTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -0,0 +1,146 @@ +/* + * + * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) + * This file is part of kune. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package cc.kune.core.server.manager; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.TimeZone; + +import javax.persistence.PersistenceException; + +import org.apache.lucene.queryParser.ParseException; +import org.hibernate.validator.InvalidStateException; +import org.junit.Test; + +import cc.kune.core.client.errors.GroupNameInUseException; +import cc.kune.core.client.errors.I18nNotFoundException; +import cc.kune.core.server.PersistencePreLoadedDataTest; +import cc.kune.core.server.manager.impl.SearchResult; +import cc.kune.core.shared.domain.UserSNetVisibility; +import cc.kune.domain.Group; +import cc.kune.domain.User; + +import com.google.inject.Inject; + +public class UserManagerDefaultTest extends PersistencePreLoadedDataTest { + @Inject + Group groupFinder; + + @Test + public void emailCorrect() { + user = new User("test1", "test1 name", "[email protected]", "some passwd", "somediggest".getBytes(), + "some salt".getBytes(), english, gb, getTimeZone()); + persist(user); + } + + @Test(expected = PersistenceException.class) + public void emailEmpty() { + user = new User("test1", "test1 name", null, "some passwd", "somediggest".getBytes(), "some salt".getBytes(), + english, gb, getTimeZone()); + persist(user); + } + + @Test(expected = InvalidStateException.class) + public void emailIncorrect() { + user = new User("test1", "test1 name", "falseEmail@", "some passwd", "somediggest".getBytes(), + "some salt".getBytes(), english, gb, getTimeZone()); + persist(user); + } + + private TimeZone getTimeZone() { + return TimeZone.getDefault(); + } + + @Test + public void loginIncorrect() { + 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()); + } + + @Test + public void loginWithNickCorrect() { + 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", "[email protected]", "pass", "diggest".getBytes(), "salt".getBytes(), + english, gb, getTimeZone()); + persist(user); + } + + /** + * This was not working: + * http://opensource.atlassian.com/projects/hibernate/browse/EJB-382 + */ + @Test(expected = GroupNameInUseException.class) + public void testUserExist() throws I18nNotFoundException { + final User user1 = userManager.createUser("test", "test 1 name", "[email protected]", "some password", "en", + "GB", "GMT"); + persist(user1); + final User user2 = userManager.createUser("test", "test 1 name", "[email protected]", "some password", "en", + "GB", "GMT"); + persist(user2); + } + + @Test(expected = InvalidStateException.class) + public void userNameLengthIncorrect() { + user = new User("test1", "te", "[email protected]", "some passwd", "diggest".getBytes(), "salt".getBytes(), + 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(); + } + + @Test(expected = InvalidStateException.class) + public void userShortNameIncorrect() { + user = new User("test1A", "test1 name", "[email protected]", "some passwd", "diggest".getBytes(), + "salt".getBytes(), english, gb, getTimeZone()); + persist(user); + } + + @Test + public void visibilityPersist() { + user = new User("test1", "test1 name", "[email protected]", "some passwd", "somediggest".getBytes(), + "some salt".getBytes(), english, gb, getTimeZone()); + for (final UserSNetVisibility visibility : UserSNetVisibility.values()) { + user.setSNetVisibility(visibility); + persist(user); + assertEquals(user.getSNetVisibility(), visibility); + } + } + +} Deleted: trunk/src/test/java/cc/kune/core/server/manager/UserManagerTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/manager/UserManagerTest.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/test/java/cc/kune/core/server/manager/UserManagerTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -1,146 +0,0 @@ -/* - * - * Copyright (C) 2007-2011 The kune development team (see CREDITS for details) - * This file is part of kune. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package cc.kune.core.server.manager; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.TimeZone; - -import javax.persistence.PersistenceException; - -import org.apache.lucene.queryParser.ParseException; -import org.hibernate.validator.InvalidStateException; -import org.junit.Test; - -import cc.kune.core.client.errors.GroupNameInUseException; -import cc.kune.core.client.errors.I18nNotFoundException; -import cc.kune.core.server.PersistencePreLoadedDataTest; -import cc.kune.core.server.manager.impl.SearchResult; -import cc.kune.core.shared.domain.UserSNetVisibility; -import cc.kune.domain.Group; -import cc.kune.domain.User; - -import com.google.inject.Inject; - -public class UserManagerTest extends PersistencePreLoadedDataTest { - @Inject - Group groupFinder; - - @Test - public void emailCorrect() { - user = new User("test1", "test1 name", "[email protected]", "some passwd", "somediggest".getBytes(), - "some salt".getBytes(), english, gb, getTimeZone()); - persist(user); - } - - @Test(expected = PersistenceException.class) - public void emailEmpty() { - user = new User("test1", "test1 name", null, "some passwd", "somediggest".getBytes(), "some salt".getBytes(), - english, gb, getTimeZone()); - persist(user); - } - - @Test(expected = InvalidStateException.class) - public void emailIncorrect() { - user = new User("test1", "test1 name", "falseEmail@", "some passwd", "somediggest".getBytes(), - "some salt".getBytes(), english, gb, getTimeZone()); - persist(user); - } - - private TimeZone getTimeZone() { - return TimeZone.getDefault(); - } - - @Test - public void loginIncorrect() { - 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()); - } - - @Test - public void loginWithNickCorrect() { - 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", "[email protected]", "pass", "diggest".getBytes(), "salt".getBytes(), - english, gb, getTimeZone()); - persist(user); - } - - /** - * This was not working: - * http://opensource.atlassian.com/projects/hibernate/browse/EJB-382 - */ - @Test(expected = GroupNameInUseException.class) - public void testUserExist() throws I18nNotFoundException { - final User user1 = userManager.createUser("test", "test 1 name", "[email protected]", "some password", "en", - "GB", "GMT"); - persist(user1); - final User user2 = userManager.createUser("test", "test 1 name", "[email protected]", "some password", "en", - "GB", "GMT"); - persist(user2); - } - - @Test(expected = InvalidStateException.class) - public void userNameLengthIncorrect() { - user = new User("test1", "te", "[email protected]", "some passwd", "diggest".getBytes(), "salt".getBytes(), - 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(); - } - - @Test(expected = InvalidStateException.class) - public void userShortNameIncorrect() { - user = new User("test1A", "test1 name", "[email protected]", "some passwd", "diggest".getBytes(), - "salt".getBytes(), english, gb, getTimeZone()); - persist(user); - } - - @Test - public void visibilityPersist() { - user = new User("test1", "test1 name", "[email protected]", "some passwd", "somediggest".getBytes(), - "some salt".getBytes(), english, gb, getTimeZone()); - for (final UserSNetVisibility visibility : UserSNetVisibility.values()) { - user.setSNetVisibility(visibility); - persist(user); - assertEquals(user.getSNetVisibility(), visibility); - } - } - -} Modified: trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java =================================================================== --- trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/test/java/cc/kune/docs/server/DocumentServerToolTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -33,7 +33,7 @@ @Before public void before() { - serverTool = new DocumentServerTool(null, null, null, null, null); + serverTool = new DocumentServerTool(null, null, null, null); } @Test Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java =================================================================== --- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-13 09:06:44 UTC (rev 1310) +++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-04-13 15:41:45 UTC (rev 1311) @@ -1,5 +1,7 @@ package cc.kune.wave.server; +import static org.junit.Assert.assertNotNull; + import java.io.IOException; import org.junit.Before; @@ -25,6 +27,6 @@ @Test public void createWave() throws DefaultException, IOException { doLogin(); - manager.createWave(getSiteAdminShortName(), "testing"); + assertNotNull(manager.createWave("testing", getSiteAdminShortName())); } }
participants (1)
-
Vicente J. Ruiz Jurado