r1456 - in trunk/src: main/java/cc/kune/chat/client main/java/cc/kune/core/client/auth main/java/cc/kune/core/client/events main/java/cc/kune/core/public main/java/cc/kune/core/server/init main/java/cc/kune/core/server/manager/impl main/java/cc/kune/core/server/properties main/java/cc/kune/core/server/state main/java/cc/kune/wave/server main/resources main/webapp/others/splash/js test/java/cc/kune/core/server/finders test/java/cc/kune/core/server/integration test/java/cc/kune/core/server/inte
Author: vjrj_ Date: 2011-07-14 10:58:16 +0200 (Thu, 14 Jul 2011) New Revision: 1456 Added: trunk/src/main/java/cc/kune/core/client/events/NewUserRegisteredEvent.java trunk/src/main/java/cc/kune/core/server/properties/KuneBasicProperties.java Removed: trunk/src/main/java/cc/kune/core/server/properties/DatabaseProperties.java Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java trunk/src/main/java/cc/kune/core/public/ws.html trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java trunk/src/main/java/cc/kune/core/server/manager/impl/LicenseManagerDefault.java trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java trunk/src/main/java/cc/kune/wave/server/KuneAgent.java trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java trunk/src/main/resources/kune.properties trunk/src/main/webapp/others/splash/js/permalink_client.js trunk/src/main/webapp/others/splash/js/rpc.js trunk/src/test/java/cc/kune/core/server/finders/LicenseFinderTest.java trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java trunk/src/test/java/com/google/wave/splash/text/ContentNewUnrendererTest.java Log: Def wave in properties; some minor fixes Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java =================================================================== --- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -40,6 +40,7 @@ import cc.kune.common.client.utils.TextUtils; import cc.kune.common.client.utils.WindowUtils; import cc.kune.core.client.events.AvatarChangedEvent; +import cc.kune.core.client.events.NewUserRegisteredEvent; import cc.kune.core.client.init.AppStartEvent; import cc.kune.core.client.init.AppStopEvent; import cc.kune.core.client.resources.CoreResources; @@ -79,6 +80,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.event.shared.EventBus; import com.google.gwt.resources.client.ImageResource; +import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; @@ -93,7 +95,20 @@ super(); this.res = res; putValue(Action.SMALL_ICON, res.chat()); - + kuneEventBus.addHandler(NewUserRegisteredEvent.getType(), + new NewUserRegisteredEvent.NewUserRegisteredHandler() { + @Override + public void onNewUserRegistered(final NewUserRegisteredEvent event) { + // Blink the chat some seconds + setBlink(true); + new Timer() { + @Override + public void run() { + setBlink(false); + } + }.schedule(10000); + } + }); } @Override Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -27,6 +27,7 @@ import cc.kune.core.client.errors.EmailAddressInUseException; import cc.kune.core.client.errors.GroupNameInUseException; import cc.kune.core.client.errors.UserRegistrationException; +import cc.kune.core.client.events.NewUserRegisteredEvent; import cc.kune.core.client.i18n.I18nUITranslationService; import cc.kune.core.client.notify.msgs.UserNotifyEvent; import cc.kune.core.client.resources.CoreMessages; @@ -39,6 +40,8 @@ import cc.kune.core.shared.dto.TimeZoneDTO; import cc.kune.core.shared.dto.UserDTO; +import com.google.gwt.core.client.Scheduler; +import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.logical.shared.CloseEvent; @@ -52,166 +55,173 @@ import com.gwtplatform.mvp.client.proxy.Proxy; import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent; -public class RegisterPresenter extends SignInAbstractPresenter<RegisterView, RegisterPresenter.RegisterProxy> implements - Register { +public class RegisterPresenter extends + SignInAbstractPresenter<RegisterView, RegisterPresenter.RegisterProxy> implements Register { - @ProxyCodeSplit - public interface RegisterProxy extends Proxy<RegisterPresenter> { - } - private final Provider<SignIn> signInProvider; + @ProxyCodeSplit + public interface RegisterProxy extends Proxy<RegisterPresenter> { + } + private final Provider<SignIn> signInProvider; - private final Provider<UserServiceAsync> userServiceProvider; + private final Provider<UserServiceAsync> userServiceProvider; - @Inject - public RegisterPresenter(final EventBus eventBus, final RegisterView view, final RegisterProxy proxy, - final Session session, final StateManager stateManager, final I18nUITranslationService i18n, - final Provider<UserServiceAsync> userServiceProvider, final Provider<SignIn> signInProvider, - final CookiesManager cookiesManager, final UserPassAutocompleteManager autocomplete) { - super(eventBus, view, proxy, session, stateManager, i18n, cookiesManager, autocomplete); - this.userServiceProvider = userServiceProvider; - this.signInProvider = signInProvider; + @Inject + public RegisterPresenter(final EventBus eventBus, final RegisterView view, final RegisterProxy proxy, + final Session session, final StateManager stateManager, final I18nUITranslationService i18n, + final Provider<UserServiceAsync> userServiceProvider, final Provider<SignIn> signInProvider, + final CookiesManager cookiesManager, final UserPassAutocompleteManager autocomplete) { + super(eventBus, view, proxy, session, stateManager, i18n, cookiesManager, autocomplete); + this.userServiceProvider = userServiceProvider; + this.signInProvider = signInProvider; + } + + @Override + public void doRegister() { + signInProvider.get().hide(); + if (!session.isLogged()) { + NotifyUser.showProgressProcessing(); + getView().show(); + // getView().center(); + NotifyUser.hideProgress(); + } else { + stateManager.restorePreviousToken(); } + } - @Override - public void doRegister() { - signInProvider.get().hide(); - if (!session.isLogged()) { - NotifyUser.showProgressProcessing(); - getView().show(); - // getView().center(); - NotifyUser.hideProgress(); - } else { - stateManager.restorePreviousToken(); + @Override + public RegisterView getView() { + return (RegisterView) super.getView(); + } + + @Override + protected void onBind() { + super.onBind(); + getView().getFirstBtn().addClickHandler(new ClickHandler() { + @Override + public void onClick(final ClickEvent event) { + getView().validate(); + if (getView().isValid()) { + onFormRegister(); } - } + } + }); + getView().getSecondBtn().addClickHandler(new ClickHandler() { - @Override - public RegisterView getView() { - return (RegisterView) super.getView(); - } + @Override + public void onClick(final ClickEvent event) { + onCancel(); + } + }); + getView().getClose().addCloseHandler(new CloseHandler<PopupPanel>() { - @Override - protected void onBind() { - super.onBind(); - getView().getFirstBtn().addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - getView().validate(); - if (getView().isValid()) { - onFormRegister(); - } - } - }); - getView().getSecondBtn().addClickHandler(new ClickHandler() { + @Override + public void onClose(final CloseEvent<PopupPanel> event) { + Log.debug("Closing register presenter"); + RegisterPresenter.this.onClose(); + } + }); + } - @Override - public void onClick(final ClickEvent event) { - onCancel(); - } - }); - getView().getClose().addCloseHandler(new CloseHandler<PopupPanel>() { + public void onFormRegister() { + if (getView().isRegisterFormValid()) { + getView().maskProcessing(); - @Override - public void onClose(final CloseEvent<PopupPanel> event) { - Log.debug("Closing register presenter"); - RegisterPresenter.this.onClose(); - } - }); - } + final I18nLanguageDTO language = new I18nLanguageDTO(); + language.setCode(i18n.getCurrentLanguage()); - public void onFormRegister() { - if (getView().isRegisterFormValid()) { - getView().maskProcessing(); + final I18nCountryDTO country = new I18nCountryDTO(); + country.setCode("GB"); - final I18nLanguageDTO language = new I18nLanguageDTO(); - language.setCode(i18n.getCurrentLanguage()); + final TimeZoneDTO timezone = new TimeZoneDTO(); + timezone.setId("GMT"); - final I18nCountryDTO country = new I18nCountryDTO(); - country.setCode("GB"); + final boolean wantHomepage = true; - final TimeZoneDTO timezone = new TimeZoneDTO(); - timezone.setId("GMT"); + final UserDTO user = new UserDTO(getView().getLongName(), getView().getShortName(), + getView().getRegisterPassword(), getView().getEmail(), language, country, timezone, null, + true, SubscriptionMode.manual, "blue"); + super.saveAutocompleteLoginData(getView().getShortName(), getView().getRegisterPassword()); + final AsyncCallback<Void> callback = new AsyncCallback<Void>() { + @Override + public void onFailure(final Throwable caught) { + onRegistrationFailure(caught); + } - final boolean wantHomepage = true; + @Override + public void onSuccess(final Void arg0) { + signInProvider.get().doSignIn(getView().getShortName(), getView().getRegisterPassword(), + new AsyncCallback<Void>() { - final UserDTO user = new UserDTO(getView().getLongName(), getView().getShortName(), - getView().getRegisterPassword(), getView().getEmail(), language, country, timezone, null, true, - SubscriptionMode.manual, "blue"); - super.saveAutocompleteLoginData(getView().getShortName(), getView().getRegisterPassword()); - final AsyncCallback<Void> callback = new AsyncCallback<Void>() { @Override public void onFailure(final Throwable caught) { - onRegistrationFailure(caught); + onRegistrationFailure(caught); } @Override - public void onSuccess(final Void arg0) { - signInProvider.get().doSignIn(getView().getShortName(), getView().getRegisterPassword(), - new AsyncCallback<Void>() { - - @Override - public void onFailure(final Throwable caught) { - onRegistrationFailure(caught); - } - - @Override - public void onSuccess(final Void result) { - // onSignIn(userInfoDTO); - stateManager.gotoHistoryToken(session.getCurrentUserInfo().getHomePage()); - getView().hide(); - getView().unMask(); - if (wantHomepage) { - showWelcolmeDialog(); - } else { - showWelcolmeDialogNoHomepage(); - } - } - }); + public void onSuccess(final Void result) { + // onSignIn(userInfoDTO); + NewUserRegisteredEvent.fire(getEventBus()); + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + @Override + public void execute() { + stateManager.gotoHistoryToken(session.getCurrentUserInfo().getHomePage()); + } + }); + getView().hide(); + getView().unMask(); + if (wantHomepage) { + showWelcolmeDialog(); + } else { + showWelcolmeDialogNoHomepage(); + } } + }); + } - private void showWelcolmeDialog() { - getEventBus().fireEvent( - new UserNotifyEvent( - NotifyLevel.info, - i18n.t("Welcome"), - i18n.t("Thanks for joining this site. " - + "Now you can actively participate in this site. " - + "You can also use your personal space to publish contents. " - + "Note: your email is not verified, please follow the instructions you will receive by email."), - true)); - } + private void showWelcolmeDialog() { + getEventBus().fireEvent( + new UserNotifyEvent( + NotifyLevel.info, + i18n.t("Welcome"), + i18n.t("Thanks for joining this site. " + + "Now you can actively participate in this site. " + + "You can also use your personal space to publish contents. " + + "Note: your email is not verified, please follow the instructions you will receive by email."), + true)); + } - private void showWelcolmeDialogNoHomepage() { - getEventBus().fireEvent( - new UserNotifyEvent( - NotifyLevel.info, - i18n.t("Welcome"), - i18n.t("Thanks for joining this site" - + "Now you can actively participate in this site. " - + "Note: your email is not verified, please follow the instructions you will receive by email."), - true)); - } - }; - userServiceProvider.get().createUser(user, wantHomepage, callback); + private void showWelcolmeDialogNoHomepage() { + getEventBus().fireEvent( + new UserNotifyEvent( + NotifyLevel.info, + i18n.t("Welcome"), + i18n.t("Thanks for joining this site" + + "Now you can actively participate in this site. " + + "Note: your email is not verified, please follow the instructions you will receive by email."), + true)); } + }; + userServiceProvider.get().createUser(user, wantHomepage, callback); } + } - private void onRegistrationFailure(final Throwable caught) { - getView().unMask(); - if (caught instanceof EmailAddressInUseException) { - getView().setErrorMessage(i18n.t(CoreMessages.EMAIL_IN_USE), NotifyLevel.error); - } else if (caught instanceof GroupNameInUseException) { - getView().setErrorMessage(i18n.t(CoreMessages.NAME_IN_USE), NotifyLevel.error); - } else if (caught instanceof UserRegistrationException) { - getView().setErrorMessage(i18n.t("Error during registration. " + caught.getMessage()), NotifyLevel.error); - } else { - getView().setErrorMessage(i18n.t("Error during registration."), NotifyLevel.error); - throw new UIException("Other kind of exception in user registration", caught); - } + private void onRegistrationFailure(final Throwable caught) { + getView().unMask(); + if (caught instanceof EmailAddressInUseException) { + getView().setErrorMessage(i18n.t(CoreMessages.EMAIL_IN_USE), NotifyLevel.error); + } else if (caught instanceof GroupNameInUseException) { + getView().setErrorMessage(i18n.t(CoreMessages.NAME_IN_USE), NotifyLevel.error); + } else if (caught instanceof UserRegistrationException) { + getView().setErrorMessage(i18n.t("Error during registration. " + caught.getMessage()), + NotifyLevel.error); + } else { + getView().setErrorMessage(i18n.t("Error during registration."), NotifyLevel.error); + throw new UIException("Other kind of exception in user registration", caught); } + } - @Override - protected void revealInParent() { - RevealRootContentEvent.fire(this, this); - } + @Override + protected void revealInParent() { + RevealRootContentEvent.fire(this, this); + } } Added: trunk/src/main/java/cc/kune/core/client/events/NewUserRegisteredEvent.java =================================================================== --- trunk/src/main/java/cc/kune/core/client/events/NewUserRegisteredEvent.java (rev 0) +++ trunk/src/main/java/cc/kune/core/client/events/NewUserRegisteredEvent.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -0,0 +1,55 @@ +package cc.kune.core.client.events; + +import com.google.gwt.event.shared.EventHandler; +import com.google.gwt.event.shared.GwtEvent; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.event.shared.HasHandlers; + +public class NewUserRegisteredEvent extends GwtEvent<NewUserRegisteredEvent.NewUserRegisteredHandler> { + + public interface HasNewUserRegisteredHandlers extends HasHandlers { + HandlerRegistration addNewUserRegisteredHandler(NewUserRegisteredHandler handler); + } + + public interface NewUserRegisteredHandler extends EventHandler { + public void onNewUserRegistered(NewUserRegisteredEvent event); + } + + private static final Type<NewUserRegisteredHandler> TYPE = new Type<NewUserRegisteredHandler>(); + + public static void fire(final HasHandlers source) { + source.fireEvent(new NewUserRegisteredEvent()); + } + + public static Type<NewUserRegisteredHandler> getType() { + return TYPE; + } + + public NewUserRegisteredEvent() { + } + + @Override + protected void dispatch(final NewUserRegisteredHandler handler) { + handler.onNewUserRegistered(this); + } + + @Override + public boolean equals(final Object obj) { + return super.equals(obj); + } + + @Override + public Type<NewUserRegisteredHandler> getAssociatedType() { + return TYPE; + } + + @Override + public int hashCode() { + return super.hashCode(); + } + + @Override + public String toString() { + return "NewUserRegisteredEvent[" + "]"; + } +} Modified: trunk/src/main/java/cc/kune/core/public/ws.html =================================================================== --- trunk/src/main/java/cc/kune/core/public/ws.html 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/public/ws.html 2011-07-14 08:58:16 UTC (rev 1456) @@ -58,7 +58,7 @@ <script type="text/javascript" src="/others/splash/js/gadget.js"></script> <script type="text/javascript" src="/others/splash/js/rpc.js"></script> <script type="text/javascript" src="/others/splash/js/common_client.js"></script> -<!-- <script type="text/javascript" src="/others/splash/js/permalink_client.js"></script> --> +<script type="text/javascript" src="/others/splash/js/permalink_client.js"></script> <script type="text/javascript" src="http://wave.google.com/gadgets/js/core:rpc.js?c=1"></script> <style type="text/css"> Modified: trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/init/DatabaseInitializer.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -34,7 +34,7 @@ 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.server.properties.KuneBasicProperties; import cc.kune.core.shared.domain.ContentStatus; import cc.kune.core.shared.dto.GroupType; import cc.kune.domain.Content; @@ -56,12 +56,12 @@ private final KuneWaveManager kuneWaveManager; private final I18nLanguageManager languageManager; private final LicenseManager licenseManager; - private final DatabaseProperties properties; + private final KuneBasicProperties properties; private final I18nTranslationManager translationManager; private final UserManager userManager; @Inject - public DatabaseInitializer(final DatabaseProperties properties, final UserManager userManager, + public DatabaseInitializer(final KuneBasicProperties properties, final UserManager userManager, final GroupManager groupManager, final LicenseManager licenseManager, final I18nLanguageManager languageManager, final I18nCountryManager countryManager, final I18nTranslationManager translationManager, final ContentManager contentManager, Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -40,7 +40,7 @@ import cc.kune.core.server.manager.GroupManager; import cc.kune.core.server.manager.LicenseManager; import cc.kune.core.server.manager.file.FileUtils; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import cc.kune.core.server.properties.KuneProperties; import cc.kune.core.server.tool.ServerTool; import cc.kune.core.server.tool.ServerToolRegistry; @@ -74,7 +74,7 @@ private final KuneProperties kuneProperties; private final LicenseFinder licenseFinder; private final LicenseManager licenseManager; - private final DatabaseProperties properties; + private final KuneBasicProperties properties; private final ServerToolRegistry registry; private final ServerToolRegistry serverToolRegistry; private final UserFinder userFinder; @@ -82,7 +82,7 @@ @Inject public GroupManagerDefault(final Provider<EntityManager> provider, final GroupFinder finder, final UserFinder userFinder, final KuneProperties kuneProperties, - final DatabaseProperties properties, final ServerToolRegistry registry, + final KuneBasicProperties properties, final ServerToolRegistry registry, final LicenseManager licenseManager, final LicenseFinder licenseFinder, final FileManager fileManager, final ServerToolRegistry serverToolRegistry, final I18nTranslationService i18n) { Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/LicenseManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/manager/impl/LicenseManagerDefault.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/LicenseManagerDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -25,7 +25,7 @@ import cc.kune.core.server.manager.LicenseManager; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import cc.kune.domain.License; import cc.kune.domain.finders.LicenseFinder; @@ -36,10 +36,10 @@ @Singleton public class LicenseManagerDefault extends DefaultManager<License, Long> implements LicenseManager { private LicenseFinder licenseFinder; - private final DatabaseProperties properties; + private final KuneBasicProperties properties; @Inject - public LicenseManagerDefault(final Provider<EntityManager> provider, final DatabaseProperties properties, + public LicenseManagerDefault(final Provider<EntityManager> provider, final KuneBasicProperties properties, final LicenseFinder licenseFinder) { super(provider, License.class); this.properties = properties; 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-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -45,7 +45,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.properties.KuneBasicProperties; import cc.kune.core.server.xmpp.ChatConnection; import cc.kune.core.server.xmpp.ChatException; import cc.kune.core.server.xmpp.XmppManager; @@ -69,12 +69,12 @@ 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 KuneBasicProperties properties; private final AccountStore waveAccountStore; // private final PropertiesManager propManager; private final CustomUserRegistrationServlet waveUserRegister; @@ -86,7 +86,7 @@ final XmppManager xmppManager, final ChatProperties chatProperties, final I18nTranslationService i18n, final CustomUserRegistrationServlet waveUserRegister, final AccountStore waveAccountStore, final KuneWaveManager kuneWaveManager, - final ParticipantUtils participantUtils, final DatabaseProperties databaseProperties) { + final ParticipantUtils participantUtils, final KuneBasicProperties properties) { super(provider, User.class); this.finder = finder; this.languageManager = languageManager; @@ -98,7 +98,7 @@ this.waveAccountStore = waveAccountStore; this.kuneWaveManager = kuneWaveManager; this.participantUtils = participantUtils; - this.databaseProperties = databaseProperties; + this.properties = properties; } @Override @@ -140,12 +140,19 @@ try { final User user = new User(shortName, longName, email, passwd, passwdDigest.getDigest(), passwdDigest.getSalt(), language, country, tz); - kuneWaveManager.createWave( - ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]", - databaseProperties.getDefaultSiteName()), - ContentConstants.WELCOME_WAVE_CONTENT.replaceAll("\\[%s\\]", - databaseProperties.getDefaultSiteName()), - participantUtils.of(databaseProperties.getAdminShortName()), participantUtils.of(shortName)); + + final String defWave = properties.getWelcomewave(); + if (defWave != null) { + kuneWaveManager.createWave(ContentConstants.WELCOME_WAVE_CONTENT_TITLE, "", defWave, null, + participantUtils.of(properties.getAdminShortName()), participantUtils.of(shortName)); + // kuneWaveManager.createWave( + // ContentConstants.WELCOME_WAVE_CONTENT_TITLE.replaceAll("\\[%s\\]", + // properties.getDefaultSiteName()), + // ContentConstants.WELCOME_WAVE_CONTENT.replaceAll("\\[%s\\]", + // properties.getDefaultSiteName()), + // participantUtils.of(properties.getAdminShortName()), + // participantUtils.of(shortName)); + } return user; } catch (final RuntimeException e) { try { Deleted: trunk/src/main/java/cc/kune/core/server/properties/DatabaseProperties.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/properties/DatabaseProperties.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/properties/DatabaseProperties.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -1,64 +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.properties; - -import com.google.inject.Inject; -import com.google.inject.Singleton; - -/** - * Sugar - */ -@Singleton -public class DatabaseProperties { - private final KuneProperties properties; - - @Inject - public DatabaseProperties(final KuneProperties properties) { - this.properties = properties; - } - - public String getAdminEmail() { - return properties.get(KuneProperties.SITE_ADMIN_EMAIL); - } - - public String getAdminPassword() { - return properties.get(KuneProperties.SITE_ADMIN_PASSWD); - } - - public String getAdminShortName() { - return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME); - } - - public String getAdminUserName() { - return properties.get(KuneProperties.SITE_ADMIN_NAME); - } - - public String getDefaultLicense() { - return properties.get(KuneProperties.SITE_DEF_LICENSE); - } - - public String getDefaultSiteName() { - return properties.get(KuneProperties.SITE_NAME); - } - - public String getDefaultSiteShortName() { - return properties.get(KuneProperties.SITE_SHORTNAME); - } -} Added: trunk/src/main/java/cc/kune/core/server/properties/KuneBasicProperties.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/properties/KuneBasicProperties.java (rev 0) +++ trunk/src/main/java/cc/kune/core/server/properties/KuneBasicProperties.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -0,0 +1,68 @@ +/* + * + * 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.properties; + +import com.google.inject.Inject; +import com.google.inject.Singleton; + +/** + * Sugar + */ +@Singleton +public class KuneBasicProperties { + private final KuneProperties properties; + + @Inject + public KuneBasicProperties(final KuneProperties properties) { + this.properties = properties; + } + + public String getAdminEmail() { + return properties.get(KuneProperties.SITE_ADMIN_EMAIL); + } + + public String getAdminPassword() { + return properties.get(KuneProperties.SITE_ADMIN_PASSWD); + } + + public String getAdminShortName() { + return properties.get(KuneProperties.SITE_ADMIN_SHORTNAME); + } + + public String getAdminUserName() { + return properties.get(KuneProperties.SITE_ADMIN_NAME); + } + + public String getDefaultLicense() { + return properties.get(KuneProperties.SITE_DEF_LICENSE); + } + + public String getDefaultSiteName() { + return properties.get(KuneProperties.SITE_NAME); + } + + public String getDefaultSiteShortName() { + return properties.get(KuneProperties.SITE_SHORTNAME); + } + + public String getWelcomewave() { + return properties.get(KuneProperties.WELCOME_WAVE); + } +} Modified: trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -49,6 +49,7 @@ String UPLOAD_LOCATION = "kune.upload.location"; String UPLOAD_MAX_FILE_SIZE = "kune.upload.maxfilesizeinmegas"; String UPLOAD_MAX_FILE_SIZE_IN_KS = "kune.upload.maxfilesizeinks"; + String WELCOME_WAVE = "kune.site.welcomewave"; String WS_THEMES = "kune.wsthemes"; String WS_THEMES_DEF = "kune.wsthemes.default"; Modified: trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java =================================================================== --- trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/core/server/state/StateServiceDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -107,7 +107,7 @@ state.setWaveRef(waveId); try { // FIXME if we remove the authors this fails... - final Wavelet wavelet = kuneWaveManager.fetchWavelet( + final Wavelet wavelet = kuneWaveManager.fetchWave( JavaWaverefEncoder.decodeWaveRefFromPath(waveId), content.getAuthors().get(0).getShortName()); // final String currentContent = wavelet.getRootBlip().getContent(); state.setContent(kuneWaveManager.render(wavelet)); Modified: trunk/src/main/java/cc/kune/wave/server/KuneAgent.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -19,18 +19,16 @@ */ package cc.kune.wave.server; -import java.io.IOException; import java.net.URL; import java.util.HashSet; -import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nonnull; -import org.waveprotocol.box.server.account.RobotAccountData; import org.waveprotocol.box.server.persistence.AccountStore; -import org.waveprotocol.box.server.persistence.PersistenceException; import org.waveprotocol.wave.model.id.TokenGenerator; +import org.waveprotocol.wave.model.id.WaveId; +import org.waveprotocol.wave.model.id.WaveletId; import org.waveprotocol.wave.model.wave.ParticipantId; import org.waveprotocol.wave.model.waveref.WaveRef; @@ -83,6 +81,13 @@ } @Override + public WaveRef createWave(final String title, final String message, final String waveIdToCopy, + final URL gadgetUrl, final ParticipantId... participantsArray) { + // TODO Auto-generated method stub + return null; + } + + @Override public WaveRef createWave(final String title, final String message, final URL gadgetUrl, final ParticipantId... participantsArray) { // super.newWave(getWaveDomain(), participantsArray); @@ -95,30 +100,39 @@ } @Override - public Wavelet fetchWavelet(final WaveRef waveRef, final String author) { - // Preconditions.checkNotNull(author); - RobotAccountData account = null; - final String rpcUrl = "http://" + getFrontEndAddress() + "/robot/rpc"; - try { - account = getAccountStore().getAccount( - ParticipantId.ofUnsafe(getRobotId() + "@" + getWaveDomain())).asRobot(); - } catch (final PersistenceException e) { - LOG.log(Level.WARNING, "Cannot fetch account data for robot id: " + getRobotId(), e); - } - if (account != null) { - setupOAuth(account.getId().getAddress(), account.getConsumerSecret(), rpcUrl); - try { - return super.fetchWavelet(waveRef.getWaveId(), waveRef.getWaveletId(), "http://" - + getFrontEndAddress() + "/robot/rpc"); - } catch (final IOException e) { - e.printStackTrace(); - return null; - } - } + public Wavelet fetchWave(final WaveId waveId, final WaveletId waveletId, final String author) { + // TODO Auto-generated method stub return null; } @Override + public Wavelet fetchWave(final WaveRef waveRef, final String author) { + // // Preconditions.checkNotNull(author); + // RobotAccountData account = null; + // final String rpcUrl = "http://" + getFrontEndAddress() + "/robot/rpc"; + // try { + // account = getAccountStore().getAccount( + // ParticipantId.ofUnsafe(getRobotId() + "@" + getWaveDomain())).asRobot(); + // } catch (final PersistenceException e) { + // LOG.log(Level.WARNING, "Cannot fetch account data for robot id: " + + // getRobotId(), e); + // } + // if (account != null) { + // setupOAuth(account.getId().getAddress(), account.getConsumerSecret(), + // rpcUrl); + // try { + // return super.fetchWavelet(waveRef.getWaveId(), waveRef.getWaveletId(), + // "http://" + // + getFrontEndAddress() + "/robot/rpc"); + // } catch (final IOException e) { + // e.printStackTrace(); + // return null; + // } + // } + return null; + } + + @Override public String getRobotId() { return "kune-agent"; } @@ -156,4 +170,5 @@ // TODO Auto-generated method stub } + } Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManager.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -21,6 +21,8 @@ import java.net.URL; +import org.waveprotocol.wave.model.id.WaveId; +import org.waveprotocol.wave.model.id.WaveletId; import org.waveprotocol.wave.model.wave.ParticipantId; import org.waveprotocol.wave.model.waveref.WaveRef; @@ -37,10 +39,15 @@ WaveRef createWave(String title, String message, ParticipantId... participantsArray); + WaveRef createWave(String title, String message, String waveIdToCopy, URL gadgetUrl, + ParticipantId... participantsArray); + WaveRef createWave(String title, String message, URL gadgetUrl, ParticipantId... participantsArray); - Wavelet fetchWavelet(WaveRef waveRef, String author); + Wavelet fetchWave(WaveId waveId, WaveletId waveletId, String author); + Wavelet fetchWave(WaveRef waveRef, String author); + boolean isParticipant(Wavelet wavelet, String user); String render(Wavelet wavelet); Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/wave/server/KuneWaveManagerDefault.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -39,6 +39,8 @@ import org.waveprotocol.box.server.waveserver.WaveletProvider; import org.waveprotocol.box.server.waveserver.WaveletProvider.SubmitRequestListener; import org.waveprotocol.wave.model.id.InvalidIdException; +import org.waveprotocol.wave.model.id.WaveId; +import org.waveprotocol.wave.model.id.WaveletId; import org.waveprotocol.wave.model.version.HashedVersion; import org.waveprotocol.wave.model.wave.ParticipantId; import org.waveprotocol.wave.model.waveref.WaveRef; @@ -50,8 +52,10 @@ import com.google.common.collect.Maps; import com.google.inject.Inject; import com.google.inject.name.Named; +import com.google.wave.api.Annotation; import com.google.wave.api.ApiIdSerializer; import com.google.wave.api.Blip; +import com.google.wave.api.BlipContent; import com.google.wave.api.BlipData; import com.google.wave.api.BlipThread; import com.google.wave.api.Element; @@ -62,6 +66,7 @@ import com.google.wave.api.OperationRequest; import com.google.wave.api.OperationRequest.Parameter; import com.google.wave.api.ProtocolVersion; +import com.google.wave.api.Range; import com.google.wave.api.Wavelet; import com.google.wave.api.data.converter.EventDataConverterManager; import com.google.wave.api.impl.DocumentModifyAction; @@ -81,14 +86,34 @@ private static final String NO_TITLE = ""; private static final List<String> NO_VALUES = Collections.<String> emptyList(); + private static final String NO_WAVE_TO_COPY = null; + /** + * + * Copy blips + * + * @param fromBlip + * @param toBlip + * + * @author [email protected] (Yuri Zelikov) + * + */ + public static void copyWavelet(final Blip fromBlip, final Blip toBlip) { + for (final BlipContent blipContent : fromBlip.all().values()) { + toBlip.append(blipContent); + } + for (final Annotation annotation : fromBlip.getAnnotations()) { + final Range range = annotation.getRange(); + toBlip.range(range.getStart() + 1, range.getEnd() + 1).annotate(annotation.getName(), + annotation.getValue()); + } + } private final ConversationUtil conversationUtil; private final EventDataConverterManager converterManager; private final String domain; private final OperationServiceRegistry operationRegistry; private final ParticipantUtils participantUtils; private final WaveletProvider waveletProvider; - private final WaveRenderer waveRenderer; @Inject @@ -116,7 +141,7 @@ final Gadget gadget = new Gadget(properties); elementsIn.add(gadget); - final Wavelet wavelet = fetchWavelet(waveName, author); + final Wavelet wavelet = fetchWave(waveName, author); final OperationQueue opQueue = new OperationQueue(); final Blip rootBlip = wavelet.getRootBlip(); @@ -130,7 +155,7 @@ @Override public void addParticipant(final WaveRef waveName, final String author, final String userWhoAdds, final String participant) { - final Wavelet wavelet = fetchWavelet(waveName, author); + final Wavelet wavelet = fetchWave(waveName, author); final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds : author; final OperationQueue opQueue = new OperationQueue(); @@ -151,8 +176,8 @@ } @Override - public WaveRef createWave(@Nonnull final String title, final String message, final URL gadgetUrl, - @Nonnull final ParticipantId... participantsArray) { + public WaveRef createWave(@Nonnull final String title, final String message, + final String waveIdToCopy, final URL gadgetUrl, @Nonnull final ParticipantId... participantsArray) { String newWaveId = null; String newWaveletId = null; final Set<String> participants = new HashSet<String>(); @@ -165,25 +190,23 @@ opQueue.setTitleOfWavelet(newWavelet, title); final Blip rootBlip = newWavelet.getRootBlip(); rootBlip.append(new com.google.wave.api.Markup(message).getText()); - // rootBlip.all().delete(); - // rootBlip.appendMarkup(message); - // opQueue.appendMarkupToDocument(rootBlip, - // ContentNewUnrenderer.unrender(message).toXmlString()); - // final OperationRequest modifyDocument = opQueue.modifyDocument(rootBlip); - // ImmutableList<String> of = - // ImmutableList.of(ContentNewUnrenderer.unrender(message).toXmlString()); - // rootBlip.getContent().hackConsume( - // Nindo.fromDocOp(ContentNewUnrenderer.unrender(message).asOperation(), - // false)); - // modifyDocument.addParameter(Parameter.of(ParamsProperty.MODIFY_ACTION, - // new DocumentModifyAction( - // ModifyHow.REPLACE, - // ImmutableList.of(ContentNewUnrenderer.unrender(message).toXmlString()), - // null, - // null, null, false))); - // NO_ANNOTATION_KEY, NO_ELEMENTS, NO_BUNDLED_ANNOTATIONS, false))); - // rootBlip.appendMarkup(message); + if (waveIdToCopy != NO_WAVE_TO_COPY) { + try { + WaveId copyWaveId; + copyWaveId = WaveId.ofChecked(domain, waveIdToCopy); + final Wavelet waveletToCopy = fetchWave(copyWaveId, WaveletId.of(domain, "conv+root"), + participantsArray[0].toString()); + if (waveletToCopy != null) { + copyWavelet(waveletToCopy.getRootBlip(), rootBlip); + } + } catch (final InvalidIdException e) { + LOG.error("Error copying wave content", e); + } catch (final DefaultException e2) { + LOG.error("Error copying wave content", e2); + } + } + if (gadgetUrl != WITHOUT_GADGET) { final Gadget gadget = new Gadget(gadgetUrl.toString()); rootBlip.append(gadget); @@ -233,6 +256,12 @@ return wavename; } + @Override + public WaveRef createWave(@Nonnull final String title, final String message, final URL gadgetUrl, + @Nonnull final ParticipantId... participantsArray) { + return createWave(title, message, NO_WAVE_TO_COPY, gadgetUrl, participantsArray); + } + private void doOperation(final String author, final OperationQueue opQueue, final String logComment) { final OperationContextImpl context = new OperationContextImpl(waveletProvider, converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil); @@ -267,10 +296,10 @@ } @Override - public Wavelet fetchWavelet(final WaveRef waveName, final String author) { + public Wavelet fetchWave(final WaveId waveId, final WaveletId waveletId, final String author) { + final OperationQueue opQueue = new OperationQueue(); + opQueue.fetchWavelet(waveId, waveletId); Wavelet wavelet = null; - final OperationQueue opQueue = new OperationQueue(); - opQueue.fetchWavelet(waveName.getWaveId(), waveName.getWaveletId()); final OperationContextImpl context = new OperationContextImpl(waveletProvider, converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil); final OperationRequest request = opQueue.getPendingOperations().get(0); @@ -308,6 +337,13 @@ } @Override + public Wavelet fetchWave(final WaveRef waveName, final String author) { + final WaveId waveId = waveName.getWaveId(); + final WaveletId waveletId = waveName.getWaveletId(); + return fetchWave(waveId, waveletId, author); + } + + @Override public boolean isParticipant(final Wavelet wavelet, final String user) { return wavelet.getParticipants().contains(participantUtils.of(user).toString()); } @@ -326,14 +362,15 @@ @Override public String render(final WaveRef waveRef, final String author) { - return render(fetchWavelet(waveRef, author)); + return render(fetchWave(waveRef, author)); } @Override public void setTitle(final WaveRef waveName, final String title, final String author) { - final Wavelet wavelet = fetchWavelet(waveName, author); + final Wavelet wavelet = fetchWave(waveName, author); final OperationQueue opQueue = new OperationQueue(); opQueue.setTitleOfWavelet(wavelet, title); doOperation(author, opQueue, "set title"); } + } Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java =================================================================== --- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -24,7 +24,7 @@ import org.waveprotocol.wave.model.wave.ParticipantId; import cc.kune.core.client.errors.DefaultException; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import com.google.inject.Inject; import com.google.inject.Singleton; @@ -38,7 +38,7 @@ @Inject public ParticipantUtils(@Named(CoreSettings.WAVE_SERVER_DOMAIN) final String domain, - final DatabaseProperties databaseProperties) throws InvalidParticipantAddress { + final KuneBasicProperties databaseProperties) throws InvalidParticipantAddress { this.domain = domain; superAdmin = ofImpl(databaseProperties.getAdminShortName()); } Modified: trunk/src/main/resources/kune.properties =================================================================== --- trunk/src/main/resources/kune.properties 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/resources/kune.properties 2011-07-14 08:58:16 UTC (rev 1456) @@ -32,6 +32,11 @@ kune.chat.domain = localhost kune.chat.roomHost = rooms.localhost +### Other params + +# If defined create a copy of this wave as welcome to new users +kune.site.welcomewave = w+rtackLTkDCA + ### Workspace enabled themes # This names are also the name of the items in the theme menu and there are translated Modified: trunk/src/main/webapp/others/splash/js/permalink_client.js =================================================================== --- trunk/src/main/webapp/others/splash/js/permalink_client.js 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/webapp/others/splash/js/permalink_client.js 2011-07-14 08:58:16 UTC (rev 1456) @@ -29,8 +29,9 @@ * Application entry point. */ $(document).ready(function() { + /* var path = window.location.pathname; - + // adjust the height of the content frame to fill the iframe height $("#contentInner3") .css("height", 0) @@ -95,6 +96,7 @@ var rpc = window.wave.Rpc.getInstance(); + */ initGadgetSystem(); // rpc.rpcOpenWave(); Modified: trunk/src/main/webapp/others/splash/js/rpc.js =================================================================== --- trunk/src/main/webapp/others/splash/js/rpc.js 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/main/webapp/others/splash/js/rpc.js 2011-07-14 08:58:16 UTC (rev 1456) @@ -145,7 +145,7 @@ dirtyRef.removeClass('content-dirty'); requestId++; } - + // Finally, clear all pending edits. this.pendingEdits_.length = 0; }; @@ -465,7 +465,7 @@ */ wave.Rpc.prototype.rpcAsyncUpdate = function() { this.dataView_.addPendingEdits(); - this.rpc_(wave.Rpc.ASYNC_UPDATE_URL_); + // this.rpc_(wave.Rpc.ASYNC_UPDATE_URL_); this.dataView_.clearPendingEdits(); }; Modified: trunk/src/test/java/cc/kune/core/server/finders/LicenseFinderTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/finders/LicenseFinderTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/cc/kune/core/server/finders/LicenseFinderTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -29,7 +29,7 @@ import org.junit.Test; import cc.kune.core.server.PersistenceTest; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import cc.kune.domain.License; import cc.kune.domain.finders.LicenseFinder; @@ -42,7 +42,7 @@ private License license2; private License licenseDef; @Inject - DatabaseProperties properties; + KuneBasicProperties properties; @Before public void addData() { Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -27,14 +27,14 @@ import cc.kune.core.client.errors.DefaultException; import cc.kune.core.client.rpcservices.UserService; import cc.kune.core.server.UserSession; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import com.google.inject.Inject; public abstract class IntegrationTest { @Inject - DatabaseProperties properties; + KuneBasicProperties properties; @Inject protected UserSession session; protected String token; Modified: trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java =================================================================== --- trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -36,7 +36,7 @@ import cc.kune.core.server.integration.IntegrationTestHelper; import cc.kune.core.server.manager.I18nLanguageManager; import cc.kune.core.server.mapper.Mapper; -import cc.kune.core.server.properties.DatabaseProperties; +import cc.kune.core.server.properties.KuneBasicProperties; import cc.kune.core.server.rpc.SocialNetworkRPC; import cc.kune.core.server.users.UserInfo; import cc.kune.core.server.users.UserInfoService; @@ -62,7 +62,7 @@ @Inject Mapper mapper; @Inject - DatabaseProperties properties; + KuneBasicProperties properties; @Inject SocialNetworkRPC sn; private TimeZoneDTO timezone; Modified: trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java =================================================================== --- trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -82,7 +82,7 @@ final WaveRef waveletName = manager.createWave(RICHTEXT_MESSAGE, ParticipantId.of(getSiteAdminShortName())); assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getAnnotations().size() > 0); assertEquals("", fetchWavelet.getRootBlip().getContent()); Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java =================================================================== --- trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/cc/kune/wave/server/KuneWaveManagerDefaultTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -63,7 +63,7 @@ final WaveRef waveletName = createTestWave(); assertNotNull(waveletName); manager.addParticipant(waveletName, getSiteAdminShortName(), whoAdds, NEW_PARTICIPANT); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertEquals(2, fetchWavelet.getParticipants().size()); manager.isParticipant(fetchWavelet, NEW_PARTICIPANT); @@ -91,7 +91,7 @@ final WaveRef waveletName = manager.createWave(RICHTEXT_MESSAGE, participantUtils.of(getSiteAdminShortName())); assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getAnnotations().size() > 0); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); @@ -103,7 +103,7 @@ final WaveRef waveletName = manager.createWave(TITLE, RICHTEXT_MESSAGE, new URL(TEST_GADGET), participantUtils.of(getSiteAdminShortName())); assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); } @@ -113,7 +113,7 @@ doLogin(); final WaveRef waveletName = createTestWave(); assertNotNull(waveletName); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); assertEquals(TITLE, fetchWavelet.getTitle()); @@ -138,7 +138,7 @@ final WaveRef waveletName = createTestWave(); assertNotNull(waveletName); manager.setTitle(waveletName, TITLENEW, getSiteAdminShortName()); - final Wavelet fetchWavelet = manager.fetchWavelet(waveletName, getSiteAdminShortName()); + final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName()); assertNotNull(fetchWavelet); assertTrue(fetchWavelet.getRootBlip().getContent().contains(MESSAGE)); assertEquals(TITLENEW, fetchWavelet.getTitle()); Modified: trunk/src/test/java/com/google/wave/splash/text/ContentNewUnrendererTest.java =================================================================== --- trunk/src/test/java/com/google/wave/splash/text/ContentNewUnrendererTest.java 2011-07-13 16:52:07 UTC (rev 1455) +++ trunk/src/test/java/com/google/wave/splash/text/ContentNewUnrendererTest.java 2011-07-14 08:58:16 UTC (rev 1456) @@ -21,28 +21,73 @@ import org.junit.Ignore; import org.junit.Test; -import org.waveprotocol.wave.client.editor.content.CMutableDocument; -import org.waveprotocol.wave.client.editor.content.ContentDocument; import org.waveprotocol.wave.model.document.indexed.IndexedDocument; -import org.waveprotocol.wave.model.document.operation.Nindo; +import org.waveprotocol.wave.model.document.operation.DocInitialization; import org.waveprotocol.wave.model.document.raw.impl.Element; import org.waveprotocol.wave.model.document.raw.impl.Node; import org.waveprotocol.wave.model.document.raw.impl.Text; -import org.waveprotocol.wave.model.document.util.DocProviders; -import org.waveprotocol.wave.model.operation.OperationSequencer; +import org.waveprotocol.wave.model.id.IdURIEncoderDecoder; +import org.waveprotocol.wave.model.id.WaveId; +import org.waveprotocol.wave.model.id.WaveletId; +import org.waveprotocol.wave.model.version.HashedVersionFactory; +import org.waveprotocol.wave.model.version.HashedVersionZeroFactoryImpl; +import org.waveprotocol.wave.model.wave.Blip; +import org.waveprotocol.wave.model.wave.ParticipantId; +import org.waveprotocol.wave.util.escapers.jvm.JavaUrlCodec; public class ContentNewUnrendererTest { + private static final IdURIEncoderDecoder CODEC_URI = new IdURIEncoderDecoder(new JavaUrlCodec()); + private static final ParticipantId CREATOR = ParticipantId.ofUnsafe("[email protected]"); + private static final HashedVersionFactory HASH_FACTORY = new HashedVersionZeroFactoryImpl(CODEC_URI); @Ignore @Test public void testBasicUnrender() { - final IndexedDocument<Node, Element, Text> result = ContentNewUnrenderer.unrender("<b>Some <em>bold</em></b>"); // final UnrenderedBlip result = // ContentUnrenderer.unrender("<p></p><p><b>Some <em>bold</em></b></p>"); // assertEquals("", result.elements.toString()); - final OperationSequencer<Nindo> sequencer = DocProviders.createCopyingSequencer(result); - final CMutableDocument mutable = new ContentDocument(null).createSequencedDocumentWrapper(sequencer); + // final OperationSequencer<Nindo> sequencer = + // DocProviders.createCopyingSequencer(result); + // final CMutableDocument mutable = new + // ContentDocument(null).createSequencedDocumentWrapper(sequencer); + + final IndexedDocument<Node, Element, Text> result = ContentNewUnrenderer.unrender("<b>Some <em>bold</em></b>"); + final DocInitialization content = result.asOperation(); + + final WaveId waveId; + final WaveletId waveletId; + // Of just created wave + // final WaveletName waveletName = WaveletName.of(waveId, waveletId); + + // final HashedVersionFactory hashFactory = + // injector.getInstance(HashedVersionFactory.class); + // final ObservableWaveletData waveletData = + // WaveletDataUtil.createEmptyWavelet(waveletName, CREATOR, + // HASH_FACTORY.createVersionZero(waveletName), System.currentTimeMillis()); + + // final String id = "b+example"; + // // idGenerator.newBlipId() o blipId + // final BlipData blipData = waveletData.createDocument(id, CREATOR, + // Collections.singletonList(CREATOR), content, System.currentTimeMillis(), + // 0); + + final Blip rootBlipId; + + // final OperationRequest operation = + // operationRequest(OperationType.BLIP_CONTINUE_THREAD, rootBlipId, + // Parameter.of(ParamsProperty.BLIP_DATA, blipData)); + + // final WaveletName waveletName; + // final ParticipantId participant = + // ParticipantId.of("someone@localdomain"); + // final HashedVersion hashedVersionZero + // = hashedVersionFactory.createVersionZero(waveletName); + // final ObservableWaveletData createEmptyWavelet = + // WaveletDataUtil.createEmptyWavelet(waveletName, + // participant, hashedVersionZero, System.currentTimeMillis()); + // WaveletDataUtil. + // WaveletDataUtil.createEmptyWavelet(null, null, null, 0) } }
participants (1)
-
Vicente J. Ruiz Jurado