[kune-commits] r976 - in trunk/src: main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/server/access main/java/org/ourproject/kune/platf/server/auth main/java/org/ourproject/kune/platf/server/content main/java/org/ourproject/kune/platf/server/init main/java/org/ourproject/kune/platf/server/manager/file main/java/org/ourproject/kune/platf/server/rpc main/java/org/ourproject/kune/wiki/server main/java/org/ourproject/kune/workspace/client/options main/java/org/ourproject/kune/workspace/client/title test/java/org/ourproject/kune/platf/integration test/java/org/ourproject/kune/platf/integration/content test/java/org/ourproject/kune/platf/integration/selenium

vjrj vjrj at ourproject.org
Tue Dec 2 01:42:45 CET 2008


Author: vjrj
Date: 2008-12-02 01:42:41 +0100 (Tue, 02 Dec 2008)
New Revision: 976

Added:
   trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/ContentAddSeleniumTest.java
Modified:
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java
   trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
   trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
   trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.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:
Complete - task Wiki editing by other users (not admins/editors) 


Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -28,6 +28,7 @@
 import org.ourproject.kune.platf.client.actions.toolbar.ActionParticipationToolbar;
 import org.ourproject.kune.platf.client.app.ApplicationComponentGroup;
 import org.ourproject.kune.platf.client.app.EntityOptionsGroup;
+import org.ourproject.kune.platf.client.registry.AuthorableRegistry;
 import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry;
 import org.ourproject.kune.platf.client.registry.RenamableRegistry;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
@@ -293,7 +294,8 @@
             @Override
             public EntitySubTitle create() {
                 final EntitySubTitlePresenter presenter = new EntitySubTitlePresenter(
-                        $(I18nUITranslationService.class), $(StateManager.class), $(Session.class), false);
+                        $(I18nUITranslationService.class), $(StateManager.class), $(Session.class), false,
+                        $(AuthorableRegistry.class));
                 final EntitySubTitlePanel panel = new EntitySubTitlePanel(presenter, $(WorkspaceSkeleton.class));
                 presenter.init(panel);
                 return presenter;

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessServiceDefault.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -21,6 +21,7 @@
 
 import org.ourproject.kune.platf.client.errors.AccessViolationException;
 import org.ourproject.kune.platf.client.errors.DefaultException;
+import org.ourproject.kune.platf.server.domain.AccessLists;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.User;
@@ -50,7 +51,8 @@
     public Content accessToContent(final Long contentId, final User user, final AccessRol accessRol)
             throws DefaultException {
         final Content content = finder.getContent(contentId);
-        check(accessRightsService.get(user, content.getAccessLists()), accessRol);
+        AccessLists accessLists = content.getAccessLists();
+        check(accessRightsService.get(user, accessLists), accessRol);
         return content;
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/Authorizated.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -48,4 +48,6 @@
      */
     ActionLevel actionLevel() default ActionLevel.content;
 
+    boolean mustCheckMembership() default true;
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthorizatedMethodInterceptor.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -64,6 +64,7 @@
         final Authorizated authoAnnotation = invocation.getStaticPart().getAnnotation(Authorizated.class);
         final AccessRol accessRol = authoAnnotation.accessRolRequired();
         final ActionLevel actionLevel = authoAnnotation.actionLevel();
+        final boolean mustBeMember = authoAnnotation.mustCheckMembership();
 
         final User user = userSession.getUser();
         Group group = Group.NO_GROUP;
@@ -98,8 +99,10 @@
             break;
         }
 
-        if (!correctMember(user, group, accessRol)) {
-            throw new AccessViolationException();
+        if (mustBeMember) {
+            if (!correctMember(user, group, accessRol)) {
+                throw new AccessViolationException();
+            }
         }
 
         return invocation.proceed();

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManager.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -20,6 +20,7 @@
 package org.ourproject.kune.platf.server.content;
 
 import org.ourproject.kune.platf.client.errors.DefaultException;
+import org.ourproject.kune.platf.server.domain.AccessLists;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.I18nLanguage;
@@ -38,4 +39,6 @@
     SearchResult<Container> search(String search);
 
     SearchResult<Container> search(String search, Integer firstResult, Integer maxResults);
+
+    void setAccessList(Container container, AccessLists accessList);
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -29,6 +29,7 @@
 import org.apache.lucene.queryParser.ParseException;
 import org.apache.lucene.search.Query;
 import org.ourproject.kune.platf.client.errors.DefaultException;
+import org.ourproject.kune.platf.server.domain.AccessLists;
 import org.ourproject.kune.platf.server.domain.Container;
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.I18nLanguage;
@@ -99,4 +100,9 @@
         return super.search(query, firstResult, maxResults);
     }
 
