[kune-commits] r934 - in trunk: . src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/client/ui/dialogs src/main/java/org/ourproject/kune/workspace/client/entitylogo src/main/java/org/ourproject/kune/workspace/client/licensechoose src/main/java/org/ourproject/kune/workspace/client/newgroup src/test/java/org/ourproject/kune/platf/integration/selenium

vjrj vjrj at ourproject.org
Tue Oct 28 16:40:30 CET 2008


Author: vjrj
Date: 2008-10-28 16:40:27 +0100 (Tue, 28 Oct 2008)
New Revision: 934

Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/CustomButton.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/TwoButtonsDialog.java
Modified:
   trunk/TODO
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java
Log:
Incomplete - task New Group dialog refactorization 


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/TODO	2008-10-28 15:40:27 UTC (rev 934)
@@ -36,7 +36,6 @@
 http://extjs.com/forum/showthread.php?t=9659
 http://cssjanus.commoner.com/
 <vjrj> Study the possibility to include in SN something similar to "Member since <date>".
-<vjrj> upgrade warp-persist to 1.0
 <samer,vjrj> Add in license choose a free/non-free indicator [3]
 <vjrj> think about more secure login, SRP protocol thread, and:
 http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/97623347b448e16e
@@ -347,4 +346,21 @@
 >       de hecho a los flipados de la licencia de ayer a lo mejor habría
 >       que comentarles esto. ¿Opiniones?
 
+Propuesta:
+------
+Selecciona una licencia para compartir los contenidos de este grupo con el resto de gente:
+
+[X] Usar la licencia <href>copyleft recomendada
+[ ] Quiero elegir otra licencia (uso avanzado) 
+
+Notas:
+* <href>¿Porqué necesito una licencia?
+* <href>¿Qué significa copyleft?
+* Nosotros recomendamos licencias copyleft, sobre todo para trabajos prácticos.
+
+------
+
+esta última sacaría el widget actual con alguna nota adicional, como
+<href>Porque no usar una licencia no comercial.
+
 [?] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/pom.xml	2008-10-28 15:40:27 UTC (rev 934)
@@ -158,7 +158,7 @@
     <dependency>
       <groupId>com.wideplay</groupId>
       <artifactId>warp-persist</artifactId>
