[kune-commits] r1818 - in trunk: . debian script src/main/java/cc/kune/core/client/actions src/main/java/cc/kune/core/client/auth src/main/java/cc/kune/core/client/sitebar/auth src/main/java/cc/kune/core/client/sn/actions src/main/java/cc/kune/core/client/ui src/main/java/cc/kune/core/public src/main/java/cc/kune/core/server/access src/main/java/cc/kune/core/server/auth src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/core/shared/domain src/main/java/cc/kune/core/shared/dto src/main/java/cc/kune/events/server src/main/java/cc/kune/events/server/utils src/main/java/cc/kune/events/shared src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/trash/server src/main/java/cc/kune/wave/server src/main/webapp src/test/java/cc/kune/core/client src/test/java/cc/kune/core/server src/test/java/cc/kune/core/server/access src/test/java/cc/kune/core/server/auth src/test/java/cc/kune/core/server/integration src/test/java/cc/kune/core/server/integration/content src/test/java/cc/kune/core/server/integration/kuneservice src/test/java/cc/kune/core/server/integration/site src/test/java/cc/kune/core/server/integration/socialnet src/test/java/cc/kune/core/server/manager/file src/test/java/cc/kune/core/server/mapper src/test/java/cc/kune/events src/test/java/cc/kune/events/server/utils src/test/java/cc/kune/gspace/client src/test/java/cc/kune/lists/server src/test/java/cc/kune/wave/server src/test/java/com/google/inject/persist src/test/java/testsuites
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Mon Apr 2 05:10:58 CEST 2012
Author: vjrj_
Date: 2012-04-02 05:10:57 +0200 (Mon, 02 Apr 2012)
New Revision: 1818
Added:
trunk/script/kune tests.launch
Removed:
trunk/script/kune server via mvn with debug.launch
trunk/src/main/java/cc/kune/events/shared/EventsSharedConversionUtil.java
trunk/src/test/java/cc/kune/core/client/rpcservices/
trunk/src/test/java/cc/kune/core/server/TestHelper.java
trunk/src/test/java/cc/kune/core/server/auth/openfire/
trunk/src/test/java/cc/kune/events/shared/
trunk/src/test/java/cc/kune/gspace/client/armor/
trunk/src/test/java/cc/kune/gspace/client/maxmin/
trunk/src/test/java/com/google/inject/persist/jpa/
Modified:
trunk/.classpath
trunk/TODO
trunk/TODO_done
trunk/debian/changelog
trunk/debian/files
trunk/debian/kune.dirs
trunk/debian/rules
trunk/pom.xml
trunk/script/kune client -no-server.launch
trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
trunk/src/main/java/cc/kune/core/client/auth/LoginRememberManagerImpl.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/auth/AskForPasswordResetPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java
trunk/src/main/java/cc/kune/core/client/sn/actions/AddNewBuddiesAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
trunk/src/main/java/cc/kune/core/client/ui/DefaultForm.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/server/access/AccessRightsServiceDefault.java
trunk/src/main/java/cc/kune/core/server/access/AccessService.java
trunk/src/main/java/cc/kune/core/server/access/AccessServiceDefault.java
trunk/src/main/java/cc/kune/core/server/access/FinderService.java
trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java
trunk/src/main/java/cc/kune/core/server/auth/SuperAdmin.java
trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/shared/domain/AccessRol.java
trunk/src/main/java/cc/kune/core/shared/domain/GroupListMode.java
trunk/src/main/java/cc/kune/core/shared/dto/AccessListsDTO.java
trunk/src/main/java/cc/kune/events/server/EventsServlet.java
trunk/src/main/java/cc/kune/events/server/utils/EventsServerConversionUtil.java
trunk/src/main/java/cc/kune/events/shared/EventsClientConversionUtil.java
trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
trunk/src/main/java/cc/kune/trash/server/TrashServerTool.java
trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
trunk/src/main/webapp/ws.html
trunk/src/test/java/cc/kune/core/server/PersistenceTest.java
trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java
trunk/src/test/java/cc/kune/core/server/access/FinderTest.java
trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java
trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java
trunk/src/test/java/cc/kune/core/server/auth/SuperAdminMethodInterceptorTest.java
trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
trunk/src/test/java/cc/kune/core/server/integration/StatsServiceTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java
trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java
trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java
trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java
trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java
trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java
trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java
trunk/src/test/java/cc/kune/core/server/manager/file/FileManagerTest.java
trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java
trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
trunk/src/test/java/cc/kune/events/server/utils/BasicCalendarTest.java
trunk/src/test/java/cc/kune/events/server/utils/EventsServerConversionUtilTest.java
trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
trunk/src/test/java/testsuites/IntegrationTestSuite.java
Log:
NEW - # 222: Create a trash folder icon and improve contents delete functionality
http://kune.ourproject.org/issues/ticket/222
And more changes:
Upgrade of db
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/.classpath 2012-04-02 03:10:57 UTC (rev 1818)
@@ -8,7 +8,7 @@
<classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar" sourcepath="M2_REPO/javax/transaction/jta/1.1/jta-1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4.jar" sourcepath="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar" sourcepath="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/3.0-0.3.14/servlet-api-3.0-0.3.14.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/api/0.3.14/api-0.3.14.jar"/>
@@ -111,7 +111,7 @@
<classpathentry kind="var" path="M2_REPO/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/jtidy/r8-20060801/jtidy-r8-20060801.jar"/>
<classpathentry kind="var" path="M2_REPO/org/jukito/jukito/1.0/jukito-1.0.jar" sourcepath="M2_REPO/org/jukito/jukito/1.0/jukito-1.0-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/junit/junit/4.9/junit-4.9.jar" sourcepath="M2_REPO/junit/junit/4.9/junit-4.9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.10/junit-4.10.jar" sourcepath="M2_REPO/junit/junit/4.10/junit-4.10-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/liquibase/liquibase-core/1.8.1/liquibase-core-1.8.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/liquibase/liquibase-plugin/1.8.1.0/liquibase-plugin-1.8.1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16.jar" sourcepath="M2_REPO/log4j/log4j/1.2.16/log4j-1.2.16-sources.jar"/>
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/TODO 2012-04-02 03:10:57 UTC (rev 1818)
@@ -12,6 +12,58 @@
nick == assigned to
* SHORT-TERM (URGENT)
+** Permission tables
+
+|---------------------------+-------------+--------------|
+| Scopes | Group Space | Public Space |
+|---------------------------+-------------+--------------|
+| Admin | X | |
+| Edit | X | |
+| View | X | |
+| Published (ContentStatus) | | X |
+|---------------------------+-------------+--------------|
+
+|---------------+-----------------------------------------------------------|
+| GroupListMode | |
+|---------------+-----------------------------------------------------------|
+| NAME | Description |
+|---------------+-----------------------------------------------------------|
+| EVERYONE | means that everybody is in the list |
+| NOBODY | means that nobody is in the list (equals to a empty list) |
+| NORMAL | a normal list of groups |
+|---------------+-----------------------------------------------------------|
+
+AccessList samples (using GroupListMode)
+
+|---------------------------------------------------------+--------+---------------+----------+---------|
+| AccessList (A: Admins, E:Editors, V: Viewers | | Administrable | Editable | Visible |
+|---------------------------------------------------------+--------+---------------+----------+---------|
+| (A:EVERYONE, E: EVERYONE, V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+| | Group2 | yes | yes | yes |
+|---------------------------------------------------------+--------+---------------+----------+---------|
+| (A:NORMAL(Group1), E: NORMAL, V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+| | Group2 | no | no | yes |
+|---------------------------------------------------------+--------+---------------+----------+---------|
+| (A:NORMAL(Group1), E: NORMAL(Group2), V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+| | Group2 | no | yes | yes |
+| | Group3 | no | no | yes |
+|---------------------------------------------------------+--------+---------------+----------+---------|
+| (A:NORMAL(Group1), E: NORMAL, V:NORMAL(Group2), P:NO) | Group1 | yes | yes | yes |
+| | Group2 | no | no | yes |
+| | Group3 | no | no | no |
+|---------------------------------------------------------+--------+---------------+----------+---------|
+
+Groups and subgroups
+
+|------------+--------+---------+---------+-----------|
+| | Admins | Editors | Viewers | Published |
+|------------+--------+---------+---------+-----------|
+| New doc | | | | |
+| New folder | | | | |
+|------------+--------+---------+---------+-----------|
+
+
+
** setui/root/port 80
[ ] http://wiki.eclipse.org/Jetty/Howto/Port80#Configuring_Jetty.27s_SetUID_Feature
[ ] https://github.com/disconnect/apache-websocket
@@ -20,24 +72,11 @@
*** via btn
*** via hash (future) #tuto(token,slide)
*** via empty folder
-** deploy automatize (update)
-*** copy jar
-*** copy via rsync gwt compilation (no delete to prevent code fail message)
-*** copy the jar and the compilation to other sites in the same lan
-*** update /etc/kune (if needed)
-*** migrate the database (if needed)
** users presence vi API (for better notifications)
http://www.igniterealtime.org/projects/openfire/plugins/presence/readme.html
http://127.0.0.1:9090/plugins/presence/status?jid=admin@localhost&type=xml
http://community.igniterealtime.org/thread/29064
http://www.igniterealtime.org/builds/wildfire/docs/3.3.0_alpha_1/documentation/javadoc/org/jivesoftware/wildfire/commands/admin/GetUsersPresence.html
-** group.inexistentTool nasty error
-** calendar support
-*** gwt-cal + http://ical4j.sourceforge.net/introduction.html
-*** add --> event --> rpc --> gadget + wave
-*** modification --> event ---> rpc gadget + wave
-*** delete ---> ?
-*** get --> list<waveref> ---> list<app>
** i18n usecase
| logged | locale in URL | i18n supported | useDB |
| false | false | false | true |
Modified: trunk/TODO_done
===================================================================
--- trunk/TODO_done 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/TODO_done 2012-04-02 03:10:57 UTC (rev 1818)
@@ -400,6 +400,37 @@
hybridAuthProvider.secondaryProvider.className = cc.kune.core.server.auth.openfire.KuneAuthProvider
cp /tmp/model.jar apache-wave-model.jar
cp /tmp/kune-0.1.0-SNAPSHOT-jar-openfire-customauth.jar kune-authprovider.jar
+* deploy automatize (update)
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-04-02 lun 00:33
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+** copy jar
+** copy via rsync gwt compilation (no delete to prevent code fail message)
+** copy the jar and the compilation to other sites in the same lan
+** update /etc/kune (if needed)
+** migrate the database (if needed)
+* group.inexistentTool nasty error
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-04-02 lun 01:25
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+* calendar support
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2012-04-02 lun 01:25
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+** gwt-cal + http://ical4j.sourceforge.net/introduction.html
+** add --> event --> rpc --> gadget + wave
+** modification --> event ---> rpc gadget + wave
+** delete ---> ?
+** get --> list<waveref> ---> list<app>
@@ -424,3 +455,6 @@
+
+
+
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/debian/changelog 2012-04-02 03:10:57 UTC (rev 1818)
@@ -2,7 +2,7 @@
* Added some new languages and added some profiles to make development faster
- -- <vjrj at arjuna> Sun, 01 Apr 2012 15:45:26 +0200
+ -- Vicente J. Ruiz Jurado <vjrj at ourproject.org> Sun, 01 Apr 2012 15:45:26 +0200
kune (0.1.0+b4) oneiric; urgency=low
Modified: trunk/debian/files
===================================================================
--- trunk/debian/files 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/debian/files 2012-04-02 03:10:57 UTC (rev 1818)
@@ -1 +1 @@
-kune_0.1.0+b4_all.deb java optional
+kune_0.1.0+b5_all.deb java optional
Modified: trunk/debian/kune.dirs
===================================================================
--- trunk/debian/kune.dirs 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/debian/kune.dirs 2012-04-02 03:10:57 UTC (rev 1818)
@@ -10,4 +10,5 @@
/var/log/kune
/var/lib/kune/uploads/
/var/lib/kune/lucene/kune_prod/indexes/
-/usr/share/dbconfig-common/data/kune/install/
\ No newline at end of file
+/usr/share/dbconfig-common/data/kune/install/
+/usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b5/
Modified: trunk/debian/rules
===================================================================
--- trunk/debian/rules 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/debian/rules 2012-04-02 03:10:57 UTC (rev 1818)
@@ -28,7 +28,7 @@
build/kune::
-# mvn assembly:assembly -Dgwt.compiler.skip=$(NO_GWT)
+# mvn assembly:assembly -Dgwt.compiler.skip=$(NO_GWT) -P production
binary-indep: build install/kune
binary-arch: binary-indep
@@ -48,20 +48,22 @@
cp $(RESOURCES)/jaas.config $(ETCDIR)
cp $(RESOURCES)/log4j.prod.properties $(ETCDIR)/log4j.properties
cp $(RESOURCES)/mail-notif-template.html $(ETCDIR)
+
+# DB configuration, see:
+# http://people.debian.org/~seanius/policy/examples/dbconfig-common/doc/dbconfig-common-using.html#bootstrap
+# http://people.debian.org/~seanius/policy/dbconfig-common-using.html/
+# /usr/share/doc/dbconfig-common/examples/
+
cp $(CURDIR)/src/main/resources/db/kune_initialize.sql $(DEST)/usr/share/dbconfig-common/data/kune/install/mysql
-# cp $(CURDIR)/script/upgrade_0.6.0.sql $(DEST)/usr/share/dbconfig-common/data/confusa/upgrade/mysql/0.6.0.sql
+ cp $(CURDIR)/src/main/resources/db/init-data-countries.sql $(DEST)/usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b5/0.1.0+b5-init-data-countries.sql
+ cp $(CURDIR)/src/main/resources/db/init-data-languages.sql $(DEST)/usr/share/dbconfig-common/data/kune/upgrade/mysql/0.1.0+b5/0.1.0+b5-init-data-languages.sql
# FIXME
# cp logrotate $(DEST)/etc/logrotate.d/
# FIXME find another better way to do this (and remove rsync build dep)
- rsync -aC $(CURDIR)/src/main/webapp/* $(KUNE)/webapp
- rsync -aC $(TARGETC)/ws/* $(KUNE)/webclient/ws
+ rsync -aC --delete $(CURDIR)/src/main/webapp/* $(KUNE)/webapp
+ rsync -aC --delete $(TARGETC)/ws/* $(KUNE)/webclient/ws
-# dh_installdebconf
-# dh_installdeb
-
-# FIXME utf8 in database
-
#get-orig-source:
# sh -e debian/orig-tar.sh
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/pom.xml 2012-04-02 03:10:57 UTC (rev 1818)
@@ -463,7 +463,9 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>3.0-${wiab.version}</version>
+ <version>2.5</version>
+ <!-- <version>3.0-${wiab.version}</version> -->
+ <scope>provided</scope>
</dependency>
<!-- testing dependencies -->
<dependency>
@@ -481,7 +483,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.9</version>
+ <version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -710,7 +712,7 @@
<groupId>com.bradrydzewski</groupId>
<artifactId>gwt-cal</artifactId>
<version>0.9.3-dndCreation</version>
- <!-- Used in server side also <scope>provided</scope> -->
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mnode.ical4j</groupId>
@@ -934,15 +936,17 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>2.8.1</version>
+ <version>2.12</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
- <version>2.8.1</version>
+ <version>2.12</version>
</dependency>
</dependencies>
<configuration>
+ <!-- jenkins needs this -->
+ <disableXmlReport>false</disableXmlReport>
<excludes>
<exclude>**/*_Roo_*</exclude>
</excludes>
@@ -1152,56 +1156,57 @@
<id>production</id>
<build>
<plugins>
- <!-- Warning if you modify this part take in to account that exist to profiles: development and production -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <version>${gwtmaven.version}</version>
- <configuration>
- <logLevel>INFO</logLevel>
- <style>OBF</style>
-<!-- <style>PRETTY</style> -->
- <noServer>true</noServer>
- <gwtVersion>${gwt.version}</gwtVersion>
- <runTarget>/ws.html?log_level=DEBUG</runTarget>
- <hostedWebapp>${project.build.directory}/${project.build.finalName}
- </hostedWebapp>
- <modules>
- <module>${project.groupId}.KuneProd</module>
- </modules>
- <copyWebapp>true</copyWebapp>
- <compileReport>false</compileReport>
- <localWorkers>1</localWorkers><!-- Using all workers can temporarily
- hang the mouse and isn't much faster -->
- <extraJvmArgs>-Xmx1024m</extraJvmArgs>
- </configuration>
- <executions>
- <execution>
+ <!-- Warning if you modify this part take in to account that exist
+ to profiles: development and production -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>${gwtmaven.version}</version>
<configuration>
- <extraJvmArgs>-Xmx1024M</extraJvmArgs>
+ <logLevel>INFO</logLevel>
+ <style>OBF</style>
+ <!-- <style>PRETTY</style> -->
+ <noServer>true</noServer>
+ <gwtVersion>${gwt.version}</gwtVersion>
+ <runTarget>/ws.html?log_level=DEBUG</runTarget>
+ <hostedWebapp>${project.build.directory}/${project.build.finalName}
+ </hostedWebapp>
+ <modules>
+ <module>${project.groupId}.KuneProd</module>
+ </modules>
+ <copyWebapp>true</copyWebapp>
+ <compileReport>false</compileReport>
+ <localWorkers>1</localWorkers><!-- Using all workers can temporarily
+ hang the mouse and isn't much faster -->
+ <extraJvmArgs>-Xmx1024m</extraJvmArgs>
</configuration>
- <id>gwtcompile</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>compile</goal>
- <!-- http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html -->
- <!-- <goal>resources</goal> -->
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- </dependencies>
- </plugin>
+ <executions>
+ <execution>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M</extraJvmArgs>
+ </configuration>
+ <id>gwtcompile</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>compile</goal>
+ <!-- http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html -->
+ <!-- <goal>resources</goal> -->
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
</plugins>
</build>
</profile>
@@ -1209,57 +1214,58 @@
<id>development</id>
<build>
<plugins>
- <!-- Warning if you modify this part take in to account that exist to profiles: development and production -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <version>${gwtmaven.version}</version>
- <configuration>
-<!-- <logLevel>INFO</logLevel> -->
- <style>OBF</style>
- <style>PRETTY</style>
- <noServer>true</noServer>
- <gwtVersion>${gwt.version}</gwtVersion>
- <runTarget>/ws.html?log_level=DEBUG</runTarget>
- <hostedWebapp>${project.build.directory}/${project.build.finalName}
- </hostedWebapp>
- <modules>
- <module>${project.groupId}.KuneDev</module>
- </modules>
- <copyWebapp>true</copyWebapp>
- <compileReport>false</compileReport>
- <localWorkers>1</localWorkers><!-- Using all workers can temporarily
- hang the mouse and isn't much faster -->
- <extraJvmArgs>-Xmx1024m</extraJvmArgs>
- </configuration>
- <executions>
- <execution>
+ <!-- Warning if you modify this part take in to account that exist
+ to profiles: development and production -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>${gwtmaven.version}</version>
<configuration>
- <extraJvmArgs>-Xmx1024M</extraJvmArgs>
+ <!-- <logLevel>INFO</logLevel> -->
+ <style>OBF</style>
+ <style>PRETTY</style>
+ <noServer>true</noServer>
+ <gwtVersion>${gwt.version}</gwtVersion>
+ <runTarget>/ws.html?log_level=DEBUG</runTarget>
+ <hostedWebapp>${project.build.directory}/${project.build.finalName}
+ </hostedWebapp>
+ <modules>
+ <module>${project.groupId}.KuneDev</module>
+ </modules>
+ <copyWebapp>true</copyWebapp>
+ <compileReport>false</compileReport>
+ <localWorkers>1</localWorkers><!-- Using all workers can temporarily
+ hang the mouse and isn't much faster -->
+ <extraJvmArgs>-Xmx1024m</extraJvmArgs>
</configuration>
- <id>gwtcompile</id>
- <phase>prepare-package</phase>
- <goals>
- <goal>compile</goal>
- <!-- http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html -->
- <!-- <goal>resources</goal> -->
- </goals>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- </dependencies>
- </plugin>
-
+ <executions>
+ <execution>
+ <configuration>
+ <extraJvmArgs>-Xmx1024M</extraJvmArgs>
+ </configuration>
+ <id>gwtcompile</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>compile</goal>
+ <!-- http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html -->
+ <!-- <goal>resources</goal> -->
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+
</plugins>
</build>
</profile>
Modified: trunk/script/kune client -no-server.launch
===================================================================
--- trunk/script/kune client -no-server.launch 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/script/kune client -no-server.launch 2012-04-02 03:10:57 UTC (rev 1818)
@@ -5,7 +5,7 @@
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
-<listEntry value="cc.kune.Kune"/>
+<listEntry value="cc.kune.KuneDev"/>
</listAttribute>
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/?locale=en&log_level=INFO"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -15,12 +15,12 @@
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war /home/vjrj/proyectos/dev/kune/trunk/target/kune-0.1.0-SNAPSHOT -startupUrl /?locale=en&log_level=INFO -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 cc.kune.Kune"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war /home/vjrj/proyectos/dev/kune/trunk/target/kune-0.1.0-SNAPSHOT -startupUrl /?locale=en&log_level=INFO -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 cc.kune.KuneDev"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="kune"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/>
</launchConfiguration>
Deleted: trunk/script/kune server via mvn with debug.launch
===================================================================
--- trunk/script/kune server via mvn with debug.launch 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/script/kune server via mvn with debug.launch 2012-04-02 03:10:57 UTC (rev 1818)
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
-<mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="MAVEN_OPTS" value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001"/>
-</mapAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="/usr/bin/mvn"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="exec:java"/>
-<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/kune}"/>
-</launchConfiguration>
Added: trunk/script/kune tests.launch
===================================================================
--- trunk/script/kune tests.launch (rev 0)
+++ trunk/script/kune tests.launch 2012-04-02 03:10:57 UTC (rev 1818)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="/usr/bin/mvn"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="test -DskipTests=false -Dliquibase.should.run=false -Djava.security.auth.login.config=src/main/resources/jaas.config"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/kune}"/>
+</launchConfiguration>
Modified: trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -29,7 +29,6 @@
import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.core.shared.dto.AccessRolDTO;
-import com.google.gwt.event.shared.HandlerRegistration;
import com.google.inject.Inject;
/**
@@ -39,7 +38,6 @@
*
*/
public abstract class RolActionAutoUpdated extends AbstractExtendedAction {
- private final HandlerRegistration handlerReg;
protected final Session session;
protected final StateManager stateManager;
@@ -49,7 +47,7 @@
final boolean authNeed, final boolean visibleForNonMemb, final boolean visibleForMembers) {
this.stateManager = stateManager;
this.session = session;
- handlerReg = rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
+ rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
@Override
public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
refreshStatus(rolRequired, authNeed, session.isLogged(), visibleForMembers, visibleForNonMemb,
@@ -58,12 +56,6 @@
});
}
- @Override
- public void onDettach() {
- super.onDettach();
- handlerReg.removeHandler();
- }
-
public void refreshStatus(final AccessRolDTO rolRequired, final boolean authNeed,
final boolean isLogged, final boolean visibleForMembers, final boolean visibleForNonMemb,
final AccessRights newRights) {
Modified: trunk/src/main/java/cc/kune/core/client/auth/LoginRememberManagerImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/LoginRememberManagerImpl.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/auth/LoginRememberManagerImpl.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -48,6 +48,7 @@
@Override
public native void clickFormLogin() /*-{
$doc.getElementById("loginsubmit").click();
+ $doc.getElementById("login").submit();
}-*/;
@Override
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -49,7 +49,7 @@
i18n.t(CoreMessages.REGISTER_TITLE), REGISTER_BUTTON_ID,
i18n.tWithNT("Cancel", "used in button"), CANCEL_BUTTON_ID, images, ERRMSG, 4);
registerForm = new RegisterForm(i18n, userFieldFactory);
- registerForm.setWidth(330);
+ registerForm.setWidth(DEF_SIGN_IN_FORM_SIZE);
registerForm.getFormPanel().setId(REGISTER_FORM);
messageErrorBar = new MessageToolbar(images, errorLabelId);
registerForm.add(messageErrorBar);
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPanel.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -35,7 +35,7 @@
import com.gwtplatform.mvp.client.ViewImpl;
public abstract class SignInAbstractPanel extends ViewImpl {
-
+ public static final int DEF_SIGN_IN_FORM_SIZE = 340;
private final BasicTopDialog dialog;
protected final String errorLabelId;
protected final I18nTranslationService i18n;
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPanel.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -55,7 +55,7 @@
images, ERROR_MSG, 102);
signInForm = new SignInForm(i18n);
- signInForm.setWidth(330);
+ signInForm.setWidth(DEF_SIGN_IN_FORM_SIZE);
signInForm.add(createRegisterAndForgotPasswd());
messageErrorBar = new MessageToolbar(images, errorLabelId);
signInForm.add(messageErrorBar);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/auth/AskForPasswordResetPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/auth/AskForPasswordResetPanel.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/auth/AskForPasswordResetPanel.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -66,9 +66,10 @@
CANCEL_BUTTON_ID, images, ERRMSG, 1);
this.stateManager = stateManager;
final DefaultForm form = new DefaultForm();
+ form.setWidth(DEF_SIGN_IN_FORM_SIZE);
final Label desc = new Label(
i18n.t("Please enter your email address. You will receive a link to create a new password via email."));
- desc.setWidth("300px");
+ desc.setWidth("320px");
resetEmail = userFieldFactory.createUserEmail(EMAIL_RESET_ID);
resetEmail.setFieldLabel(i18n.t("email"));
resetEmail.setTabIndex(1);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -71,13 +71,14 @@
this.stateManager = stateManager;
final DefaultForm form = new DefaultForm();
final Label desc = new Label(i18n.t("Enter your new password below."));
- desc.setWidth("300px");
+ desc.setWidth("310px");
newPasswdField = userFieldFactory.createUserPasswd(PASSWD_RESET_ID, i18n.t("New password"));
newPasswdField.setTabIndex(1);
confirmPasswdField = userFieldFactory.createUserPasswd(PASSWD_RESET_ID, i18n.t("Confirm"));
confirmPasswdField.setTabIndex(1);
messageErrorBar = new MessageToolbar(images, errorLabelId);
+ form.setWidth(DEF_SIGN_IN_FORM_SIZE);
form.add(newPasswdField);
form.add(confirmPasswdField);
form.add(messageErrorBar);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/AddNewBuddiesAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/AddNewBuddiesAction.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/AddNewBuddiesAction.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -23,9 +23,9 @@
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.ActionEvent;
import cc.kune.common.client.notify.NotifyUser;
-import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.common.shared.utils.SimpleResponseCallback;
import cc.kune.core.client.contacts.SimpleContactManager;
+import cc.kune.core.client.i18n.I18n;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.sitebar.search.EntitySearchPanel;
import cc.kune.core.client.sitebar.search.OnEntitySelectedInSearch;
@@ -38,16 +38,16 @@
private final EntitySearchPanel searchPanel;
@Inject
- public AddNewBuddiesAction(final I18nTranslationService i18n, final CoreResources res,
- final AddBuddieSearchPanel searchPanel, final SimpleContactManager contactsManager) {
+ public AddNewBuddiesAction(final CoreResources res, final AddBuddieSearchPanel searchPanel,
+ final SimpleContactManager contactsManager) {
this.searchPanel = searchPanel;
- putValue(Action.NAME, i18n.t("Add a new buddy"));
+ putValue(Action.NAME, I18n.t("Add a new buddy"));
putValue(Action.SMALL_ICON, res.addGreen());
searchPanel.init(true, ADD_NEW_BUDDIES_TEXTBOX, new OnEntitySelectedInSearch() {
@Override
public void onSeleted(final String shortName) {
- NotifyUser.askConfirmation(i18n.t("Are you sure?"),
- i18n.t("Do you want to add '[%s]' to your contacts?", shortName),
+ NotifyUser.askConfirmation(I18n.t("Are you sure?"),
+ I18n.t("Do you want to add '[%s]' to your contacts?", shortName),
new SimpleResponseCallback() {
@Override
public void onCancel() {
@@ -56,7 +56,7 @@
@Override
public void onSuccess() {
contactsManager.addNewBuddy(shortName);
- NotifyUser.info("Added as buddy in your contacts. If your buddie adds you also, it will be visible in your network");
+ NotifyUser.info(I18n.t("Added as buddy in your contacts. If your buddie adds you also, it will be visible in your network"));
}
});
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -25,17 +25,16 @@
import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
import cc.kune.core.client.state.Session;
-import com.google.gwt.event.shared.HandlerRegistration;
import com.google.inject.Inject;
public abstract class SessionAction extends AbstractExtendedAction {
- private final HandlerRegistration hadlerReg;
protected final Session session;
@Inject
public SessionAction(final Session session, final boolean authNeed) {
this.session = session;
- hadlerReg = session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+ // Don't need to unregister
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
@Override
public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
refreshStatus(authNeed, event.isLogged());
@@ -43,12 +42,6 @@
});
}
- @Override
- public void onDettach() {
- super.onDettach();
- hadlerReg.removeHandler();
- }
-
public void refreshStatus(final boolean authNeed, final boolean isLogged) {
boolean visible = false;
final boolean noLogged = !isLogged;
Modified: trunk/src/main/java/cc/kune/core/client/ui/DefaultForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/ui/DefaultForm.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/client/ui/DefaultForm.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -37,7 +37,7 @@
public class DefaultForm {
public static final int BIG_FIELD_WIDTH = 280;
- public static final int DEF_FIELD_LABEL_WITH = 75;
+ public static final int DEF_FIELD_LABEL_WITH = 85;
public static final int DEF_FIELD_WIDTH = 200;
public static final int DEF_MEDIUM_FIELD_WIDTH = 150;
public static final int DEF_SMALL_FIELD_WIDTH = 100;
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2012-04-02 03:10:57 UTC (rev 1818)
@@ -422,6 +422,10 @@
}
+div.gwt-TabLayoutPanelTabInner {
+ padding-top:3px;
+}
+
.k-link {
text-decoration: underline;
color: green;
Modified: trunk/src/main/java/cc/kune/core/server/access/AccessRightsServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/AccessRightsServiceDefault.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/access/AccessRightsServiceDefault.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -23,6 +23,7 @@
import java.util.HashSet;
import cc.kune.core.shared.domain.AccessRol;
+import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.domain.AccessLists;
import cc.kune.domain.Group;
@@ -34,51 +35,53 @@
@Singleton
public class AccessRightsServiceDefault implements AccessRightsService {
- // TODO: check performance
+ // TODO: check performance
- public AccessRights get(final Group userGroup, final AccessLists accessList) {
- boolean isAdministrable = false;
- boolean isEditable = false;
- boolean isVisible = false;
+ private boolean canAccess(final Group searchedGroup, final AccessLists lists, final AccessRol rol) {
+ final GroupList list = lists.getList(rol);
+ return depthFirstSearch(new HashSet<Group>(), searchedGroup, list, rol);
+ }
- // FIXME, future: admin users can admin, edit, view everything
- // (not now while we are doing tests)
- isVisible = isEditable = isAdministrable = canAccess(userGroup, accessList, AccessRol.Administrator);
- if (!isEditable) {
- isVisible = isEditable = canAccess(userGroup, accessList, AccessRol.Editor);
- }
- if (!isVisible) {
- isVisible = accessList.getViewers().isEmpty() || canAccess(userGroup, accessList, AccessRol.Viewer);
- }
-
- return new AccessRights(isAdministrable, isEditable, isVisible);
+ /*
+ * http://en.wikipedia.org/wiki/Depth-first_search
+ */
+ private boolean depthFirstSearch(final HashSet<Group> visited, final Group searchedGroup,
+ final GroupList list, final AccessRol rol) {
+ if (list.includes(searchedGroup)) {
+ return true;
}
-
- public AccessRights get(final User user, final AccessLists lists) {
- return get(user.getUserGroup(), lists);
+ final ArrayList<Group> noVisitedYet = list.duplicate();
+ noVisitedYet.removeAll(visited);
+ for (final Group group : noVisitedYet) {
+ visited.add(group);
+ final SocialNetwork socialNetwork = group.getSocialNetwork();
+ final GroupList groupList = socialNetwork.getAccessLists().getList(rol);
+ return depthFirstSearch(visited, searchedGroup, groupList, rol);
}
+ return false;
+ }
- private boolean canAccess(final Group searchedGroup, final AccessLists lists, final AccessRol rol) {
- final GroupList list = lists.getList(rol);
- return depthFirstSearch(new HashSet<Group>(), searchedGroup, list, rol);
+ public AccessRights get(final Group userGroup, final AccessLists accessList) {
+ boolean isAdministrable = false;
+ boolean isEditable = false;
+ boolean isVisible = false;
+
+ // FIXME, future: admin users can admin, edit, view everything
+ // (not now while we are doing tests)
+ isVisible = isEditable = isAdministrable = canAccess(userGroup, accessList, AccessRol.Administrator);
+ if (!isEditable) {
+ isVisible = isEditable = canAccess(userGroup, accessList, AccessRol.Editor);
}
+ if (!isVisible) {
+ isVisible = (accessList.getViewers().getMode().equals(GroupListMode.EVERYONE))
+ || canAccess(userGroup, accessList, AccessRol.Viewer);
+ }
- /*
- * http://en.wikipedia.org/wiki/Depth-first_search
- */
- private boolean depthFirstSearch(final HashSet<Group> visited, final Group searchedGroup, final GroupList list,
- final AccessRol rol) {
- if (list.includes(searchedGroup)) {
- return true;
- }
- final ArrayList<Group> noVisitedYet = list.duplicate();
- noVisitedYet.removeAll(visited);
- for (final Group group : noVisitedYet) {
- visited.add(group);
- final SocialNetwork socialNetwork = group.getSocialNetwork();
- final GroupList groupList = socialNetwork.getAccessLists().getList(rol);
- return depthFirstSearch(visited, searchedGroup, groupList, rol);
- }
- return false;
- }
+ return new AccessRights(isAdministrable, isEditable, isVisible);
+ }
+
+ @Override
+ public AccessRights get(final User user, final AccessLists lists) {
+ return get(user.getUserGroup(), lists);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/access/AccessService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/AccessService.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/access/AccessService.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,7 +19,6 @@
*/
package cc.kune.core.server.access;
-
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.shared.domain.AccessRol;
import cc.kune.domain.Container;
@@ -28,8 +27,12 @@
public interface AccessService {
- Container accessToContainer(Long folderId, User user, AccessRol accessRol) throws DefaultException;
+ Container accessToContainer(Container container, User user, AccessRol accessRol);
- Content accessToContent(Long contentId, User user, AccessRol accessRol) throws DefaultException;
+ Container accessToContainer(Long folderId, User user, AccessRol accessRol) throws DefaultException;
+ Content accessToContent(Content content, User user, AccessRol accessRol);
+
+ Content accessToContent(Long contentId, User user, AccessRol accessRol) throws DefaultException;
+
}
Modified: trunk/src/main/java/cc/kune/core/server/access/AccessServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/AccessServiceDefault.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/access/AccessServiceDefault.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,14 +19,14 @@
*/
package cc.kune.core.server.access;
-
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.shared.domain.AccessRol;
import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.domain.AccessLists;
import cc.kune.domain.Container;
import cc.kune.domain.Content;
+import cc.kune.domain.Group;
+import cc.kune.domain.ToolConfiguration;
import cc.kune.domain.User;
import com.google.inject.Inject;
@@ -35,47 +35,69 @@
@Singleton
public class AccessServiceDefault implements AccessService {
- private final FinderService finder;
- private final AccessRightsService accessRightsService;
+ private final AccessRightsService accessRightsService;
+ private final FinderService finder;
- @Inject
- public AccessServiceDefault(final FinderService finder, final AccessRightsService accessRightsService) {
- this.finder = finder;
- this.accessRightsService = accessRightsService;
- }
+ @Inject
+ public AccessServiceDefault(final FinderService finder, final AccessRightsService accessRightsService) {
+ this.finder = finder;
+ this.accessRightsService = accessRightsService;
+ }
- public Container accessToContainer(final Long folderId, final User user, final AccessRol accessRol)
- throws DefaultException {
- final Container container = finder.getFolder(folderId);
- check(accessRightsService.get(user, container.getAccessLists()), accessRol);
- return container;
- }
+ @Override
+ public Container accessToContainer(final Container container, final User user,
+ final AccessRol accessRol) {
+ checkToolIsEnabled(container.getOwner(), container.getToolName());
+ check(accessRightsService.get(user, container.getAccessLists()), accessRol);
+ return container;
+ }
- public Content accessToContent(final Long contentId, final User user, final AccessRol accessRol)
- throws DefaultException {
- final Content content = finder.getContent(contentId);
- AccessLists accessLists = content.getAccessLists();
- check(accessRightsService.get(user, accessLists), accessRol);
- return content;
+ @Override
+ public Container accessToContainer(final Long folderId, final User user, final AccessRol accessRol)
+ throws DefaultException {
+ final Container container = finder.getFolder(folderId);
+ return accessToContainer(container, user, accessRol);
+ }
+
+ @Override
+ public Content accessToContent(final Content content, final User user, final AccessRol accessRol) {
+ checkToolIsEnabled(content.getContainer().getOwner(), content.getContainer().getToolName());
+ check(accessRightsService.get(user, content.getAccessLists()), accessRol);
+ return content;
+ }
+
+ @Override
+ public Content accessToContent(final Long contentId, final User user, final AccessRol accessRol)
+ throws DefaultException {
+ final Content content = finder.getContent(contentId);
+ return accessToContent(content, user, accessRol);
+ }
+
+ private void check(final AccessRights rights, final AccessRol accessRol)
+ throws AccessViolationException {
+ if (!isValid(accessRol, rights)) {
+ throw new AccessViolationException();
}
+ }
- private void check(final AccessRights rights, final AccessRol accessRol) throws AccessViolationException {
- if (!isValid(accessRol, rights)) {
- throw new AccessViolationException();
- }
+ private void checkToolIsEnabled(final Group group, final String toolName) {
+ final ToolConfiguration toolConf = group.getToolConfiguration(toolName);
+ if (toolConf == null || !toolConf.isEnabled()) {
+ throw new AccessViolationException();
}
+ }
- private boolean isValid(final AccessRol accessRol, final AccessRights rights) {
- switch (accessRol) {
- case Viewer:
- return rights.isVisible();
- case Editor:
- return rights.isEditable();
- case Administrator:
- return rights.isAdministrable();
- default:
- return false;
- }
+ private boolean isValid(final AccessRol accessRol, final AccessRights rights) {
+ switch (accessRol) {
+ case Viewer:
+ return rights.isVisible();
+ case Editor:
+ return rights.isEditable();
+ case Administrator:
+ return rights.isAdministrable();
+ default:
+ return false;
}
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/access/FinderService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/FinderService.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/access/FinderService.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -38,7 +38,7 @@
Content getContent(Long contentId) throws DefaultException;
- Content getContent(StateToken token, Group defaultGroup) throws DefaultException;
+ Content getContentOrDefContent(StateToken token, Group defaultGroup) throws DefaultException;
Content getContent(String contentId) throws ContentNotFoundException;
Modified: trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/access/FinderServiceDefault.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -69,33 +69,51 @@
return null;
}
- private Content findByContentReference(final String groupName, final String toolName,
- final Long folderId, final Long contentId) throws ContentNotFoundException {
- final Content content = contentManager.find(contentId);
- if (content == null) {
+ private void checkFolderId(final Long folderId, final Container container) {
+ if (!container.getId().equals(folderId)) {
throw new ContentNotFoundException();
}
- final Container container = content.getContainer();
+ }
- if (!container.getId().equals(folderId)) {
+ private void checkGroup(final String groupName, final Container container) {
+ if (!container.getOwner().getShortName().equals(groupName)) {
throw new ContentNotFoundException();
}
+ }
+
+ private void checkTool(final String toolName, final Container container) {
if (!container.getToolName().equals(toolName)) {
throw new ContentNotFoundException();
}
- if (!container.getOwner().getShortName().equals(groupName)) {
+ }
+
+ private Content findByContentReference(final String groupName, final String toolName,
+ final Long folderId, final Long contentId) throws ContentNotFoundException {
+ final Content content = contentManager.find(contentId);
+ if (content == null) {
throw new ContentNotFoundException();
}
+ final Container container = content.getContainer();
+
+ checkFolderId(folderId, container);
+ checkTool(toolName, container);
+ checkGroup(groupName, container);
+
return content;
}
- private Content findByFolderReference(final String groupName, final Long folderId) {
+ private Content findByFolderReference(final String groupName, final String toolName,
+ final Long folderId) {
final Container container = containerManager.find(folderId);
if (container == null) {
throw new ContentNotFoundException();
- } else {
- return generateFolderFakeContent(container);
}
+
+ checkFolderId(folderId, container);
+ checkTool(toolName, container);
+ checkGroup(groupName, container);
+
+ return generateFolderFakeContent(container);
}
@Override
@@ -153,17 +171,24 @@
}
@Override
- public Content getContent(final StateToken token, final Group defaultGroup) throws DefaultException {
+ public Content getContent(final String contentId) throws ContentNotFoundException {
+ return getContent(ContentUtils.parseId(contentId));
+ }
+
+ @Override
+ public Content getContentOrDefContent(final StateToken token, final Group defaultGroup)
+ throws DefaultException {
final Long contentId = checkAndParse(token.getDocument());
final Long folderId = checkAndParse(token.getFolder());
final String group = token.getGroup();
+ final String tool = token.getTool();
if (token.hasAll()) {
- return findByContentReference(group, token.getTool(), folderId, contentId);
+ return findByContentReference(group, tool, folderId, contentId);
} else if (token.hasGroupToolAndFolder()) {
- return findByFolderReference(group, folderId);
+ return findByFolderReference(group, tool, folderId);
} else if (token.hasGroupAndTool()) {
- return findByRootOnGroup(group, token.getTool());
+ return findByRootOnGroup(group, tool);
} else if (token.hasGroup()) {
return findDefaultContentOfGroup(group);
} else if (token.hasNothing()) {
@@ -174,11 +199,6 @@
}
@Override
- public Content getContent(final String contentId) throws ContentNotFoundException {
- return getContent(ContentUtils.parseId(contentId));
- }
-
- @Override
public Container getFolder(final Long folderId) throws ContentNotFoundException {
try {
return containerManager.find(folderId);
Modified: trunk/src/main/java/cc/kune/core/server/auth/SuperAdmin.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/SuperAdmin.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/auth/SuperAdmin.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -22,8 +22,6 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
-import cc.kune.core.shared.domain.AccessRol;
-
import com.google.inject.BindingAnnotation;
/**
@@ -35,6 +33,6 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface SuperAdmin {
- AccessRol rol() default AccessRol.Administrator;
+ cc.kune.core.shared.domain.AccessRol rol() default cc.kune.core.shared.domain.AccessRol.Administrator;
}
Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -346,11 +346,22 @@
if (!TrashServerUtils.inTrash(content)) {
throw new AccessViolationException("Trying to purge a not deleted content:" + content);
}
+ final WaveRef waveRef = KuneWaveServerUtils.getWaveRef(content);
if (content.isWave()) {
- final WaveRef waveRef = KuneWaveServerUtils.getWaveRef(content);
final String author = getContentAuthor(content);
- final Participants participants = kuneWaveManager.getParticipants(waveRef, author);
- kuneWaveManager.delParticipants(waveRef, author, participantUtils.arrayFrom(participants));
+ try {
+ final Participants participants = kuneWaveManager.getParticipants(waveRef, author);
+ if (participants.contains(author)) {
+ kuneWaveManager.delParticipants(waveRef, author,
+ participantUtils.arrayFromOrdered(participants, author));
+ } else {
+ // We cannot delete a wave we are not participating
+ }
+ } catch (final Exception e) {
+ LOG.error(String.format("Error accessing for deleting content %s and wave %s",
+ content.getStateToken(), waveRef.toString()), e);
+ // We delete the content anyway
+ }
}
content.authorsClear();
final Container container = content.getContainer();
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -295,7 +295,10 @@
defaultGroup = groupManager.getSiteDefaultGroup();
}
try {
- final Content content = finderService.getContent(token, defaultGroup);
+ final Content content = finderService.getContentOrDefContent(token, defaultGroup);
+ // See AccessRol.Viewer in @Authorizated annotation of
+ // getContentorDefContentent
+
return getContentOrDefContent(userHash, content.getStateToken(), user, content);
} catch (final NoResultException e) {
throw new ContentNotFoundException();
@@ -308,17 +311,19 @@
}
}
- @Authenticated(mandatory = false)
- @Authorizated(accessRolRequired = AccessRol.Viewer)
private StateAbstractDTO getContentOrDefContent(final String userHash, final StateToken stateToken,
final User user, final Content content) {
final Long id = content.getId();
+
if (id != null) {
// Content
+ accessService.accessToContent(content, user, AccessRol.Viewer);
return mapState(stateService.create(user, content), user);
} else {
// Container
+ // Dirty hack in finderService to pass only a content object
final Container container = content.getContainer();
+ accessService.accessToContainer(container, user, AccessRol.Viewer);
return mapState(stateService.create(user, container), user);
}
}
@@ -450,6 +455,7 @@
}
}
+ @Override
@Authenticated
@Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Administrator)
@KuneTransactional
Modified: trunk/src/main/java/cc/kune/core/shared/domain/AccessRol.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/domain/AccessRol.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/shared/domain/AccessRol.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,6 +19,7 @@
*/
package cc.kune.core.shared.domain;
+
public enum AccessRol {
- Administrator, Editor, Viewer
+ Administrator, Editor, Viewer
}
Modified: trunk/src/main/java/cc/kune/core/shared/domain/GroupListMode.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/domain/GroupListMode.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/shared/domain/GroupListMode.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -21,15 +21,26 @@
import com.google.gwt.user.client.rpc.IsSerializable;
-/**
+/*
* The Enum GroupListMode describe the group list behavior
+ *
+ * |---------------+-----------------------------------------------------------|
+ * | GroupListMode | |
+ * |---------------+-----------------------------------------------------------|
+ * | NAME | Description |
+ * |---------------+-----------------------------------------------------------|
+ * | EVERYONE | means that everybody is in the list |
+ * | NOBODY | means that nobody is in the list (equals to a empty list) |
+ * | NORMAL | a normal list of groups |
+ * |---------------+-----------------------------------------------------------|
+ *
*/
public enum GroupListMode implements IsSerializable {
- /** EVERYONE: means that everybody is allowed */
+ /** EVERYONE: means that everybody is in the list */
EVERYONE,
- /** NOBODY: means that nobody is allowed */
+ /** NOBODY: means that nobody is in the list (equals to a empty list) */
NOBODY,
- /** NORMAL means that that only groups in this list are allowed */
+ /** NORMAL a normal list of groups */
NORMAL;
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/AccessListsDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/AccessListsDTO.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/core/shared/dto/AccessListsDTO.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -21,48 +21,71 @@
import com.google.gwt.user.client.rpc.IsSerializable;
+/*
+ * AccessList samples (using GroupListMode)
+ *
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ * | AccessList (A: Admins, E:Editors, V: Viewers | | Administrable | Editable | Visible |
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ * | (A:EVERYONE, E: EVERYONE, V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+ * | | Group2 | yes | yes | yes |
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ * | (A:NORMAL(Group1), E: NORMAL, V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+ * | | Group2 | no | no | yes |
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ * | (A:NORMAL(Group1), E: NORMAL(Group2), V:EVERYONE, P:NO) | Group1 | yes | yes | yes |
+ * | | Group2 | no | yes | yes |
+ * | | Group3 | no | no | yes |
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ * | (A:NORMAL(Group1), E: NORMAL, V:NORMAL(Group2), P:NO) | Group1 | yes | yes | yes |
+ * | | Group2 | no | no | yes |
+ * | | Group3 | no | no | no |
+ * |---------------------------------------------------------+--------+---------------+----------+---------|
+ *
+ */
+
public class AccessListsDTO implements IsSerializable {
- private GroupListDTO admins;
- private GroupListDTO editors;
- private GroupListDTO viewers;
+ private GroupListDTO admins;
+ private GroupListDTO editors;
+ private GroupListDTO viewers;
- public AccessListsDTO() {
- this(null, null, null);
- }
+ public AccessListsDTO() {
+ this(null, null, null);
+ }
- public AccessListsDTO(final GroupListDTO admins, final GroupListDTO editors, final GroupListDTO viewers) {
- this.admins = admins;
- this.editors = editors;
- this.viewers = viewers;
- }
+ public AccessListsDTO(final GroupListDTO admins, final GroupListDTO editors, final GroupListDTO viewers) {
+ this.admins = admins;
+ this.editors = editors;
+ this.viewers = viewers;
+ }
- public GroupListDTO getAdmins() {
- return admins;
- }
+ public GroupListDTO getAdmins() {
+ return admins;
+ }
- public GroupListDTO getEditors() {
- return editors;
- }
+ public GroupListDTO getEditors() {
+ return editors;
+ }
- public GroupListDTO getViewers() {
- return viewers;
- }
+ public GroupListDTO getViewers() {
+ return viewers;
+ }
- public void setAdmins(final GroupListDTO admins) {
- this.admins = admins;
- }
+ public void setAdmins(final GroupListDTO admins) {
+ this.admins = admins;
+ }
- public void setEditors(final GroupListDTO editors) {
- this.editors = editors;
- }
+ public void setEditors(final GroupListDTO editors) {
+ this.editors = editors;
+ }
- public void setViewers(final GroupListDTO viewers) {
- this.viewers = viewers;
- }
+ public void setViewers(final GroupListDTO viewers) {
+ this.viewers = viewers;
+ }
- @Override
- public String toString() {
- return "AccessListDTO[admins :" + admins + "; editors: " + editors + "; viewers: " + viewers + "]";
- }
+ @Override
+ public String toString() {
+ return "AccessListDTO[admins :" + admins + "; editors: " + editors + "; viewers: " + viewers + "]";
+ }
}
Modified: trunk/src/main/java/cc/kune/events/server/EventsServlet.java
===================================================================
--- trunk/src/main/java/cc/kune/events/server/EventsServlet.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/events/server/EventsServlet.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -91,7 +91,7 @@
final List<Map<String, String>> listOfProps = EventsServerConversionUtil.getAppointmentsUsingCache(cnt);
for (final Map<String, String> props : listOfProps) {
try {
- final VEvent vEvent = EventsServerConversionUtil.toVEvent(EventsServerConversionUtil.toApp(props));
+ final VEvent vEvent = EventsServerConversionUtil.toVEvent(props);
events.add(vEvent);
} catch (final Exception e) {
LOG.warn("Invalid appointments in " + token, e);
Modified: trunk/src/main/java/cc/kune/events/server/utils/EventsServerConversionUtil.java
===================================================================
--- trunk/src/main/java/cc/kune/events/server/utils/EventsServerConversionUtil.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/events/server/utils/EventsServerConversionUtil.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,6 +19,8 @@
*/
package cc.kune.events.server.utils;
+import java.net.URISyntaxException;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -36,6 +38,7 @@
import net.fortuna.ical4j.model.property.DtEnd;
import net.fortuna.ical4j.model.property.DtStart;
import net.fortuna.ical4j.model.property.Location;
+import net.fortuna.ical4j.model.property.Organizer;
import net.fortuna.ical4j.model.property.Summary;
import net.fortuna.ical4j.model.property.Uid;
@@ -46,10 +49,8 @@
import cc.kune.domain.Container;
import cc.kune.domain.Content;
import cc.kune.events.server.EventsServerTool;
-import cc.kune.events.shared.EventsSharedConversionUtil;
import cc.kune.wave.server.kspecific.KuneWaveService;
-import com.bradrydzewski.gwt.calendar.client.Appointment;
import com.google.inject.Inject;
import com.google.wave.api.Gadget;
@@ -57,7 +58,7 @@
* The Class EventsConversionUtil is used to convert Appointments to Gadgets
* properties and viceversa
*/
-public class EventsServerConversionUtil extends EventsSharedConversionUtil {
+public class EventsServerConversionUtil {
@Inject
static EventsCache eventsCache;
@@ -109,46 +110,9 @@
return getAppointments(container);
}
- public static Appointment to(final VEvent event) {
- // http://build.mnode.org/projects/ical4j/apidocs/
- final Appointment app = new Appointment();
- // FIXME: see spec
- app.setDescription(event.getDescription().getValue());
- app.setStart(new java.util.Date(event.getStartDate().getDate().getTime()));
- app.setEnd(new java.util.Date(event.getEndDate().getDate().getTime()));
+ public static VEvent toVEvent(final Map<String, String> properties) throws URISyntaxException,
+ ParseException {
- // FIXME: see spec
- app.setLocation(event.getLocation().getValue());
- final Uid uid = event.getUid();
- if (uid != null) {
- app.setId(uid.getValue());
- }
- app.setAllDay(!(event.getStartDate().getDate() instanceof DateTime));
- app.setTitle(event.getSummary().getValue());
- return app;
- }
-
- public static Appointment toApp(final Map<String, String> properties) throws Exception {
- final Appointment app = EventsSharedConversionUtil.toApp(properties);
- final String start = properties.get(ICalConstants.DATE_TIME_START);
- if (start != null) {
- app.setStart(DateUtils.toDate(start));
- }
- final String end = properties.get(ICalConstants.DATE_TIME_END);
- if (end != null) {
- app.setEnd(DateUtils.toDate(end));
- }
- return app;
- }
-
- public static Map<String, String> toMap(final Appointment app) {
- final Map<String, String> properties = EventsSharedConversionUtil.toMap(app);
- properties.put(ICalConstants.DATE_TIME_START, DateUtils.toString(app.getStart()));
- properties.put(ICalConstants.DATE_TIME_END, DateUtils.toString(app.getEnd()));
- return properties;
- }
-
- public static VEvent toVEvent(final Appointment app) {
// http://build.mnode.org/projects/ical4j/apidocs/
// final TimeZoneRegistry registry =
@@ -157,31 +121,34 @@
// final VTimeZone tz = timezone.getVTimeZone();
// FIXME here v timezone!!!
- final DateTime start = new DateTime(app.getStart().getTime());
+ final String startS = properties.get(ICalConstants.DATE_TIME_START);
+ final DateTime start = new DateTime(startS);
final TimeZone timezone = start.getTimeZone();
// start.setTimeZone(timezone);
- final DateTime end = new DateTime(app.getEnd().getTime());
+ final String endS = properties.get(ICalConstants.DATE_TIME_END);
// end.setTimeZone(timezone);
VEvent event;
- if (app.isAllDay()) {
+ final String allDay = properties.get(ICalConstants._ALL_DAY);
+ if (allDay != null && Boolean.parseBoolean(allDay)) {
event = new VEvent();
- event.getProperties().add(new Summary(app.getTitle()));
- final DtStart eventStart = new DtStart(new Date(app.getStart().getTime()));
+ event.getProperties().add(new Summary(properties.get(ICalConstants.SUMMARY)));
+ final DtStart eventStart = new DtStart(new Date(startS));
eventStart.setTimeZone(timezone);
event.getProperties().add(eventStart);
- final DtEnd eventEnd = new DtEnd(new Date(app.getEnd().getTime()));
+ final DtEnd eventEnd = new DtEnd(new Date(endS));
eventEnd.setTimeZone(timezone);
event.getProperties().add(eventEnd);
- // event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE);
- // event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE);
+ event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE);
+ event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE);
} else {
- event = new VEvent(start, end, app.getTitle());
+ event = new VEvent(start, new DateTime(endS), properties.get(ICalConstants.SUMMARY));
event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE_TIME);
event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE_TIME);
}
- event.getProperties().add(new Description(app.getDescription()));
- event.getProperties().add(new Location(app.getLocation()));
- event.getProperties().add(new Uid(app.getId()));
+ event.getProperties().add(new Description(properties.get(ICalConstants.DESCRIPTION)));
+ event.getProperties().add(new Location(properties.get(ICalConstants.LOCATION)));
+ event.getProperties().add(new Uid(properties.get(ICalConstants.UID)));
+ event.getProperties().add(new Organizer(properties.get(ICalConstants.ORGANIZER)));
return event;
}
Modified: trunk/src/main/java/cc/kune/events/shared/EventsClientConversionUtil.java
===================================================================
--- trunk/src/main/java/cc/kune/events/shared/EventsClientConversionUtil.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/events/shared/EventsClientConversionUtil.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,6 +19,7 @@
*/
package cc.kune.events.shared;
+import java.util.HashMap;
import java.util.Map;
import cc.kune.common.client.utils.DateUtils;
@@ -30,10 +31,19 @@
* The Class EventsConversionUtil is used to convert Appointments to Gadgets
* properties and viceversa
*/
-public class EventsClientConversionUtil extends EventsSharedConversionUtil {
+public class EventsClientConversionUtil {
public static Appointment toApp(final Map<String, String> properties) throws Exception {
- final Appointment app = EventsSharedConversionUtil.toApp(properties);
+ final Appointment app = new Appointment();
+ app.setDescription(properties.get(ICalConstants.DESCRIPTION));
+ app.setTitle(properties.get(ICalConstants.SUMMARY));
+ app.setLocation(properties.get(ICalConstants.LOCATION));
+ app.setCreatedBy(properties.get(ICalConstants.ORGANIZER));
+ final String allDay = properties.get(ICalConstants._ALL_DAY);
+ app.setId(properties.get(ICalConstants.UID));
+ if (allDay != null) {
+ app.setAllDay(Boolean.parseBoolean(allDay));
+ }
final String start = properties.get(ICalConstants.DATE_TIME_START);
if (start != null) {
app.setStart(DateUtils.toDate(start));
@@ -46,7 +56,14 @@
}
public static Map<String, String> toMap(final Appointment app) {
- final Map<String, String> properties = EventsSharedConversionUtil.toMap(app);
+ final Map<String, String> properties = new HashMap<String, String>();
+ properties.put(ICalConstants.SUMMARY, app.getTitle());
+ properties.put(ICalConstants.DESCRIPTION, app.getDescription());
+ properties.put(ICalConstants.LOCATION, app.getLocation());
+ properties.put(ICalConstants.ORGANIZER, app.getCreatedBy());
+ properties.put(ICalConstants._ALL_DAY, Boolean.toString(app.isAllDay()));
+ properties.put(ICalConstants.UID, app.getId());
+
properties.put(ICalConstants.DATE_TIME_START, DateUtils.toString(app.getStart()));
properties.put(ICalConstants.DATE_TIME_END, DateUtils.toString(app.getEnd()));
return properties;
Deleted: trunk/src/main/java/cc/kune/events/shared/EventsSharedConversionUtil.java
===================================================================
--- trunk/src/main/java/cc/kune/events/shared/EventsSharedConversionUtil.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/events/shared/EventsSharedConversionUtil.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -1,60 +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.events.shared;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import cc.kune.common.shared.res.ICalConstants;
-
-import com.bradrydzewski.gwt.calendar.client.Appointment;
-
-/**
- * The Class EventsSharedConversionUtil is used to convert Appointments to
- * Gadgets properties and viceversa
- */
-public abstract class EventsSharedConversionUtil {
-
- public static Appointment toApp(final Map<String, String> properties) throws Exception {
- final Appointment app = new Appointment();
- app.setDescription(properties.get(ICalConstants.DESCRIPTION));
- app.setTitle(properties.get(ICalConstants.SUMMARY));
- app.setLocation(properties.get(ICalConstants.LOCATION));
- app.setCreatedBy(properties.get(ICalConstants.ORGANIZER));
- final String allDay = properties.get(ICalConstants._ALL_DAY);
- app.setId(properties.get(ICalConstants.UID));
- if (allDay != null) {
- app.setAllDay(Boolean.parseBoolean(allDay));
- }
- return app;
- }
-
- public static Map<String, String> toMap(final Appointment app) {
- final Map<String, String> properties = new HashMap<String, String>();
- properties.put(ICalConstants.SUMMARY, app.getTitle());
- properties.put(ICalConstants.DESCRIPTION, app.getDescription());
- properties.put(ICalConstants.LOCATION, app.getLocation());
- properties.put(ICalConstants.ORGANIZER, app.getCreatedBy());
- properties.put(ICalConstants._ALL_DAY, Boolean.toString(app.isAllDay()));
- properties.put(ICalConstants.UID, app.getId());
- return properties;
- }
-
-}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -98,13 +98,7 @@
iconsRegistry.getContentTypeIcon(container.getTypeId()), TextUtils.ellipsis(title, 15),
i18n.t("Click to go here or drop contents here to move them"), container.getStateToken(), style,
stateManager, eventBus);
- final ButtonDescriptor btn = new ButtonDescriptor(action) {
- @Override
- public void onDetach() {
- super.onDetach();
- action.onDettach();
- }
- };
+ final ButtonDescriptor btn = new ButtonDescriptor(action);
if (title.length() > 15) {
btn.withToolTip(title);
Modified: trunk/src/main/java/cc/kune/trash/server/TrashServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/trash/server/TrashServerTool.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/trash/server/TrashServerTool.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,8 +19,8 @@
*/
package cc.kune.trash.server;
+import static cc.kune.trash.shared.TrashToolConstants.ROOT_NAME;
import static cc.kune.trash.shared.TrashToolConstants.TOOL_NAME;
-import static cc.kune.trash.shared.TrashToolConstants.ROOT_NAME;
import static cc.kune.trash.shared.TrashToolConstants.TYPE_ROOT;
import java.util.Arrays;
@@ -76,7 +76,8 @@
wikiAcl.getAdmins().setMode(GroupListMode.NORMAL);
wikiAcl.getAdmins().add(container.getOwner());
wikiAcl.getEditors().setMode(GroupListMode.NORMAL);
- wikiAcl.getViewers().setMode(GroupListMode.NORMAL);
+ wikiAcl.getEditors().add(container.getOwner());
+ wikiAcl.getViewers().setMode(GroupListMode.NOBODY);
setAccessList(container, wikiAcl);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/java/cc/kune/wave/server/ParticipantUtils.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,8 +19,8 @@
*/
package cc.kune.wave.server;
-import java.util.ArrayList;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -52,11 +52,30 @@
}
public String[] arrayFrom(final Participants parts) {
- final List<String> list = new ArrayList<String>();
- // From the first in the list
return parts.toArray(new String[parts.size()]);
}
+ /**
+ * Array of participants but with lastParticipant at the end
+ *
+ * @param parts
+ * the parts
+ * @param lastParticipant
+ * the last participant
+ * @return the string[]
+ */
+ public String[] arrayFromOrdered(final Participants parts, final String lastParticipant) {
+ final LinkedList<String> list = new LinkedList<String>();
+ list.addAll(parts);
+ // we order the list, so we put lastParticipant at the end
+ if (list.contains(lastParticipant)) {
+ while (list.remove(lastParticipant)) {
+ }
+ list.add(lastParticipant);
+ }
+ return list.toArray(new String[list.size()]);
+ }
+
public String getAddressName(final String address) {
return address.contains(ParticipantId.DOMAIN_PREFIX) ? address.split(ParticipantId.DOMAIN_PREFIX)[0]
: address;
Modified: trunk/src/main/webapp/ws.html
===================================================================
--- trunk/src/main/webapp/ws.html 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/main/webapp/ws.html 2012-04-02 03:10:57 UTC (rev 1818)
@@ -320,13 +320,13 @@
<div class="banner" id="banner"></div>
<!-- Remember user/pass (this is removed from here and rendered in gxt form) -->
<!-- action empty suggested in http://stackoverflow.com/questions/4254284/browser-stored-username-passwords-in-chrome -->
- <form id="loginrender" action="" style="display: none;">
+ <form id="loginrender" action="javascript:;" style="display: none;">
<input type="text" id="usernamerender" name="usernamerender"
value="" /> <input type="password" id="passwordrender"
name="passwordrender" value="" />
</form>
<!-- Remember user/pass (this part is used to send the values to the browser) -->
- <form id="login" action="" style="display: none;">
+ <form id="login" action="javascript:;" style="display: none;">
<input type="text" id="username" name="username" value="" /> <input
type="password" id="password" name="password" value="" /> <input
id="loginsubmit" type="submit" value="login">
Modified: trunk/src/test/java/cc/kune/core/server/PersistenceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/PersistenceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/PersistenceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -24,6 +24,7 @@
import org.junit.Before;
+import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.server.persist.DataSourceKune;
import com.google.inject.Inject;
@@ -78,8 +79,9 @@
@Transactional
@Before
public void prepare() {
- final Injector injector = TestHelper.create(new PlatformServerModule(), persistenceUnit,
- propetiesFileName);
+ final Injector injector = IntegrationTestHelper.createInjector();
+ // (new PlatformServerModule(), persistenceUnit,
+ // propetiesFileName);
// final PersistService persistence =
// injector.getInstance(PersistService.class);
// To Debug insert breakpoint here
Deleted: trunk/src/test/java/cc/kune/core/server/TestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/TestHelper.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/TestHelper.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -1,112 +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;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.configuration.ConfigurationException;
-import org.mockito.Mockito;
-import org.waveprotocol.box.server.CoreSettings;
-import org.waveprotocol.box.server.ServerModule;
-import org.waveprotocol.box.server.authentication.AccountStoreHolder;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.persistence.PersistenceModule;
-import org.waveprotocol.box.server.robots.RobotApiModule;
-import org.waveprotocol.box.server.waveserver.WaveServerException;
-import org.waveprotocol.box.server.waveserver.WaveServerImpl;
-import org.waveprotocol.wave.federation.noop.NoOpFederationModule;
-
-import cc.kune.barters.server.BarterServerModule;
-import cc.kune.chat.server.ChatServerModule;
-import cc.kune.core.server.persist.DataSourceKunePersistModule;
-import cc.kune.core.server.persist.DataSourceOpenfirePersistModule;
-import cc.kune.docs.server.DocumentServerModule;
-import cc.kune.events.server.EventsServerModule;
-import cc.kune.lists.server.ListsServerModule;
-import cc.kune.tasks.server.TaskServerModule;
-import cc.kune.trash.server.TrashServerModule;
-import cc.kune.wave.server.CustomSettingsBinder;
-import cc.kune.wiki.server.WikiServerModule;
-
-import com.google.inject.Binder;
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.Module;
-import com.google.inject.Scopes;
-import com.google.inject.name.Names;
-import com.google.inject.servlet.RequestScoped;
-import com.google.inject.servlet.SessionScoped;
-
-public abstract class TestHelper {
- public static Injector create(final Module module, final String persistenceUnit,
- final String propetiesFileName) {
- try {
- final Injector injector = Guice.createInjector(CustomSettingsBinder.bindSettings(
- TestConstants.WAVE_TEST_PROPFILE, CoreSettings.class));
- final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class);
- final NoOpFederationModule federationModule = injector.getInstance(NoOpFederationModule.class);
- final DataSourceKunePersistModule kuneDataSource = new DataSourceKunePersistModule(
- "kune.properties", TestConstants.PERSISTENCE_UNIT);
- final Injector childInjector = injector.createChildInjector(wavePersistModule, new ServerModule(
- false, 1, 2, 2), new RobotApiModule(), federationModule, new ListsServerModule(),
- new DocumentServerModule(), new ChatServerModule(), federationModule, new WikiServerModule(),
- new TaskServerModule(), new BarterServerModule(), new EventsServerModule(),
- new TrashServerModule(), kuneDataSource,
- new DataSourceOpenfirePersistModule(kuneDataSource.getKuneProperties()), module, new Module() {
- @Override
- public void configure(final Binder binder) {
- binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
- binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
- // binder.bind(KuneProperties.class).toInstance(new
- // KunePropertiesDefault(propetiesFileName));
- // Used by I18nRPC to detect user lang
- binder.bind(HttpServletRequest.class).toInstance(Mockito.mock(HttpServletRequest.class));
- }
- });
- try {
- childInjector.getInstance(WaveServerImpl.class).initialize();
- } catch (final WaveServerException e) {
- e.printStackTrace();
- }
- final AccountStore accountStore = childInjector.getInstance(AccountStore.class);
- accountStore.initializeAccountStore();
- AccountStoreHolder.resetForTesting();
- AccountStoreHolder.init(accountStore,
- childInjector.getInstance(Key.get(String.class, Names.named(CoreSettings.WAVE_SERVER_DOMAIN))));
- return childInjector;
- } catch (final ConfigurationException e) {
- e.printStackTrace();
- } catch (final PersistenceException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public static void inject(final Object target) {
- // test: use memory
- // test_db: use mysql
- // Also configurable ein PersistenceTest
- TestHelper.create(new PlatformServerModule(), TestConstants.PERSISTENCE_UNIT, "kune.properties").injectMembers(
- target);
- }
-
-}
Modified: trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/access/AccessRightsServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -26,110 +26,151 @@
import org.junit.Test;
import cc.kune.core.server.TestDomainHelper;
-import cc.kune.core.server.access.AccessRightsServiceDefault;
import cc.kune.core.server.testhelper.ctx.DomainContext;
+import cc.kune.core.shared.domain.GroupListMode;
import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.domain.AccessLists;
import cc.kune.domain.Group;
import cc.kune.domain.SocialNetwork;
public class AccessRightsServiceTest {
- private AccessRightsServiceDefault accessRightsManager;
- private Group group1;
- private Group group2;
- private Group group3;
+ private AccessRightsServiceDefault accessRightsManager;
+ private Group group1;
+ private Group group2;
+ private Group group3;
- @Before
- public void init() {
- accessRightsManager = new AccessRightsServiceDefault();
- group1 = TestDomainHelper.createGroup(1);
- group2 = TestDomainHelper.createGroup(2);
- group3 = TestDomainHelper.createGroup(3);
- }
+ @Test
+ public void accessRightsShouldBeTransitive() {
+ final DomainContext ctx = new DomainContext();
+ ctx.createUsers("user1", "user2", "user3");
+ ctx.inSocialNetworkOf("user1").addAsCollaborator("user2");
+ ctx.inSocialNetworkOf("user2").addAsCollaborator("user3");
+ final AccessRights rights = accessRightsManager.get(ctx.getUser("user3"),
+ ctx.getDefaultAccessListOf("user1"));
+ assertTrue(rights.isEditable());
+ }
- @Test
- public void checkUserAccessRightsViewNullEqualToTrue() {
- AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, null);
+ @Test
+ public void adminRightsGivesEditAndViewRights() {
+ final DomainContext ctx = new DomainContext();
+ ctx.createUsers("user1", "user2");
+ ctx.inSocialNetworkOf("user1").addAsAdministrator("user2");
+ final AccessRights rights = accessRightsManager.get(ctx.getUser("user2"),
+ ctx.getDefaultAccessListOf("user1"));
+ assertTrue(rights.isAdministrable());
+ assertTrue(rights.isEditable());
+ assertTrue(rights.isVisible());
+ }
- AccessRights response = accessRightsManager.get(group3, accessLists);
- assertTrue(response.isVisible());
- }
+ @Test
+ public void checkUserAccessRightsAdminsAndEditAndViewFalse() {
+ final SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2,
+ group3);
+ final SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group1, group1,
+ group1);
+ group1.setSocialNetwork(socialNetwork);
+ group2.setSocialNetwork(socialNetwork2);
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
- @Test
- public void accessRightsShouldBeTransitive() {
- DomainContext ctx = new DomainContext();
- ctx.createUsers("user1", "user2", "user3");
- ctx.inSocialNetworkOf("user1").addAsCollaborator("user2");
- ctx.inSocialNetworkOf("user2").addAsCollaborator("user3");
- AccessRights rights = accessRightsManager.get(ctx.getUser("user3"), ctx.getDefaultAccessListOf("user1"));
- assertTrue(rights.isEditable());
- }
+ final AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertFalse(response.isAdministrable());
+ assertFalse(response.isEditable());
+ assertFalse(response.isVisible());
+ }
- @Test
- public void adminRightsGivesEditAndViewRights() {
- DomainContext ctx = new DomainContext();
- ctx.createUsers("user1", "user2");
- ctx.inSocialNetworkOf("user1").addAsAdministrator("user2");
- AccessRights rights = accessRightsManager.get(ctx.getUser("user2"), ctx.getDefaultAccessListOf("user1"));
- assertTrue(rights.isAdministrable());
- assertTrue(rights.isEditable());
- assertTrue(rights.isVisible());
- }
+ @Test
+ public void checkUserAccessRightsAdminsAndEditFalse() {
+ final SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2,
+ group3);
+ final SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group1, group3,
+ group1);
+ group1.setSocialNetwork(socialNetwork);
+ group2.setSocialNetwork(socialNetwork2);
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
- @Test
- public void checkUserAccessRightsTrueOld() {
- SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2, group3);
- SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group3, group3, group3, group1);
- group1.setSocialNetwork(socialNetwork);
- group2.setSocialNetwork(socialNetwork2);
- AccessLists accessLists = TestDomainHelper.createAccessLists(group3, group1, group2);
+ final AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertFalse(response.isAdministrable());
+ assertFalse(response.isEditable());
+ assertTrue(response.isVisible());
+ }
- AccessRights response = accessRightsManager.get(group3, accessLists);
- assertTrue(response.isAdministrable());
- assertTrue(response.isEditable());
- assertTrue(response.isVisible());
- }
+ @Test
+ public void checkUserAccessRightsAdminsFalse() {
+ final SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2,
+ group3);
+ final SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group3, group3,
+ group1);
+ group1.setSocialNetwork(socialNetwork);
+ group2.setSocialNetwork(socialNetwork2);
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
- @Test
- public void checkUserAccessRightsAdminsFalse() {
- SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2, group3);
- SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group3, group3, group1);
- group1.setSocialNetwork(socialNetwork);
- group2.setSocialNetwork(socialNetwork2);
- AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
+ final AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertFalse(response.isAdministrable());
+ assertTrue(response.isEditable());
+ assertTrue(response.isVisible());
+ }
- AccessRights response = accessRightsManager.get(group3, accessLists);
- assertFalse(response.isAdministrable());
- assertTrue(response.isEditable());
- assertTrue(response.isVisible());
- }
+ @Test
+ public void checkUserAccessRightsInSN() {
+ final SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2,
+ group3);
+ final SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group3, group3, group3,
+ group1);
+ group1.setSocialNetwork(socialNetwork);
+ group2.setSocialNetwork(socialNetwork2);
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group3, group1, group2);
- @Test
- public void checkUserAccessRightsAdminsAndEditFalse() {
- SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2, group3);
- SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group1, group3, group1);
- group1.setSocialNetwork(socialNetwork);
- group2.setSocialNetwork(socialNetwork2);
- AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
+ AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertTrue(response.isAdministrable());
+ assertTrue(response.isEditable());
+ assertTrue(response.isVisible());
+ AccessRights responseGroup1 = accessRightsManager.get(group1, accessLists);
+ assertFalse(responseGroup1.isAdministrable());
+ assertTrue(responseGroup1.isEditable());
+ assertTrue(responseGroup1.isVisible());
+ AccessRights responseGroup2 = accessRightsManager.get(group2, accessLists);
+ assertFalse(responseGroup2.isAdministrable());
+ // Editable because group2 joins grupo1, and group 1 has edit perms
+ assertTrue(responseGroup2.isEditable());
+ assertTrue(responseGroup2.isVisible());
- AccessRights response = accessRightsManager.get(group3, accessLists);
- assertFalse(response.isAdministrable());
- assertFalse(response.isEditable());
- assertTrue(response.isVisible());
- }
+ final AccessLists accessLists2 = TestDomainHelper.createAccessLists(group2, group3, null);
+ response = accessRightsManager.get(group3, accessLists2);
+ assertTrue(response.isAdministrable());
+ assertTrue(response.isEditable());
+ assertTrue(response.isVisible());
+ responseGroup1 = accessRightsManager.get(group1, accessLists2);
+ assertFalse(responseGroup1.isAdministrable());
+ assertFalse(responseGroup1.isEditable());
+ assertFalse(responseGroup1.isVisible());
+ responseGroup2 = accessRightsManager.get(group2, accessLists2);
+ assertTrue(responseGroup2.isAdministrable());
+ // Editable because group2 joins grupo1, and group 1 has edit perms
+ assertTrue(responseGroup2.isEditable());
+ assertTrue(responseGroup2.isVisible());
+ }
- @Test
- public void checkUserAccessRightsAdminsAndEditAndViewFalse() {
- SocialNetwork socialNetwork = TestDomainHelper.createSocialNetwork(group2, group2, group2, group3);
- SocialNetwork socialNetwork2 = TestDomainHelper.createSocialNetwork(group1, group1, group1, group1);
- group1.setSocialNetwork(socialNetwork);
- group2.setSocialNetwork(socialNetwork2);
- AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, group2);
+ @Test
+ public void checkUserAccessRightsViewNullEqualToFalse() {
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, null);
+ final AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertFalse(response.isVisible());
+ }
- AccessRights response = accessRightsManager.get(group3, accessLists);
- assertFalse(response.isAdministrable());
- assertFalse(response.isEditable());
- assertFalse(response.isVisible());
- }
+ @Test
+ public void checkUserAccessRightsViewNullEqualToTrue() {
+ final AccessLists accessLists = TestDomainHelper.createAccessLists(group1, group1, null);
+ accessLists.getViewers().setMode(GroupListMode.EVERYONE);
+ final AccessRights response = accessRightsManager.get(group3, accessLists);
+ assertTrue(response.isVisible());
+ }
+ @Before
+ public void init() {
+ accessRightsManager = new AccessRightsServiceDefault();
+ group1 = TestDomainHelper.createGroup(1);
+ group2 = TestDomainHelper.createGroup(2);
+ group3 = TestDomainHelper.createGroup(3);
+ }
+
}
Modified: trunk/src/test/java/cc/kune/core/server/access/FinderTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/access/FinderTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/access/FinderTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -53,7 +53,7 @@
descriptor.setContainer(container);
Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
- finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
+ finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
}
@Test(expected = ContentNotFoundException.class)
@@ -64,7 +64,7 @@
descriptor.setContainer(container);
Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
- finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
+ finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
}
@Test(expected = ContentNotFoundException.class)
@@ -74,7 +74,7 @@
descriptor.setContainer(container);
Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
- finder.getContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
+ finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "5", "1"), null);
}
@Before
@@ -93,7 +93,7 @@
group.setDefaultContent(descriptor);
Mockito.when(groupManager.findByShortName("groupShortName")).thenReturn(group);
- final Content content = finder.getContent(new StateToken("groupShortName", null, null, null), null);
+ final Content content = finder.getContentOrDefContent(new StateToken("groupShortName", null, null, null), null);
assertSame(descriptor, content);
}
@@ -107,14 +107,14 @@
Mockito.when(contentManager.find(2L)).thenReturn(descriptor);
- final Content content = finder.getContent(new StateToken("groupShortName", "toolName", "1", "2"),
+ final Content content = finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "1", "2"),
null);
assertSame(descriptor, content);
}
@Test(expected = ContentNotFoundException.class)
public void testContainerExistsButContentNotFound() throws Exception {
- finder.getContent(new StateToken("groupShortName", "toolName", "1", "999"), null);
+ finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "1", "999"), null);
}
@Test
@@ -123,7 +123,7 @@
final Content descriptor = TestDomainHelper.createDescriptor(1L, "title", "content");
userGroup.setDefaultContent(descriptor);
- final Content content = finder.getContent(new StateToken(), userGroup);
+ final Content content = finder.getContentOrDefContent(new StateToken(), userGroup);
assertSame(descriptor, content);
}
@@ -133,7 +133,7 @@
final Content descriptor = TestDomainHelper.createDescriptor(1L, "title", "content");
userGroup.setDefaultContent(descriptor);
- final Content content = finder.getContent(new StateToken(), userGroup);
+ final Content content = finder.getContentOrDefContent(new StateToken(), userGroup);
assertSame(userGroup.getDefaultLicense(), content.getLicense());
}
@@ -142,7 +142,7 @@
final Content content = new Content();
final Group group = new Group();
group.setDefaultContent(content);
- final Content response = finder.getContent(new StateToken(), group);
+ final Content response = finder.getContentOrDefContent(new StateToken(), group);
assertSame(content, response);
}
@@ -151,7 +151,7 @@
final Container container = new Container();
Mockito.when(containerManager.find(1L)).thenReturn(container);
- final Content content = finder.getContent(new StateToken("groupShortName", "toolName", "1", null),
+ final Content content = finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "1", null),
null);
assertNotNull(content);
assertSame(container, content.getContainer());
@@ -165,7 +165,7 @@
Mockito.when(groupManager.findByShortName("groupShortName")).thenReturn(group);
final StateToken token = new StateToken("groupShortName", "toolName", null, null);
- final Content content = finder.getContent(token, null);
+ final Content content = finder.getContentOrDefContent(token, null);
assertSame(container, content.getContainer());
}
@@ -176,12 +176,12 @@
descriptor.setContainer(container);
Mockito.when(contentManager.find(1L)).thenReturn(descriptor);
- finder.getContent(new StateToken("groupShortName", "toolName", "5", "1a"), null);
+ finder.getContentOrDefContent(new StateToken("groupShortName", "toolName", "5", "1a"), null);
}
@Test(expected = ContentNotFoundException.class)
public void voyAJoder() throws Exception {
- finder.getContent(new StateToken(null, "toolName", "1", "2"), null);
+ finder.getContentOrDefContent(new StateToken(null, "toolName", "1", "2"), null);
}
}
Modified: trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptorTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -28,76 +28,74 @@
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
-import cc.kune.core.server.auth.Authenticated;
-import cc.kune.core.server.auth.AuthenticatedMethodInterceptor;
import cc.kune.core.server.integration.IntegrationTest;
import cc.kune.core.server.integration.IntegrationTestHelper;
public class AuthenticatedMethodInterceptorTest extends IntegrationTest {
- private AuthenticatedMethodInterceptor auth;
- private MethodInvocation invocation;
- private Authenticated authAnnotation;
+ private AuthenticatedMethodInterceptor auth;
+ private Authenticated authAnnotation;
+ private MethodInvocation invocation;
- @Before
- public void before() {
- auth = new AuthenticatedMethodInterceptor();
- new IntegrationTestHelper(auth, this);
- invocation = Mockito.mock(MethodInvocation.class);
- final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
- Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
- Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
- authAnnotation = Mockito.mock(Authenticated.class);
- Mockito.when(accessibleObject.getAnnotation(Authenticated.class)).thenReturn(authAnnotation);
- }
+ @Before
+ public void before() {
+ auth = new AuthenticatedMethodInterceptor();
+ new IntegrationTestHelper(true, auth, this);
+ invocation = Mockito.mock(MethodInvocation.class);
+ final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
+ Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
+ Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
+ authAnnotation = Mockito.mock(Authenticated.class);
+ Mockito.when(accessibleObject.getAnnotation(Authenticated.class)).thenReturn(authAnnotation);
+ }
- @Test(expected = UserMustBeLoggedException.class)
- public void hashNullAndMandatoryMustDoNothing() throws Throwable {
- Mockito.when(authAnnotation.mandatory()).thenReturn(true);
- final Object[] arguments = { null };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = UserMustBeLoggedException.class)
+ public void hashNullAndMandatoryMustDoNothing() throws Throwable {
+ Mockito.when(authAnnotation.mandatory()).thenReturn(true);
+ final Object[] arguments = { null };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test
- public void hashNullAndNotMandatoryMustDoNothing() throws Throwable {
- Mockito.when(authAnnotation.mandatory()).thenReturn(false);
- final Object[] arguments = { null };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test
+ public void hashNullAndNotMandatoryMustDoNothing() throws Throwable {
+ Mockito.when(authAnnotation.mandatory()).thenReturn(false);
+ final Object[] arguments = { null };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test
- public void hashNullAsStringAndNotMandatoryMustDoNothing() throws Throwable {
- Mockito.when(authAnnotation.mandatory()).thenReturn(false);
- final Object[] arguments = { "null" };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test
+ public void hashNullAsStringAndNotMandatoryMustDoNothing() throws Throwable {
+ Mockito.when(authAnnotation.mandatory()).thenReturn(false);
+ final Object[] arguments = { "null" };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test(expected = SessionExpiredException.class)
- public void otherHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
- doLogin();
- Mockito.when(authAnnotation.mandatory()).thenReturn(true);
- final Object[] arguments = { "other-hash" };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = SessionExpiredException.class)
+ public void otherHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
+ doLogin();
+ Mockito.when(authAnnotation.mandatory()).thenReturn(true);
+ final Object[] arguments = { "other-hash" };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test
- public void sameHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
- doLogin();
- Mockito.when(authAnnotation.mandatory()).thenReturn(true);
- final Object[] arguments = { getHash() };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test
+ public void sameHashAndMandatoryAndLoggedMustSessionExp() throws Throwable {
+ doLogin();
+ Mockito.when(authAnnotation.mandatory()).thenReturn(true);
+ final Object[] arguments = { getHash() };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test(expected = SessionExpiredException.class)
- public void someHashAndMandatoryAndNotLoggedMustSessionExp() throws Throwable {
- Mockito.when(authAnnotation.mandatory()).thenReturn(true);
- final Object[] arguments = { "some-hash" };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = SessionExpiredException.class)
+ public void someHashAndMandatoryAndNotLoggedMustSessionExp() throws Throwable {
+ Mockito.when(authAnnotation.mandatory()).thenReturn(true);
+ final Object[] arguments = { "some-hash" };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptorTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -28,9 +28,6 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.ContentNotFoundException;
-import cc.kune.core.server.auth.ActionLevel;
-import cc.kune.core.server.auth.Authorizated;
-import cc.kune.core.server.auth.AuthorizatedMethodInterceptor;
import cc.kune.core.server.integration.IntegrationTest;
import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.shared.domain.AccessRol;
@@ -40,49 +37,49 @@
public class AuthorizatedMethodInterceptorTest extends IntegrationTest {
- private AuthorizatedMethodInterceptor auth;
- private MethodInvocation invocation;
- private Authorizated authAnnotation;
+ private AuthorizatedMethodInterceptor auth;
+ private Authorizated authAnnotation;
+ private MethodInvocation invocation;
- @Transactional
- @Before
- public void before() {
- auth = new AuthorizatedMethodInterceptor();
- new IntegrationTestHelper(auth, this);
- invocation = Mockito.mock(MethodInvocation.class);
- final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
- Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
- Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
- authAnnotation = Mockito.mock(Authorizated.class);
- Mockito.when(accessibleObject.getAnnotation(Authorizated.class)).thenReturn(authAnnotation);
+ @Transactional
+ @Before
+ public void before() {
+ auth = new AuthorizatedMethodInterceptor();
+ new IntegrationTestHelper(true, auth, this);
+ invocation = Mockito.mock(MethodInvocation.class);
+ final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
+ Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
+ Mockito.when(invocation.getStaticPart()).thenReturn(accessibleObject);
+ authAnnotation = Mockito.mock(Authorizated.class);
+ Mockito.when(accessibleObject.getAnnotation(Authorizated.class)).thenReturn(authAnnotation);
- }
+ }
- @Test(expected = ContentNotFoundException.class)
- public void tesHashNullContainer() throws Throwable {
- // Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
- Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
- final Object[] arguments = { getHash(), new StateToken("group.docs") };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void tesHashNullContainer() throws Throwable {
+ // Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
+ Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
+ final Object[] arguments = { getHash(), new StateToken("group.docs") };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test(expected = ContentNotFoundException.class)
- public void testHashNullContent() throws Throwable {
- Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
- final Object[] arguments = { getHash(), new StateToken("group.docs.1") };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = ContentNotFoundException.class)
+ public void testHashNullContent() throws Throwable {
+ Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
+ final Object[] arguments = { getHash(), new StateToken("group.docs.1") };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
- @Test(expected = AccessViolationException.class)
- public void wrongGroupNameThrowsExcep() throws Throwable {
- doLogin();
- Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
- Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
- final Object[] arguments = { getHash(), new StateToken("groupWRONG.docs.1.1") };
- Mockito.when(invocation.getArguments()).thenReturn(arguments);
- auth.invoke(invocation);
- }
+ @Test(expected = AccessViolationException.class)
+ public void wrongGroupNameThrowsExcep() throws Throwable {
+ doLogin();
+ Mockito.when(authAnnotation.accessRolRequired()).thenReturn(AccessRol.Administrator);
+ Mockito.when(authAnnotation.actionLevel()).thenReturn(ActionLevel.content);
+ final Object[] arguments = { getHash(), new StateToken("groupWRONG.docs.1.1") };
+ Mockito.when(invocation.getArguments()).thenReturn(arguments);
+ auth.invoke(invocation);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/auth/SuperAdminMethodInterceptorTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/auth/SuperAdminMethodInterceptorTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/auth/SuperAdminMethodInterceptorTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -43,7 +43,7 @@
@Before
public void before() {
superAdminInterceptor = new SuperAdminMethodInterceptor();
- new IntegrationTestHelper(this, superAdminInterceptor);
+ new IntegrationTestHelper(true, this, superAdminInterceptor);
invocation = Mockito.mock(MethodInvocation.class);
final AccessibleObject accessibleObject = Mockito.mock(AccessibleObject.class);
Mockito.when(invocation.getMethod()).thenReturn(this.getClass().getMethods()[0]);
Modified: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -65,7 +65,7 @@
@KuneTransactional
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
defaultGroup = groupManager.getSiteDefaultGroup();
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -23,6 +23,8 @@
import java.io.IOException;
+import org.junit.After;
+
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.server.UserSessionManager;
@@ -55,8 +57,10 @@
return userService.login("dummy", properties.getAdminPassword(), token).getUserHash();
}
- protected void doLogout() throws DefaultException {
+ @After
+ public void doLogout() throws DefaultException {
userService.logout(getHash());
+ session.logout();
}
protected String getDefLicense() {
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -101,9 +101,11 @@
return null;
}
- public IntegrationTestHelper(final Object... tests) {
+ public IntegrationTestHelper(final boolean startPersistence, final Object... tests) {
final Injector injector = createInjector();
- injector.getInstance(KunePersistenceService.class).start();
+ if (startPersistence) {
+ injector.getInstance(KunePersistenceService.class).start();
+ }
for (final Object test : tests) {
injector.injectMembers(test);
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/StatsServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/StatsServiceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/StatsServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -52,7 +52,7 @@
@Transactional
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
@Test
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceAddTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -48,7 +48,7 @@
@Before
public void init() throws Exception {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
@Test(expected = UserMustBeLoggedException.class)
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceGetTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -57,7 +57,7 @@
@Before
public void create() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
@Test
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -34,7 +34,7 @@
@Before
public void init() throws Exception {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
defaultContent = getSiteDefaultContent();
doLogin();
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceVariousTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -254,7 +254,7 @@
@Before
public void init() throws Exception {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
doLogin();
defaultContent = getSiteDefaultContent();
groupShortName = defaultContent.getStateToken().getGroup();
Modified: trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/kuneservice/GroupServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -199,7 +199,7 @@
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -60,7 +60,7 @@
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
@Test
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 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/UserServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -140,7 +140,7 @@
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
lang = new I18nLanguageDTO();
lang.setCode("en");
simpleLang = new I18nLanguageSimpleDTO(lang.getCode(), lang.getEnglishName());
Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkMembersTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -52,7 +52,7 @@
@Transactional
@Before
public void init() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
group = groupFinder.findByShortName(getSiteAdminShortName());
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/integration/socialnet/SocialNetworkServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -36,40 +36,40 @@
import com.google.inject.Inject;
public class SocialNetworkServiceTest extends IntegrationTest {
- @Inject
- UserSession session;
- @Inject
- SocialNetService socialNetworkService;
+ private StateToken groupToken;
+ @Inject
+ UserSession session;
- private StateToken groupToken;
+ @Inject
+ SocialNetService socialNetworkService;
- @Before
- public void init() {
- new IntegrationTestHelper(this);
- groupToken = new StateToken(getDefSiteShortName());
- }
+ @Before
+ public void init() {
+ new IntegrationTestHelper(true, this);
+ groupToken = new StateToken(getDefSiteShortName());
+ }
- @Test
- public void testGetGroupMembersNotLogged() throws Exception {
- final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
- assertNotNull(sn.getGroupMembers());
- }
+ @Test
+ public void testGetGroupMembersNotLogged() throws Exception {
+ final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
+ assertNotNull(sn.getGroupMembers());
+ }
- @Test
- public void testGetParticipationNotLogged() throws Exception {
- final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
- assertNotNull(sn.getUserParticipation());
- }
+ @Test
+ public void testGetParticipationNotLogged() throws Exception {
+ final SocialNetworkDataDTO sn = socialNetworkService.getSocialNetwork(null, groupToken);
+ assertNotNull(sn.getUserParticipation());
+ }
- @Test(expected = UserMustBeLoggedException.class)
- public void testRequestJoinNoLogged() throws Exception {
- socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
- }
+ @Test(expected = UserMustBeLoggedException.class)
+ public void testRequestJoinNoLogged() throws Exception {
+ socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
+ }
- @Test(expected = AlreadyUserMemberException.class)
- public void testRequestJoinPersonalGroup() throws Exception {
- doLogin();
- socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
- }
+ @Test(expected = AlreadyUserMemberException.class)
+ public void testRequestJoinPersonalGroup() throws Exception {
+ doLogin();
+ socialNetworkService.requestJoinGroup(session.getHash(), groupToken);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/EntityLogoUploadManagerTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -37,45 +37,46 @@
public class EntityLogoUploadManagerTest extends ContentServiceIntegrationTest {
- private static final String TEST_FILE = "src/test/java/cc/kune/core/server/manager/file/orig.png";
- @Inject
- EntityLogoUploadManager manager;
+ private static final String TEST_FILE = "src/test/java/cc/kune/core/server/manager/file/orig.png";
+ @Inject
+ EntityLogoUploadManager manager;
- @Before
- public void create() {
- new IntegrationTestHelper(this);
- }
+ @Before
+ public void create() {
+ new IntegrationTestHelper(true, this);
+ }
- @Test
- public void testCreateLogo() throws Exception {
- manager.createUploadedFile(super.getSiteDefaultContent().getStateToken(), "image/png", new File(TEST_FILE));
- final StateContainerDTO defaultContent = super.getSiteDefaultContent();
- assertTrue(defaultContent.getGroup().hasLogo());
- }
+ @Test
+ public void testCreateLogo() throws Exception {
+ manager.createUploadedFile(super.getSiteDefaultContent().getStateToken(), "image/png", new File(
+ TEST_FILE));
+ final StateContainerDTO defaultContent = super.getSiteDefaultContent();
+ assertTrue(defaultContent.getGroup().hasLogo());
+ }
- @Ignore
- public void testErrorResponse() {
- // JSONObject expected =
- // JSONObject.fromObject("{\"success\":false,\"errors\":[{\"id\":\""
- // + EntityLogoView.LOGO_FORM_FIELD + "\",\"msg\":\"Some message\"}]}");
- // assertEquals(expected, manager.createJsonResponse(false,
- // "Some message"));
- }
+ @Ignore
+ public void testErrorResponse() {
+ // JSONObject expected =
+ // JSONObject.fromObject("{\"success\":false,\"errors\":[{\"id\":\""
+ // + EntityLogoView.LOGO_FORM_FIELD + "\",\"msg\":\"Some message\"}]}");
+ // assertEquals(expected, manager.createJsonResponse(false,
+ // "Some message"));
+ }
- @Test(expected = SessionExpiredException.class)
- public void testSessionExp() throws Exception {
- manager.createUploadedFile("otherhash", null, null, null, null);
- }
+ @Test(expected = SessionExpiredException.class)
+ public void testSessionExp() throws Exception {
+ manager.createUploadedFile("otherhash", null, null, null, null);
+ }
- @Ignore
- public void testSuccessResponse() {
- // JSONObject expected =
- // JSONObject.fromObject("{\"success\":true,\"errors\":[{}]}");
- // assertEquals(expected, manager.createJsonResponse(true, null));
- }
+ @Ignore
+ public void testSuccessResponse() {
+ // JSONObject expected =
+ // JSONObject.fromObject("{\"success\":true,\"errors\":[{}]}");
+ // assertEquals(expected, manager.createJsonResponse(true, null));
+ }
- @Test(expected = UserMustBeLoggedException.class)
- public void testUserMustBeAuth() throws Exception {
- manager.createUploadedFile(null, null, null, null, null);
- }
+ @Test(expected = UserMustBeLoggedException.class)
+ public void testUserMustBeAuth() throws Exception {
+ manager.createUploadedFile(null, null, null, null, null);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/FileDownloadManagerTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -33,8 +33,6 @@
import cc.kune.core.client.services.ImageSize;
import cc.kune.core.server.integration.IntegrationTestHelper;
-import cc.kune.core.server.manager.file.FileDownloadManager;
-import cc.kune.core.server.manager.file.FileUtils;
import cc.kune.core.server.properties.KuneProperties;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.domain.BasicMimeType;
@@ -44,161 +42,172 @@
public class FileDownloadManagerTest {
- private static final String SOMETITLE = "Sometitle";
+ private static final String SOMETITLE = "Sometitle";
- @Inject
- FileDownloadManager fileDownloadManager;
+ private Content content;
- @Inject
- KuneProperties kuneProperties;
+ @Inject
+ FileDownloadManager fileDownloadManager;
- private HttpServletResponse resp;
- private Content content;
+ private String filename;
+ private FileUtils fileUtils;
- private String uploadLocation;
+ @Inject
+ KuneProperties kuneProperties;
- private FileUtils fileUtils;
+ private HttpServletResponse resp;
- private StateToken stateToken;
+ private StateToken stateToken;
- private String filename;
+ private String uploadLocation;
- @Before
- public void create() throws IOException {
- new IntegrationTestHelper(this);
- content = Mockito.mock(Content.class);
- resp = Mockito.mock(HttpServletResponse.class);
- ServletOutputStream oStream = Mockito.mock(ServletOutputStream.class);
+ private void contentwhen(final BasicMimeType mimeType, final String filename, final String extension) {
+ Mockito.when(content.getMimeType()).thenReturn(mimeType);
+ Mockito.when(content.getFilename()).thenReturn(filename + extension);
+ }
- Mockito.when(resp.getOutputStream()).thenReturn(oStream);
- uploadLocation = kuneProperties.get(KuneProperties.UPLOAD_LOCATION);
+ @Before
+ public void create() throws IOException {
+ new IntegrationTestHelper(true, this);
+ content = Mockito.mock(Content.class);
+ resp = Mockito.mock(HttpServletResponse.class);
+ final ServletOutputStream oStream = Mockito.mock(ServletOutputStream.class);
- fileUtils = Mockito.mock(FileUtils.class);
- Mockito.when(fileUtils.exist(Mockito.anyString())).thenReturn(true);
- stateToken = new StateToken("test.test.1.1");
- filename = "somefile";
+ Mockito.when(resp.getOutputStream()).thenReturn(oStream);
+ uploadLocation = kuneProperties.get(KuneProperties.UPLOAD_LOCATION);
- Mockito.when(content.getTitle()).thenReturn(SOMETITLE);
- }
+ fileUtils = Mockito.mock(FileUtils.class);
+ Mockito.when(fileUtils.exist(Mockito.anyString())).thenReturn(true);
+ stateToken = new StateToken("test.test.1.1");
+ filename = "somefile";
- @Ignore
- public void fileWithNoExtensionDownloadTest() throws Exception {
- throw new Exception("TODO");
- }
+ Mockito.when(content.getTitle()).thenReturn(SOMETITLE);
+ }
- @Test
- public void testJpgThumbDownload() throws IOException {
- String extension = ".jpg";
- contentwhen(new BasicMimeType("image", "jpg"), filename, extension);
- String subExt = ImageSize.thumb.toString();
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension, absFile);
- Mockito.verify(resp).setContentType("image/jpg");
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Ignore
+ public void fileWithNoExtensionDownloadTest() throws Exception {
+ throw new Exception("TODO");
+ }
- @Test
- public void testPdfDownload1() throws IOException {
- String extension = ".pdf";
- contentwhen(new BasicMimeType("application", "pdf"), filename, extension);
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", ImageSize.ico.toString(), resp,
- fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
- Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testJpgThumbDownload() throws IOException {
+ final String extension = ".jpg";
+ contentwhen(new BasicMimeType("image", "jpg"), filename, extension);
+ final String subExt = ImageSize.thumb.toString();
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension,
+ absFile);
+ Mockito.verify(resp).setContentType("image/jpg");
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPdfDownload2() throws IOException {
- String pngExtension = ".png";
- contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
- String subExt = ImageSize.ico.toString();
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
- Mockito.verify(resp).setContentType("image/png");
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPdfDownload1() throws IOException {
+ final String extension = ".pdf";
+ contentwhen(new BasicMimeType("application", "pdf"), filename, extension);
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "true",
+ ImageSize.ico.toString(), resp, fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
+ Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPdfDownload3() throws IOException {
- String pngExtension = ".png";
- contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
- String subExt = ImageSize.sized.toString();
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
- Mockito.verify(resp).setContentType("image/png");
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPdfDownload2() throws IOException {
+ final String pngExtension = ".png";
+ contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
+ final String subExt = ImageSize.ico.toString();
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension,
+ absFile);
+ Mockito.verify(resp).setContentType("image/png");
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPdfDownload4() throws IOException {
- String pngExtension = ".png";
- contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
- String subExt = ImageSize.thumb.toString();
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension, absFile);
- Mockito.verify(resp).setContentType("image/png");
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPdfDownload3() throws IOException {
+ final String pngExtension = ".png";
+ contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
+ final String subExt = ImageSize.sized.toString();
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension,
+ absFile);
+ Mockito.verify(resp).setContentType("image/png");
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPdfDownloadNullMime() throws IOException {
- String extension = ".pdf";
- contentwhen(null, filename, extension);
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", ImageSize.ico.toString(), resp,
- fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
- Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPdfDownload4() throws IOException {
+ final String pngExtension = ".png";
+ contentwhen(new BasicMimeType("application", "pdf"), filename, ".pdf");
+ final String subExt = ImageSize.thumb.toString();
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + pngExtension,
+ absFile);
+ Mockito.verify(resp).setContentType("image/png");
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + pngExtension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPngDownload1() throws IOException {
- String extension = ".png";
- contentwhen(new BasicMimeType("image", "png"), filename, extension);
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", null, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
- Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPdfDownloadNullMime() throws IOException {
+ final String extension = ".pdf";
+ contentwhen(null, filename, extension);
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "true",
+ ImageSize.ico.toString(), resp, fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
+ Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- @Test
- public void testPngDownload2() throws IOException {
- String extension = ".png";
- contentwhen(new BasicMimeType("image", "png"), filename, extension);
- String subExt = ImageSize.thumb.toString();
- String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp, fileUtils);
- assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension, absFile);
- Mockito.verify(resp).setContentType("image/png");
- Mockito.verify(resp).setHeader(
- FileDownloadManager.RESP_HEADER_CONTEND_DISP,
- FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
- + FileDownloadManager.RESP_HEADER_END);
- }
+ @Test
+ public void testPngDownload1() throws IOException {
+ final String extension = ".png";
+ contentwhen(new BasicMimeType("image", "png"), filename, extension);
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "true", null, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + extension, absFile);
+ Mockito.verify(resp).setContentType(FileDownloadManager.APPLICATION_X_DOWNLOAD);
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
- private void contentwhen(BasicMimeType mimeType, String filename, String extension) {
- Mockito.when(content.getMimeType()).thenReturn(mimeType);
- Mockito.when(content.getFilename()).thenReturn(filename + extension);
- }
+ @Test
+ public void testPngDownload2() throws IOException {
+ final String extension = ".png";
+ contentwhen(new BasicMimeType("image", "png"), filename, extension);
+ final String subExt = ImageSize.thumb.toString();
+ final String absFile = fileDownloadManager.buildResponse(content, stateToken, "false", subExt, resp,
+ fileUtils);
+ assertEquals(uploadLocation + FileUtils.toDir(stateToken) + filename + "." + subExt + extension,
+ absFile);
+ Mockito.verify(resp).setContentType("image/png");
+ Mockito.verify(resp).setHeader(
+ FileDownloadManager.RESP_HEADER_CONTEND_DISP,
+ FileDownloadManager.RESP_HEADER_ATTACHMENT_FILENAME + SOMETITLE + extension
+ + FileDownloadManager.RESP_HEADER_END);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/FileManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/FileManagerTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/FileManagerTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -29,55 +29,57 @@
import org.junit.Before;
import org.junit.Test;
-import cc.kune.core.server.TestHelper;
+import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.server.manager.FileManager;
-import cc.kune.core.server.manager.file.FileUtils;
import com.google.inject.Inject;
public class FileManagerTest {
- @Inject
- FileManager fileManager;
- private String tempDir;
+ @Inject
+ FileManager fileManager;
+ private String tempDir;
- @Before
- public void inject() throws IOException {
- TestHelper.inject(this);
- tempDir = File.createTempFile("temp", "txt").getParent();
- }
+ @Before
+ public void inject() throws IOException {
+ new IntegrationTestHelper(false, this);
+ // TestHelper.inject(this);
+ tempDir = File.createTempFile("temp", "txt").getParent();
+ }
- @Test
- public void test3FileCreationWithSeq() throws IOException {
- final File tempFile = File.createTempFile("some file name", ".txt");
- final File newFile1 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
- final File newFile2 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
- final File newFile3 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
- assertEquals(tempDir + File.separator + seq(seq(seq(tempFile.getName()))), newFile3.getAbsolutePath());
- newFile1.delete();
- newFile2.delete();
- newFile3.delete();
- }
+ private String seq(final String file) {
+ return FileUtils.getNextSequentialFileName(file, true);
+ }
- @Test
- public void testDirCreation() throws IOException {
- final String newTestDir = tempDir + File.separator + "test1" + File.separator + "test2" + File.separator;
- assertTrue(fileManager.mkdir(newTestDir));
- final File dir = new File(newTestDir);
- assertTrue(dir.exists());
- fileManager.rmdir(newTestDir);
- assertFalse(dir.exists());
- }
+ @Test
+ public void test3FileCreationWithSeq() throws IOException {
+ final File tempFile = File.createTempFile("some file name", ".txt");
+ final File newFile1 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
+ final File newFile2 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
+ final File newFile3 = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
+ assertEquals(tempDir + File.separator + seq(seq(seq(tempFile.getName()))),
+ newFile3.getAbsolutePath());
+ newFile1.delete();
+ newFile2.delete();
+ newFile3.delete();
+ }
- @Test
- public void testFileCreationWithSeq() throws IOException {
- final File tempFile = File.createTempFile("some file name", ".txt");
- final File newFile = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
- assertEquals(tempDir + File.separator + seq(tempFile.getName()), newFile.getAbsolutePath());
- newFile.delete();
- }
+ @Test
+ public void testDirCreation() throws IOException {
+ final String newTestDir = tempDir + File.separator + "test1" + File.separator + "test2"
+ + File.separator;
+ assertTrue(fileManager.mkdir(newTestDir));
+ final File dir = new File(newTestDir);
+ assertTrue(dir.exists());
+ fileManager.rmdir(newTestDir);
+ assertFalse(dir.exists());
+ }
- private String seq(final String file) {
- return FileUtils.getNextSequentialFileName(file, true);
- }
+ @Test
+ public void testFileCreationWithSeq() throws IOException {
+ final File tempFile = File.createTempFile("some file name", ".txt");
+ final File newFile = fileManager.createFileWithSequentialName(tempDir, tempFile.getName());
+ assertEquals(tempDir + File.separator + seq(tempFile.getName()), newFile.getAbsolutePath());
+ newFile.delete();
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/manager/file/FileUploadManagerTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -26,27 +26,26 @@
import cc.kune.core.client.errors.UserMustBeLoggedException;
import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.server.integration.content.ContentServiceIntegrationTest;
-import cc.kune.core.server.manager.file.FileUploadManager;
import com.google.inject.Inject;
public class FileUploadManagerTest extends ContentServiceIntegrationTest {
- @Inject
- FileUploadManager fileUploadManager;
+ @Inject
+ FileUploadManager fileUploadManager;
- @Before
- public void create() {
- new IntegrationTestHelper(this);
- }
+ @Before
+ public void create() {
+ new IntegrationTestHelper(false, this);
+ }
- @Test(expected = SessionExpiredException.class)
- public void testSessionExp() throws Exception {
- fileUploadManager.createUploadedFile("otherhash", null, null, null, null);
- }
+ @Test(expected = SessionExpiredException.class)
+ public void testSessionExp() throws Exception {
+ fileUploadManager.createUploadedFile("otherhash", null, null, null, null);
+ }
- @Test(expected = UserMustBeLoggedException.class)
- public void testUserMustBeAuth() throws Exception {
- fileUploadManager.createUploadedFile(null, null, null, null, null);
- }
+ @Test(expected = UserMustBeLoggedException.class)
+ public void testUserMustBeAuth() throws Exception {
+ fileUploadManager.createUploadedFile(null, null, null, null, null);
+ }
}
Modified: trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/core/server/mapper/MapperTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -37,7 +37,7 @@
import cc.kune.core.server.InitData;
import cc.kune.core.server.TestDomainHelper;
-import cc.kune.core.server.TestHelper;
+import cc.kune.core.server.integration.IntegrationTestHelper;
import cc.kune.core.server.manager.GroupManager;
import cc.kune.core.server.state.StateContent;
import cc.kune.core.server.state.StateEventContainer;
@@ -179,7 +179,7 @@
@Before
public void inject() {
- TestHelper.inject(this);
+ new IntegrationTestHelper(false, this);
}
@Test
Modified: trunk/src/test/java/cc/kune/events/server/utils/BasicCalendarTest.java
===================================================================
--- trunk/src/test/java/cc/kune/events/server/utils/BasicCalendarTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/events/server/utils/BasicCalendarTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -26,24 +26,22 @@
import net.fortuna.ical4j.model.property.Version;
import net.fortuna.ical4j.util.Dates;
-import com.bradrydzewski.gwt.calendar.client.Appointment;
-
public class BasicCalendarTest {
protected static final String DESCRIPTION = "some description";
protected static final String ID = "some id";
protected static final String TITLE = "some title";
- protected Appointment createAppointment(final boolean allDay) {
- final Appointment initialApp = new Appointment();
- initialApp.setTitle(TITLE);
- initialApp.setDescription(DESCRIPTION);
- initialApp.setStart(getNow());
- initialApp.setEnd(getNow());
- initialApp.setId(ID);
- initialApp.setAllDay(allDay);
- return initialApp;
- }
+ // protected Appointment createAppointment(final boolean allDay) {
+ // final Appointment initialApp = new Appointment();
+ // initialApp.setTitle(TITLE);
+ // initialApp.setDescription(DESCRIPTION);
+ // initialApp.setStart(getNow());
+ // initialApp.setEnd(getNow());
+ // initialApp.setId(ID);
+ // initialApp.setAllDay(allDay);
+ // return initialApp;
+ // }
protected Calendar createCal() {
final Calendar calendar = new Calendar();
Modified: trunk/src/test/java/cc/kune/events/server/utils/EventsServerConversionUtilTest.java
===================================================================
--- trunk/src/test/java/cc/kune/events/server/utils/EventsServerConversionUtilTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/events/server/utils/EventsServerConversionUtilTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -19,107 +19,99 @@
*/
package cc.kune.events.server.utils;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Date;
-import java.util.Map;
-
-import net.fortuna.ical4j.data.CalendarOutputter;
-import net.fortuna.ical4j.model.Calendar;
-import net.fortuna.ical4j.model.DateTime;
-import net.fortuna.ical4j.model.ValidationException;
-import net.fortuna.ical4j.model.component.VEvent;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.bradrydzewski.gwt.calendar.client.Appointment;
-
public class EventsServerConversionUtilTest extends BasicCalendarTest {
protected static final String DESCRIPTION = "some description";
protected static final String ID = "some id";
protected static final String TITLE = "some title";
- @SuppressWarnings("deprecation")
- private void checkConversionFromAndTo(final Appointment initialApp, final boolean allDay)
- throws IOException, ValidationException {
- final VEvent vevent = EventsServerConversionUtil.toVEvent(initialApp);
- assertEquals(initialApp.getDescription(), vevent.getDescription().getValue());
- assertEquals(initialApp.getTitle(), vevent.getSummary().getValue());
- if (allDay) {
- final Date start = initialApp.getStart();
- start.setHours(0);
- start.setMinutes(0);
- start.setSeconds(0);
- assertEquals(start, new Date(vevent.getStartDate().getDate().getTime()));
- assertEquals(initialApp.getEnd(), vevent.getEndDate().getDate());
- } else {
- assertEquals(initialApp.getStart().getTime(), vevent.getStartDate().getDate().getTime());
- assertEquals(initialApp.getEnd().getTime(), vevent.getEndDate().getDate().getTime());
- }
- assertEquals(allDay, initialApp.isAllDay());
- assertEquals(allDay, !(vevent.getStartDate().getDate() instanceof DateTime));
- assertEquals(initialApp.getId(), vevent.getUid().getValue());
- final Calendar cal = createCal();
- cal.getComponents().add(vevent);
+ // @SuppressWarnings("deprecation")
+ // private void checkConversionFromAndTo(final Appointment initialApp, final
+ // boolean allDay)
+ // throws IOException, ValidationException {
+ // final VEvent vevent = EventsServerConversionUtil.toVEvent(initialApp);
+ // assertEquals(initialApp.getDescription(),
+ // vevent.getDescription().getValue());
+ // assertEquals(initialApp.getTitle(), vevent.getSummary().getValue());
+ // if (allDay) {
+ // final Date start = initialApp.getStart();
+ // start.setHours(0);
+ // start.setMinutes(0);
+ // start.setSeconds(0);
+ // assertEquals(start, new Date(vevent.getStartDate().getDate().getTime()));
+ // assertEquals(initialApp.getEnd(), vevent.getEndDate().getDate());
+ // } else {
+ // assertEquals(initialApp.getStart().getTime(),
+ // vevent.getStartDate().getDate().getTime());
+ // assertEquals(initialApp.getEnd().getTime(),
+ // vevent.getEndDate().getDate().getTime());
+ // }
+ // assertEquals(allDay, initialApp.isAllDay());
+ // assertEquals(allDay, !(vevent.getStartDate().getDate() instanceof
+ // DateTime));
+ // assertEquals(initialApp.getId(), vevent.getUid().getValue());
+ // final Calendar cal = createCal();
+ // cal.getComponents().add(vevent);
+ //
+ // final OutputStream out = System.out;
+ // final CalendarOutputter outputter = new CalendarOutputter();
+ // outputter.output(cal, out);
- final OutputStream out = System.out;
- final CalendarOutputter outputter = new CalendarOutputter();
- outputter.output(cal, out);
+ // Not using this in server side
+ // final Appointment reconvertedApp = EventsServerConversionUtil.to(vevent);
+ // assertEquals(initialApp.getTitle(), reconvertedApp.getTitle());
+ // assertEquals(initialApp.getDescription(),
+ // reconvertedApp.getDescription());
+ // assertEquals(initialApp.getId(), reconvertedApp.getId());
+ // assertEquals(allDay, reconvertedApp.isAllDay());
+ // assertEquals(initialApp.getStart().getTime(),
+ // reconvertedApp.getStart().getTime());
+ // assertEquals(initialApp.getEnd().getTime(),
+ // reconvertedApp.getEnd().getTime());
+ // assertTrue(initialApp.compareTo(reconvertedApp) == 0);
+ // }
- final Appointment reconvertedApp = EventsServerConversionUtil.to(vevent);
- assertEquals(initialApp.getTitle(), reconvertedApp.getTitle());
- assertEquals(initialApp.getDescription(), reconvertedApp.getDescription());
- assertEquals(initialApp.getId(), reconvertedApp.getId());
- assertEquals(allDay, reconvertedApp.isAllDay());
- assertEquals(initialApp.getStart().getTime(), reconvertedApp.getStart().getTime());
- assertEquals(initialApp.getEnd().getTime(), reconvertedApp.getEnd().getTime());
- assertTrue(initialApp.compareTo(reconvertedApp) == 0);
- }
+ // private void convertAndTest(final Appointment app, final boolean allDay)
+ // throws Exception {
+ // final Map<String, String> map = EventsServerConversionUtil.toMap(app);
+ // final Appointment appReConverted = EventsServerConversionUtil.toApp(map);
+ // assertEquals(app.getStart(), appReConverted.getStart());
+ // assertEquals(app.getEnd(), appReConverted.getEnd());
+ // assertEquals(app.isAllDay(), appReConverted.isAllDay());
+ // assertEquals(allDay, appReConverted.isAllDay());
+ // assertEquals(app.getDescription(), appReConverted.getDescription());
+ // assertEquals(app.getTitle(), appReConverted.getTitle());
+ // assertEquals(app.getLocation(), appReConverted.getLocation());
+ // assertEquals(app.getCreatedBy(), appReConverted.getCreatedBy());
+ // assertEquals(app.getId(), appReConverted.getId());
+ // }
+ //
+ // @Test
+ // public void testAllDay() throws Exception {
+ // final Appointment app = createAppointment(true);
+ // convertAndTest(app, true);
+ // }
+ //
+ // @Test
+ // public void testFromToFrom() throws IOException, ValidationException {
+ // final boolean allDay = false;
+ // final Appointment initialApp = createAppointment(allDay);
+ // initialApp.setAllDay(allDay);
+ // checkConversionFromAndTo(initialApp, allDay);
+ // }
+ //
+ // @Ignore
+ // @Test
+ // public void testFromToFromAllDay() throws IOException, ValidationException
+ // {
+ // final boolean allDay = true;
+ // final Appointment initialApp = createAppointment(allDay);
+ // checkConversionFromAndTo(initialApp, allDay);
+ // }
+ //
+ // @Test
+ // public void testToMap() throws Exception {
+ // final Appointment app = createAppointment(false);
+ // convertAndTest(app, false);
+ // }
- private void convertAndTest(final Appointment app, final boolean allDay) throws Exception {
- final Map<String, String> map = EventsServerConversionUtil.toMap(app);
- final Appointment appReConverted = EventsServerConversionUtil.toApp(map);
- assertEquals(app.getStart(), appReConverted.getStart());
- assertEquals(app.getEnd(), appReConverted.getEnd());
- assertEquals(app.isAllDay(), appReConverted.isAllDay());
- assertEquals(allDay, appReConverted.isAllDay());
- assertEquals(app.getDescription(), appReConverted.getDescription());
- assertEquals(app.getTitle(), appReConverted.getTitle());
- assertEquals(app.getLocation(), appReConverted.getLocation());
- assertEquals(app.getCreatedBy(), appReConverted.getCreatedBy());
- assertEquals(app.getId(), appReConverted.getId());
- }
-
- @Test
- public void testAllDay() throws Exception {
- final Appointment app = createAppointment(true);
- convertAndTest(app, true);
- }
-
- @Test
- public void testFromToFrom() throws IOException, ValidationException {
- final boolean allDay = false;
- final Appointment initialApp = createAppointment(allDay);
- initialApp.setAllDay(allDay);
- checkConversionFromAndTo(initialApp, allDay);
- }
-
- @Ignore
- @Test
- public void testFromToFromAllDay() throws IOException, ValidationException {
- final boolean allDay = true;
- final Appointment initialApp = createAppointment(allDay);
- checkConversionFromAndTo(initialApp, allDay);
- }
-
- @Test
- public void testToMap() throws Exception {
- final Appointment app = createAppointment(false);
- convertAndTest(app, false);
- }
-
}
Modified: trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java
===================================================================
--- trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/lists/server/ListsServiceTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -56,7 +56,7 @@
@Before
public void init() throws DefaultException, IOException {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
final UserInfoDTO userInfoDTO = doLogin();
userGroup = userInfoDTO.getUserGroup();
final StateAbstractDTO rootList = contentService.getContent(getHash(), new StateToken(
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -235,7 +235,7 @@
@Before
public void before() {
- new IntegrationTestHelper(this);
+ new IntegrationTestHelper(true, this);
}
private void createTestWave(final SimpleArgCallback<WaveRef> callback) {
Modified: trunk/src/test/java/testsuites/IntegrationTestSuite.java
===================================================================
--- trunk/src/test/java/testsuites/IntegrationTestSuite.java 2012-04-01 13:47:28 UTC (rev 1817)
+++ trunk/src/test/java/testsuites/IntegrationTestSuite.java 2012-04-02 03:10:57 UTC (rev 1818)
@@ -27,18 +27,20 @@
* Rescan with :
*
* <pre>
- * find src/test/java/org/ourproject/kune/platf/integration/ -name '*.java' -exec basename \{} .java \;| paste -s - - | sed 's/ /.class, /g'
+ * find src/test/java/cc/kune/core/server/integration/ -name '*.java' -exec basename \{} .java \;| paste -s - - | sed 's/ /.class, /g'
* </pre>
*
*/
@RunWith(Suite.class)
@SuiteClasses({
-// UserServiceTest.class, SiteServiceTest.class, SocialNetworkServiceTest.class,
-// SocialNetworkMembersTest.class, DatabaseInitializationTest.class,
+// UserServiceTest.class, InitDataTest.class, GroupServiceTest.class,
+// StatsServiceTest.class, SocialNetworkMembersTest.class,
+// SocialNetworkServiceTest.class,
+// DatabaseInitializerTest.class, ContentServiceVariousTest.class,
+// ContentServiceSaveTest.class,
+// ContentServiceIntegrationTest.class, ContentServiceGetTest.class,
// ContentServiceAddTest.class,
-// ContentCommentServiceTest.class, ContentServiceVariousTest.class,
-// ContentServiceGetTest.class,
-// ContentServiceSaveTest.class, GroupServiceTest.class
+// IntegrationTest.class
})
public class IntegrationTestSuite {
}
More information about the kune-commits
mailing list