+    public void setAccessList(Container container, AccessLists accessList) {
+        container.setAccessLists(accessList);
+        persist(container);
+    }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -90,6 +90,9 @@
         final User user = new User(adminShortName, adminName, adminEmail, adminPassword,
                 languageManager.findByCode("en"), countryManager.findByCode("GB"), TimeZone.getDefault());
         groupManager.createUserGroup(user, false);
+        final User dummyUser = new User("dummy", "dummy user", "example at example.com", adminPassword,
+                languageManager.findByCode("en"), countryManager.findByCode("GB"), TimeZone.getDefault());
+        groupManager.createUserGroup(dummyUser, false);
 
         final String siteName = properties.getDefaultSiteName();
         final String siteShortName = properties.getDefaultSiteShortName();

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -97,7 +97,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container)
+    @Authorizated(accessRolRequired = AccessRol.Editor, actionLevel = ActionLevel.container, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     Content createUploadedFileWrapped(final String userHash, final StateToken stateToken, final String fileName,
             final FileItem fileUploadItem, String typeId) throws Exception {

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/ContentRPC.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -120,7 +120,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public void addAuthor(final String userHash, final StateToken token, final String authorShortName)
             throws DefaultException {
@@ -155,7 +155,7 @@
     }
 
     @Authenticated
-    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public StateContentDTO addContent(final String userHash, final StateToken parentToken, final String title,
             final String typeId) throws DefaultException {
@@ -170,7 +170,7 @@
     }
 
     @Authenticated
-    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public StateContainerDTO addFolder(final String userHash, final StateToken parentToken, final String title,
             final String contentTypeId) throws DefaultException {
@@ -290,7 +290,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public void removeAuthor(final String userHash, final StateToken token, final String authorShortName)
             throws DefaultException {
@@ -301,7 +301,7 @@
     }
 
     @Authenticated
-    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor)
+    @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public String renameContainer(final String userHash, final StateToken token, final String newName)
             throws DefaultException {
@@ -309,7 +309,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public String renameContent(final String userHash, final StateToken token, final String newName)
             throws DefaultException {
@@ -324,7 +324,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public void save(final String userHash, final StateToken token, final String textContent) throws DefaultException {
 
@@ -357,7 +357,7 @@
     // }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public I18nLanguageDTO setLanguage(final String userHash, final StateToken token, final String languageCode)
             throws DefaultException {
@@ -368,7 +368,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public void setPublishedOn(final String userHash, final StateToken token, final Date publishedOn)
             throws DefaultException {
@@ -396,7 +396,7 @@
     }
 
     @Authenticated
-    @Authorizated(accessRolRequired = AccessRol.Editor)
+    @Authorizated(accessRolRequired = AccessRol.Editor, mustCheckMembership = false)
     @Transactional(type = TransactionType.READ_WRITE)
     public TagCloudResultDTO setTags(final String userHash, final StateToken token, final String tags)
             throws DefaultException {

Modified: trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/wiki/server/WikiServerTool.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -87,6 +87,7 @@
     public Group initGroup(final User user, final Group group) {
         final ToolConfiguration config = new ToolConfiguration();
         final Container rootFolder = containerManager.createRootFolder(group, NAME, ROOT_NAME, TYPE_ROOT);
+        setContainerWikiAcl(rootFolder);
         config.setRoot(rootFolder);
         group.setToolConfig(NAME, config);
         configurationManager.persist(config);
@@ -102,14 +103,7 @@
     }
 
     public void onCreateContainer(final Container container, final Container parent) {
-        if (container.getTypeId().equals(TYPE_FOLDER)) {
-            AccessLists wikiAcl = new AccessLists();
-            wikiAcl.getAdmins().setMode(GroupListMode.NORMAL);
-            wikiAcl.getAdmins().add(container.getOwner());
-            wikiAcl.getEditors().setMode(GroupListMode.EVERYONE);
-            wikiAcl.getViewers().setMode(GroupListMode.EVERYONE);
-            container.setAccessLists(wikiAcl);
-        }
+        setContainerWikiAcl(container);
     }
 
     public void onCreateContent(final Content content, final Container parent) {
@@ -149,4 +143,13 @@
             throw new ContentNotPermittedException();
         }
     }
+
+    private void setContainerWikiAcl(final Container container) {
+        AccessLists wikiAcl = new AccessLists();
+        wikiAcl.getAdmins().setMode(GroupListMode.NORMAL);
+        wikiAcl.getAdmins().add(container.getOwner());
+        wikiAcl.getEditors().setMode(GroupListMode.EVERYONE);
+        wikiAcl.getViewers().setMode(GroupListMode.EVERYONE);
+        containerManager.setAccessList(container, wikiAcl);
+    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPanel.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPanel.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -49,7 +49,7 @@
         super.getForm().removeAll(true);
         fields.clear();
         Label label = new Label();
-        label.setHtml(i18n.t("Here you can select the tools used in this group:") + "<br/><br/>");
+        label.setHtml(i18n.t("Here you can select the tools used:") + "<br/><br/>");
         super.add(label);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPresenter.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsToolsConfPresenter.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -3,6 +3,7 @@
 import java.util.Collection;
 
 import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.ToolSimpleDTO;
 import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
@@ -93,11 +94,14 @@
         for (String tool : state.getEnabledTools()) {
             view.setChecked(tool, true);
         }
-        String defContentTool = session.getCurrentState().getGroup().getDefaultContent().getStateToken().getTool();
-        view.setEnabled(defContentTool, false);
-        view.setTooltip(
-                defContentTool,
-                i18n.t("You cannot disable this tool because it's where the current group home page is located. To do that you have to select other content as the default group home page but in another tool."));
+        ContentSimpleDTO defaultContent = session.getCurrentState().getGroup().getDefaultContent();
+        if (defaultContent != null) {
+            String defContentTool = defaultContent.getStateToken().getTool();
+            view.setEnabled(defContentTool, false);
+            view.setTooltip(
+                    defContentTool,
+                    i18n.t("You cannot disable this tool because it's where the current group home page is located. To do that you have to select other content as the default group home page but in another tool."));
+        }
     }
 
     private void setToolCheckedInServer(final boolean checked, final String toolName) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -25,6 +25,7 @@
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.StateContentDTO;
+import org.ourproject.kune.platf.client.registry.AuthorableRegistry;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
@@ -38,12 +39,14 @@
     private final I18nTranslationService i18n;
     private final boolean showLanguage;
     private final Session session;
+    private final AuthorableRegistry authorableRegistry;
 
     public EntitySubTitlePresenter(final I18nTranslationService i18n, final StateManager stateManager, Session session,
-            boolean showLanguage) {
+            boolean showLanguage, AuthorableRegistry authorableRegistry) {
         this.i18n = i18n;
         this.session = session;
         this.showLanguage = showLanguage;
+        this.authorableRegistry = authorableRegistry;
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
             public void onEvent(final StateAbstractDTO state) {
                 if (state instanceof StateContentDTO) {
@@ -106,15 +109,19 @@
     }
 
     private void setState(final StateContainerDTO state) {
-        view.setContentSubTitleRightVisible(false);
+        view.setContentSubTitleLeftVisible(false);
         setLanguage(state);
         setContentDateVisible(false);
     }
 
     private void setState(final StateContentDTO state) {
-        view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors",
-                state.getAuthors().get(0).getName()));
-        view.setContentSubTitleLeftVisible(true);
+        if (authorableRegistry.contains(state.getTypeId())) {
+            view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors",
+                    state.getAuthors().get(0).getName()));
+            view.setContentSubTitleLeftVisible(true);
+        } else {
+            view.setContentSubTitleLeftVisible(false);
+        }
         setLanguage(state);
         Date publishedOn = state.getPublishedOn();
         setContentDate(publishedOn);

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTest.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -24,6 +24,14 @@
         return userService.login(getSiteAdminShortName(), properties.getAdminPassword()).getUserHash();
     }
 
+    protected String doLoginWithDummyUser() throws DefaultException {
+        return userService.login("dummy", properties.getAdminPassword()).getUserHash();
+    }
+
+    protected void doLogout() throws DefaultException {
+        userService.logout(getHash());
+    }
+
     protected String getDefLicense() {
         return properties.getDefaultLicense();
     }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/IntegrationTestHelper.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -7,6 +7,7 @@
 import org.ourproject.kune.platf.server.KunePersistenceService;
 import org.ourproject.kune.platf.server.PlatformServerModule;
 import org.ourproject.kune.platf.server.properties.PropertiesFileName;
+import org.ourproject.kune.wiki.server.WikiServerModule;
 
 import com.google.inject.AbstractModule;
 import com.google.inject.Guice;
@@ -19,7 +20,7 @@
 
     public static Injector createInjector() {
         final Injector injector = Guice.createInjector(new PlatformServerModule(), new DocumentServerModule(),
-                new ChatServerModule(), new AbstractModule() {
+                new ChatServerModule(), new WikiServerModule(), new AbstractModule() {
                     @Override
                     protected void configure() {
                         bindScope(SessionScoped.class, Scopes.SINGLETON);

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceAddTest.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -19,6 +19,7 @@
 import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
 import org.ourproject.kune.platf.integration.IntegrationTestHelper;
+import org.ourproject.kune.wiki.server.WikiServerTool;
 
 public class ContentServiceAddTest extends ContentServiceIntegrationTest {
 
@@ -65,7 +66,6 @@
         final StateContentDTO sameAgain = (StateContentDTO) contentService.getContent(session.getHash(), newState);
         assertNotNull(sameAgain);
         assertEquals(2, sameAgain.getContainer().getContents().size());
-
     }
 
     @Test
@@ -122,4 +122,30 @@
         assertEquals(2, parentAgain.getChilds().size());
     }
 
+    @Test
+    public void testAddWikiContent() throws Exception {
+        doLogin();
+
+        StateToken wikiToken = new StateToken(super.getDefSiteGroupName(), WikiServerTool.NAME);
+        StateContainerDTO wiki = (StateContainerDTO) contentService.getContent(session.getHash(), wikiToken);
+
+        final String title = "New wikipage";
+        final StateContentDTO added = contentService.addContent(session.getHash(), wiki.getStateToken(), title,
+                WikiServerTool.TYPE_WIKIPAGE);
+        assertNotNull(added);
+        ContainerDTO wikiContainer = added.getContainer();
+        final List<ContentSimpleDTO> contents = wikiContainer.getContents();
+        assertEquals(title, added.getTitle());
+        assertEquals(2, contents.size());
+        doLogout();
+
+        doLoginWithDummyUser();
+        contentService.save(getHash(), added.getStateToken(), "some new test");
+        // assertEquals(cntRights, added.getContentRights());
+        // assertEquals(ctxRights, added.getContainerRights());
+        // assertEquals(groupRights, added.getGroupRights());
+        // assertNotNull(added.getGroupMembers());
+        // assertNotNull(added.getParticipation());
+        // assertNotNull(added.getAccessLists());
+    }
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceIntegrationTest.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -4,6 +4,7 @@
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.ContentService;
 import org.ourproject.kune.platf.integration.IntegrationTest;
+import org.ourproject.kune.workspace.client.site.rpc.UserService;
 
 import com.google.inject.Inject;
 
@@ -11,6 +12,9 @@
     @Inject
     protected ContentService contentService;
 
+    @Inject
+    protected UserService userService;
+
     protected StateContentDTO getSiteDefaultContent() throws Exception {
         final StateToken stateToken = new StateToken(getDefSiteGroupName());
         final StateContentDTO content = (StateContentDTO) contentService.getContent(session.getHash(), stateToken);

Added: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/ContentAddSeleniumTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/ContentAddSeleniumTest.java	2008-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/ContentAddSeleniumTest.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -0,0 +1,18 @@
+package org.ourproject.kune.platf.integration.selenium;
+
+import org.junit.Test;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.entitylogo.EntityLogoPanel;
+
+public class ContentAddSeleniumTest extends KuneSeleniumTestHelper {
+    @Test
+    public void wikiEditByAny() throws Exception {
+        String shortname = "g" + genPrefix();
+        String longName = "testing" + genPrefix();
+        newGroupRegistrationDefLicense(shortname, longName, "some description", "tag1 tag2");
+        waitForTextInside(gid(EntityLogoPanel.LOGO_NAME), longName);
+        open(new StateToken(shortname, ""));
+        signOut();
+        wait(120000);
+    }
+}

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-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -7,6 +7,10 @@
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.WorkspaceMessages;
+import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel;
 import org.ourproject.kune.workspace.client.signin.RegisterForm;
 import org.ourproject.kune.workspace.client.signin.RegisterPanel;
 import org.ourproject.kune.workspace.client.signin.SignInForm;
@@ -58,6 +62,28 @@
         this.mustCapture = mustCapture;
     }
 
+    protected 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;
+        }
+    }
+
     protected long genPrefix() {
         long prefix = new Date().getTime();
         return prefix;
@@ -69,10 +95,23 @@
         }
     }
 
+    protected void newGroupRegistrationDefLicense(String shortname, String longName, String description, String tags)
+            throws Exception {
+        GroupType organization = GroupType.ORGANIZATION;
+        signInAndNewGroup();
+        fillNewGroup1stPage(shortname, longName, description, tags, organization);
+        click(NewGroupPanel.NEXT_BUTTON);
+        click(NewGroupPanel.FINISH_BUTTON);
+    }
+
     protected void open(SiteToken token) {
         open(KUNE_BASE_URL + token.toString());
     }
 
+    protected void open(StateToken token) {
+        open(KUNE_BASE_URL + token.toString());
+    }
+
     @Override
     protected void open(String url) {
         try {
@@ -139,6 +178,14 @@
         click(SignInPanel.SIGN_IN_BUTTON_ID);
     }
 
+    protected void signInAndNewGroup() throws Exception {
+        openDefPage();
+        signIn();
+        open(SiteToken.newgroup);
+        verifyLoggedUserShorName("admin");
+        waitForTextInside(NewGroupPanel.NEWGROUP_WIZARD, WorkspaceMessages.REGISTER_A_NEW_GROUP_TITLE);
+    }
+
     protected void signOut() {
         click("gwt-debug-k-ssolp-lb");
     }

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-12-01 21:05:52 UTC (rev 975)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/NewGroupSeleniumTest.java	2008-12-02 00:42:41 UTC (rev 976)
@@ -44,49 +44,9 @@
 
     @Test
     public void newGroupWithNonOccidentalChars() throws Exception {
-        setMustCapture(true);
         String longName = "漢語 中文 华语 汉语" + genPrefix();
         newGroupRegistrationDefLicense("g" + genPrefix(), longName,
                 "吗 台湾 六种辅音韵尾 中国政府要求在中国出售的软件必须使用编码 过 国标 名词的复数形式只在代词及多音节", "漢語 中文 华语 汉语");
         waitForTextInside(gid(EntityLogoPanel.LOGO_NAME), longName);
     }
-
-    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 newGroupRegistrationDefLicense(String shortname, String longName, String description, String tags)
-            throws Exception {
-        GroupType organization = GroupType.ORGANIZATION;
-        signInAndNewGroup();
-        fillNewGroup1stPage(shortname, longName, description, tags, organization);
-        click(NewGroupPanel.NEXT_BUTTON);
-        click(NewGroupPanel.FINISH_BUTTON);
-    }
-
-    private void signInAndNewGroup() throws Exception {
-        openDefPage();
-        signIn();
-        open(SiteToken.newgroup);
-        verifyLoggedUserShorName("admin");
-        waitForTextInside(NewGroupPanel.NEWGROUP_WIZARD, WorkspaceMessages.REGISTER_A_NEW_GROUP_TITLE);
-    }
 }




More information about the kune-commits mailing list