-      <version>0.6</version>
+      <version>1.0.1</version>
     </dependency>
 
     <!-- REST: xml and json (stax) -->

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/CustomButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/CustomButton.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/CustomButton.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -1,106 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.ClickListenerCollection;
-import com.google.gwt.user.client.ui.SourcesClickEvents;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
-public class CustomButton implements SourcesClickEvents {
-
-    private ClickListenerCollection clickListeners;
-    private final Button button;
-
-    public CustomButton(final String text) {
-        this(text, null);
-    }
-
-    public CustomButton(final String text, final ClickListener listener) {
-        button = new Button();
-        button.setText(text);
-        button.addListener(new ButtonListenerAdapter() {
-            public void onClick(final Button button, final EventObject e) {
-                fireClickListeners();
-            }
-        });
-        if (listener != null) {
-            addClickListener(listener);
-        }
-    }
-
-    public void addClickListener(final ClickListener listener) {
-        if (clickListeners == null) {
-            clickListeners = new ClickListenerCollection();
-        }
-        clickListeners.add(listener);
-    }
-
-    public void removeClickListener(final ClickListener listener) {
-        if (clickListeners != null) {
-            clickListeners.remove(listener);
-        }
-
-    }
-
-    public Button getButton() {
-        return button;
-    }
-
-    public boolean isEnabled() {
-        return !button.isDisabled();
-    }
-
-    private void fireClickListeners() {
-        if (clickListeners != null) {
-            clickListeners.fireClick(button);
-        }
-    }
-
-    public void setEnabled(final boolean enabled) {
-        if (enabled) {
-            button.enable();
-        } else {
-            button.disable();
-        }
-    }
-
-    public void setText(final String text) {
-        button.setText(text);
-    }
-
-    public void setVisible(final boolean b) {
-        button.setVisible(b);
-    }
-
-    public void setHeight(final String height) {
-        button.setHeight(height);
-    }
-
-    public void setWidth(final String width) {
-        button.setWidth(width);
-    }
-
-    public void addStyleName(final String style) {
-        button.addStyleName(style);
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/TwoButtonsDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/TwoButtonsDialog.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/TwoButtonsDialog.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -1,88 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.platf.client.ui.dialogs;
-
-import org.ourproject.kune.platf.client.ui.CustomButton;
-import org.ourproject.kune.platf.client.ui.form.FormListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.widgets.Window;
-
-public class TwoButtonsDialog {
-
-    private final Window dialog;
-
-    public TwoButtonsDialog(final String caption, final String firstButton, final String secondButton,
-            final boolean modal, final boolean minimizable, final int width, final int height,
-            final FormListener listener) {
-        this(caption, firstButton, secondButton, modal, minimizable, width, height, width, height, listener);
-
-    }
-
-    public TwoButtonsDialog(final String caption, final String firstButton, final String secondButton,
-            final boolean modal, final boolean minimizable, final int width, final int height, final int minWidth,
-            final int minHeight, final FormListener listener) {
-
-        dialog = new Window();
-
-        // Param values
-        dialog.setTitle(caption);
-        dialog.setModal(modal);
-        dialog.setWidth(width);
-        dialog.setHeight(height);
-        dialog.setMinWidth(minWidth);
-        dialog.setMinHeight(minHeight);
-        dialog.setCollapsible(minimizable);
-
-        // Def values
-        dialog.setShadow(true);
-
-        dialog.addButton(new CustomButton(firstButton, new ClickListener() {
-            public void onClick(final Widget sender) {
-                listener.onAccept();
-            }
-        }).getButton());
-
-        CustomButton button = new CustomButton(secondButton, new ClickListener() {
-            public void onClick(final Widget sender) {
-                listener.onCancel();
-            }
-        });
-        dialog.addButton(button.getButton());
-
-    }
-
-    public void add(final Widget widget) {
-        dialog.add(widget);
-    }
-
-    public void center() {
-        dialog.center();
-    }
-
-    public void hide() {
-        dialog.hide();
-    }
-
-    public void show() {
-        dialog.show();
-    }
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -20,13 +20,13 @@
 package org.ourproject.kune.platf.client.ui.dialogs;
 
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.CustomButton;
 
-import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Widget;
+import com.gwtext.client.core.EventObject;
 import com.gwtext.client.widgets.Button;
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.Toolbar;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
 import com.gwtext.client.widgets.event.WindowListenerAdapter;
 
 public class WizardDialog {
@@ -51,35 +51,39 @@
         dialog.setResizable(false);
         dialog.setId(dialogId);
 
-        backButton = new CustomButton(i18n.tWithNT("« Back", "used in button"), new ClickListener() {
-            public void onClick(final Widget sender) {
+        backButton = new Button(i18n.tWithNT("« Back", "used in button"), new ButtonListenerAdapter() {
+            @Override
+            public void onClick(Button button, EventObject e) {
                 listener.onBack();
             }
-        }).getButton();
+        });
         backButton.setId(backId);
         dialog.addButton(backButton);
 
-        nextButton = new CustomButton(i18n.tWithNT("Next »", "used in button"), new ClickListener() {
-            public void onClick(final Widget sender) {
+        nextButton = new Button(i18n.tWithNT("Next »", "used in button"), new ButtonListenerAdapter() {
+            @Override
+            public void onClick(Button button, EventObject e) {
                 listener.onNext();
             }
-        }).getButton();
+        });
         nextButton.setId(nextId);
         dialog.addButton(nextButton);
 
-        cancelButton = new CustomButton(i18n.tWithNT("Cancel", "used in button"), new ClickListener() {
-            public void onClick(final Widget sender) {
+        cancelButton = new Button(i18n.tWithNT("Cancel", "used in button"), new ButtonListenerAdapter() {
+            @Override
+            public void onClick(Button button, EventObject e) {
                 listener.onCancel();
             }
-        }).getButton();
+        });
         cancelButton.setId(cancelId);
         dialog.addButton(cancelButton);
 
-        finishButton = new CustomButton(i18n.tWithNT("Finish", "used in button"), new ClickListener() {
-            public void onClick(final Widget sender) {
+        finishButton = new Button(i18n.tWithNT("Finish", "used in button"), new ButtonListenerAdapter() {
+            @Override
+            public void onClick(Button button, EventObject e) {
                 listener.onFinish();
             }
-        }).getButton();
+        });
         finishButton.setId(finishId);
         dialog.addButton(finishButton);
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoSelectorPanel.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -50,7 +50,7 @@
 
     public EntityLogoSelectorPanel(final EntityLogoSelectorPresenter presenter, final WorkspaceSkeleton ws,
             I18nTranslationService i18n) {
-        dialog = new BasicDialogExtended(i18n.t("Select an logo for your group"), true, true, 320, 180, "",
+        dialog = new BasicDialogExtended(i18n.t("Select a logo for your group"), true, true, 400, 200, "",
                 i18n.t("Select"), SUBID, i18n.tWithNT("Cancel", "used in button"), CANCELID, new Listener0() {
                     public void onEvent() {
                         String filename = file.getValueAsString();
@@ -65,14 +65,14 @@
                 });
         dialog.setCollapsible(false);
         dialog.setBorder(false);
-        //dialog.getFirstButton().disable();
+        // dialog.getFirstButton().disable();
 
         formPanel = new FormPanel();
         formPanel.setFrame(true);
         formPanel.setAutoScroll(false);
         formPanel.setBorder(false);
         formPanel.setFileUpload(true);
-        formPanel.setWidth(320);
+        formPanel.setWidth(400);
         formPanel.setMethod(Connection.POST);
         formPanel.setUrl(ICON_UPLOAD_SERVLET);
         formPanel.setWaitMsgTarget(true);
@@ -93,10 +93,15 @@
                 presenter.onSubmitFailed(httpStatus, responseText);
             }
         });
+        // We will automatically resize images to 64x64 pixels. For good
+        // results, start with a square image. For best results, use a 64x64
+        // pixel image.
+        String text = i18n.t("Select an image in your computer as the logo for this group. "
+                + "For best results use a [%d]x[%d] pixel image. We will automatically resize bigger images.",
+                EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT);
+        Label label = new Label();
+        label.setHtml(text + "<br/><br/>");
 
-        Label label = new Label(i18n.t(
-                "Select an image in your computer as the logo for this group. Recomended size [%d]x[%d] pixels",
-                EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT, EntityLogoView.LOGO_ICON_DEFAULT_HEIGHT));
         formPanel.add(label);
         file = new TextField("File", EntityLogoView.LOGO_FORM_FIELD);
         EventCallback keyListener = new EventCallback() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -42,6 +42,7 @@
 
     protected static final String CC_LIC_FIELD = "cc-lic";
     protected static final String OTHER_LIC_FIELD = "other-lic";
+    private static final String BIG_FIELD_WIDTH = "280";
 
     private final RadioButton ccRB;
     private final RadioButton allowModifRB;
@@ -94,6 +95,7 @@
         // Options
 
         optionsBox = new TitledPanel(i18n.t("Options"), options);
+        optionsBox.setWidth(BIG_FIELD_WIDTH);
         generalVP.add(optionsBox);
         generalVP.add(nonCopyleft);
         generalVP.add(copyleft);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -58,7 +58,7 @@
     public static final String PROJ_GROUP_TYPE_ID = "k-ngp-type_of_group_proj";
     public static final String ORG_GROUP_TYPE_ID = "k-ngp-type_of_group_org";
     public static final String COMM_GROUP_TYPE_ID = "k-ngp-type_of_group_comm";
-    public static final String TAGS_FIELD = "tags";
+    public static final String TAGS_FIELD = "k-ngp-tags";
     public static final String NEWGROUP_WIZARD = "k-ngp-wiz";
     public static final String CANCEL_BUTTON = "k-ngp-cancel-bt";
     public static final String CLOSE_BUTTON = "k-ngp-close-bt";
@@ -66,6 +66,7 @@
     public static final String NEXT_BUTTON = "k-ngp-next-bt";
     public static final String BACK_BUTTON = "k-ngp-back-bt";
     public static final String ERROR_MSG_BAR = "k-ngp-error-mb";
+    private static final int BIG_FIELD_WIDTH = 280;
 
     private final FormPanel newGroupInitialDataForm;
     private Radio projectRadio;
@@ -83,7 +84,7 @@
 
     public NewGroupPanel(final NewGroupPresenter presenter, final I18nUITranslationService i18n,
             final Provider<LicenseChoose> licenseChooseProvider, Images img) {
-        super(i18n.t(REGISTER_A_NEW_GROUP_TITLE), true, false, 460, 480, new WizardListener() {
+        super(i18n.t(REGISTER_A_NEW_GROUP_TITLE), true, false, 460, 430, new WizardListener() {
             public void onBack() {
                 presenter.onBack();
             }
@@ -242,7 +243,7 @@
         longNameField = new TextField();
         longNameField.setFieldLabel(i18n.t("Long name"));
         longNameField.setName(LONGNAME_FIELD);
-        longNameField.setWidth(300);
+        longNameField.setWidth(BIG_FIELD_WIDTH);
         longNameField.setAllowBlank(false);
 
         longNameField.setMinLength(3);
@@ -253,7 +254,7 @@
         publicDescField = new TextArea();
         publicDescField.setFieldLabel(i18n.t("Public description"));
         publicDescField.setName(PUBLICDESC_FIELD);
-        publicDescField.setWidth(300);
+        publicDescField.setWidth(BIG_FIELD_WIDTH);
         publicDescField.setAllowBlank(false);
         publicDescField.setMinLength(10);
         publicDescField.setMaxLength(255);
@@ -263,7 +264,7 @@
         tags = new TextField();
         tags.setFieldLabel(i18n.t("Group tags"));
         tags.setName(TAGS_FIELD);
-        tags.setWidth(300);
+        tags.setWidth(BIG_FIELD_WIDTH);
         tags.setAllowBlank(false);
         final ToolTip fieldToolTip = new ToolTip(i18n.t("Some words related to this group (separated with spaces)."));
         fieldToolTip.applyTo(tags);
@@ -272,7 +273,7 @@
 
         final FieldSet groupTypeFieldSet = new FieldSet(i18n.t("Type of group"));
         groupTypeFieldSet.setStyle("margin-left: 105px");
-        groupTypeFieldSet.setWidth(300);
+        groupTypeFieldSet.setWidth(BIG_FIELD_WIDTH);
 
         form.add(groupTypeFieldSet);
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -39,6 +39,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class NewGroupPresenter implements NewGroup {
+    public static final String NAME_IN_ALREADY_IN_USE = "This name in already in use, try with a different name.";
     public static final String REGISTER_TO_CREATE_A_GROUP = "Sign in or register to create a group";
     private NewGroupView view;
     private final I18nTranslationService i18n;
@@ -119,7 +120,7 @@
                 } catch (final GroupNameInUseException e) {
                     onBack();
                     view.unMask();
-                    setMessage(i18n.t("This name in already in use, try with a different name."), SiteErrorType.error);
+                    setMessage(i18n.t(NAME_IN_ALREADY_IN_USE), SiteErrorType.error);
                 } catch (final Throwable e) {
                     onBack(); // The messageP is in first page of wizard :-/
                     view.unMask();

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -13,6 +13,8 @@
 import org.ourproject.kune.workspace.client.sitebar.siteusermenu.SiteUserMenuPanel;
 import org.ourproject.kune.workspace.client.title.EntityTitlePanel;
 
+import com.thoughtworks.selenium.SeleniumException;
+
 public class KuneSeleniumTestHelper extends SeleniumTestHelper {
 
     protected static final String KUNE_BASE_URL = "/kune/?locale=en#";
@@ -23,12 +25,32 @@
         selenium.refresh();
     }
 
+    protected long genPrefix() {
+        long prefix = new Date().getTime();
+        return prefix;
+    }
+
     protected void ifLoggedSigOut() {
         if (selenium.getText(gid(SiteSignOutLinkPanel.SITE_SIGN_OUT)).indexOf("admin") > 0) {
             signOut();
         }
     }
 
+    protected void open(SiteToken token) {
+        open(KUNE_BASE_URL + token.toString());
+    }
+
+    @Override
+    protected void open(String url) {
+        try {
+            selenium.setTimeout("0");
+            super.open(url);
+            selenium.setTimeout("30");
+        } catch (SeleniumException e) {
+            // TODO Auto-generated method stub
+        }
+    }
+
     protected void openDefPage() throws Exception {
         open("/kune/?locale=en#site");
         waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
@@ -66,6 +88,13 @@
         click(RegisterPanel.REGISTER_BUTTON_ID);
     }
 
+    protected String registerValidUser(boolean wantHomepage) {
+        String shortName = "u" + genPrefix();
+        register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
+                "Andorra", "English", "MET", wantHomepage);
+        return shortName;
+    }
+
     protected void signIn() {
         signIn("admin", "easyeasy");
     }
@@ -84,20 +113,4 @@
     protected void verifyLoggedUserShorName(String userShortName) throws Exception {
         waitForTextInside(gid(SiteUserMenuPanel.LOGGED_USER_MENU), userShortName);
     }
-
-    protected long genPrefix() {
-        long prefix = new Date().getTime();
-        return prefix;
-    }
-
-    protected void open(SiteToken token) {
-        open(KUNE_BASE_URL + token.toString());
-    }
-
-    protected String registerValidUser(boolean wantHomepage) {
-        String shortName = "u" + genPrefix();
-        register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
-                "Andorra", "English", "MET", wantHomepage);
-        return shortName;
-    }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java	2008-10-27 21:53:19 UTC (rev 933)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java	2008-10-28 15:40:27 UTC (rev 934)
@@ -2,7 +2,9 @@
 
 import static org.junit.Assert.assertFalse;
 
+import org.junit.Ignore;
 import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel;
 import org.ourproject.kune.workspace.client.newgroup.NewGroupPresenter;
 import org.ourproject.kune.workspace.client.site.SiteToken;
@@ -12,28 +14,60 @@
 
     @Test
     public void newGroupBasic() throws Exception {
-        setMustStopFinally(false);
         assertFalse(selenium.isTextPresent(NewGroupPanel.NEWGROUP_WIZARD));
-        openDefPage();
-        signIn();
-        selenium.refresh();
+        signInAndNewGroup();
+        click(NewGroupPanel.CANCEL_BUTTON);
+        assertFalse(selenium.isTextPresent(NewGroupPanel.NEWGROUP_WIZARD));
         open(SiteToken.newgroup);
-        verifyLoggedUserShorName("admin");
         waitForTextInside(NewGroupPanel.NEWGROUP_WIZARD, NewGroupPanel.REGISTER_A_NEW_GROUP_TITLE);
     }
 
     @Test
     public void newGroupNotLogged() throws Exception {
-        setMustStopFinally(false);
         assertFalse(selenium.isTextPresent(NewGroupPanel.NEWGROUP_WIZARD));
         open(SiteToken.newgroup);
         waitForTextInside(SiteToastMessagePanel.MESSAGE, NewGroupPresenter.REGISTER_TO_CREATE_A_GROUP);
     }
 
-    @Test
-    public void newGroupWithExistingNicknameFails() {
-        open(SiteToken.newgroup);
+    @Ignore
+    public void newGroupWithExistingNicknameFails() throws Exception {
+        setMustStopFinally(false);
+        signInAndNewGroup();
+        fillNewGroup1stPage("admin", "some long name" + genPrefix(), "some public description", "tag1 tag2 tag3",
+                GroupType.ORGANIZATION);
+        click(NewGroupPanel.NEXT_BUTTON);
+        click(NewGroupPanel.FINISH_BUTTON);
+        waitForTextInside(NewGroupPanel.ERROR_MSG_BAR, NewGroupPresenter.NAME_IN_ALREADY_IN_USE);
+    }
 
+    private void fillNewGroup1stPage(String shortname, String longName, String description, String tags,
+            GroupType groupType) throws Exception {
+        type(NewGroupPanel.SHORTNAME_FIELD, shortname);
+        type(NewGroupPanel.LONGNAME_FIELD, longName);
+        type(NewGroupPanel.PUBLICDESC_FIELD, description);
+        type(NewGroupPanel.TAGS_FIELD, tags);
+        switch (groupType) {
+        case COMMUNITY:
+            click(NewGroupPanel.COMM_GROUP_TYPE_ID);
+            break;
+        case ORGANIZATION:
+            click(NewGroupPanel.ORG_GROUP_TYPE_ID);
+            break;
+        case PROJECT:
+            click(NewGroupPanel.PROJ_GROUP_TYPE_ID);
+            break;
+        default:
+            fail("Invalid group type");
+            break;
+        }
     }
 
+    private void signInAndNewGroup() throws Exception {
+        openDefPage();
+        signIn();
+        open(SiteToken.newgroup);
+        verifyLoggedUserShorName("admin");
+        waitForTextInside(NewGroupPanel.NEWGROUP_WIZARD, NewGroupPanel.REGISTER_A_NEW_GROUP_TITLE);
+    }
+
 }




More information about the kune-commits mailing list