Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- 3196 discussions
r3626 - in trunk/pollen-ui-struts2/src: main/java/org/chorem/pollen/ui/actions/poll/vote main/resources/i18n main/webapp/WEB-INF/jsp/poll main/webapp/css test/resources/its/pollVoteVisibility test/resources/its/pollVoteVisibility/db test/resources/its/pollVoteVisibility/feeds
by tchemit@users.chorem.org 24 Aug '12
by tchemit@users.chorem.org 24 Aug '12
24 Aug '12
Author: tchemit
Date: 2012-08-24 17:46:34 +0200 (Fri, 24 Aug 2012)
New Revision: 3626
Url: http://chorem.org/repositories/revision/pollen/3626
Log:
refs #742: Option to allow all users to show voting of others users (all tests are ok) + fix some vote page stuff
Added:
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/075ab18c50c74f83b894c042bba84ff5.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/2262a31f374e4969bb3593e762c0cae6.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/3300e59939bd4c9797e360060b8e54be.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/4cd79d032aa7433d9944ec9376c385c0.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/7103c6d4a79246699425e99e1f344b98.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/8518ede7bf1247d2ba0dfe222575c5ba.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/a04bd349d8964c4fad48ac6ececc60a0.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/b321ddccf7d743bf9c67b2664231d14f.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/e61a350a1d714e479aad526ee85b7bc6.xml
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
trunk/pollen-ui-struts2/src/main/webapp/css/vote.css
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/pollendb.h2.db
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java 2012-08-24 15:46:34 UTC (rev 3626)
@@ -180,6 +180,18 @@
return result;
}
+ public String getPollVoteVisibilityName() {
+ PollVoteVisibility strategy = getPoll().getPollVoteVisibility();
+ String result = _(strategy.getI18nKey());
+ return result;
+ }
+
+ public String getPollVoteVisibilityHelp() {
+ PollVoteVisibility strategy = getPoll().getPollVoteVisibility();
+ String result = _(strategy.getI18nHelpKey());
+ return result;
+ }
+
/**
* Is comment can be displayed (and then added) on this poll.
*
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-24 15:46:34 UTC (rev 3626)
@@ -31,12 +31,13 @@
import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
-import org.chorem.pollen.business.persistence.PollVoteVisibility;
import org.chorem.pollen.business.persistence.Vote;
import org.chorem.pollen.business.persistence.VoteToChoice;
import org.chorem.pollen.services.impl.VoteService;
import org.chorem.pollen.votecounting.strategy.VoteCountingStrategy;
+import static org.nuiton.i18n.I18n.n_;
+
/**
* Votes to a poll.
*
@@ -87,37 +88,6 @@
}
}
- if (isVoteAllowed()) {
-
- PollVoteVisibility voteVisibility = poll.getPollVoteVisibility();
- switch (voteVisibility) {
-
- case NOBODY:
- // anonymous poll (nobody can see votes)
- addFlashWarning(_("pollen.information.voteNotVisible.anonymousPoll"));
- break;
- case CREATOR_ONLY:
- if (!securityContext.isAdmin()) {
-
- // only creator can see votes
- addFlashWarning(_("pollen.information.voteNotVisible.onlyCreator"));
- }
- break;
- case PARTICIPANT_ONLY:
- if (!securityContext.isVoter() || securityContext.isRestrictedVoter()) {
-
- // only participant can see votes
- addFlashWarning(_("pollen.information.voteNotVisible.onlyParticipant"));
- }
- break;
- case EVERYBODY:
- // free to everybody
- break;
- }
- } else {
-
-
- }
if (isPollChoiceRunning()) {
addFlashMessage(_("pollen.information.pollChoiceRunning"));
}
@@ -224,31 +194,31 @@
VoteService voteService = getVoteService();
- Vote newVote;
- if (StringUtils.isBlank(vote.getTopiaId())) {
+ boolean newVote = StringUtils.isBlank(vote.getTopiaId());
+ Vote savedVote;
+ if (newVote) {
+
// create a new vote
- newVote = voteService.createVote(poll, vote);
+ savedVote = voteService.createVote(poll, vote);
} else {
// update existing vote
- newVote = voteService.updateVote(poll, vote);
+ savedVote = voteService.updateVote(poll, vote);
}
- //TODO tchemit-2012-05-18 Why clean messages and just messages here ?
clearFlashMessages();
- // For free Poll, display the update Url (useless if user is logged or
- // not using a modify url)
- if (poll.isPollFree() &&
- (!isUserLoggued() || vote.isAnonymous()) &&
- StringUtils.isBlank(getUserSecurityContext().getAccountId())) {
+ if (StringUtils.isBlank(getUserSecurityContext().getAccountId())) {
+ // no accountId in url, always propose it (for connected
+ // user to be able to bookmark their votes)
+
String pollId = poll.getPollId();
- String accountId = newVote.getPollAccount().getAccountId();
+ String accountId = savedVote.getPollAccount().getAccountId();
PollUrl updateUrl = getPollUrlService().getPollVoteUrl(
- poll, newVote.getPollAccount());
+ poll, savedVote.getPollAccount());
if (log.isDebugEnabled()) {
log.debug(String.format(
@@ -256,13 +226,24 @@
pollId, accountId, updateUrl));
}
- addFlashMessage(
- _("pollen.information.vote.createdWithUpdateUrl", updateUrl));
+ String message;
+ boolean connected = getUserSecurityContext().isConnected();
+
+ if (connected) {
+ message = n_("pollen.information.vote.createdWithUpdateUrl.notConnected");
+ } else {
+ message = n_("pollen.information.vote.createdWithUpdateUrl");
+ }
+
+ addFlashMessage(_(message, updateUrl));
+
} else {
+ // there is a aacountId in url, just inform vote is saved
addFlashMessage(_("pollen.information.vote.created"));
}
+
return SUCCESS;
}
}
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-08-24 15:46:34 UTC (rev 3626)
@@ -142,6 +142,7 @@
pollen.common.pollOption.reminderHourCountdown=Hours before end
pollen.common.pollType=Who can vote ?
pollen.common.pollType.help=Free\: accessible to everyone <br/><br/> Restricted\: accessible only to a list of persons <br/><br/> Group\: accessible to several lists of persons
+pollen.common.pollVoteVisibility=Vote visibility
pollen.common.postDate=Comment date
pollen.common.resultAction=Count
pollen.common.results=Results\:
@@ -302,6 +303,7 @@
pollen.information.user.updated=User '<strong>%s</strong>' updated.
pollen.information.vote.created=Vote saved
pollen.information.vote.createdWithUpdateUrl=Vote saved, you can modify it using this address\: <br/> <a href\="%1$s">%1$s</a>
+pollen.information.vote.createdWithUpdateUrl.notConnected=Vote saved, you can modify it using this address when you are not connected\: <br/> <a href\="%1$s">%1$s</a>
pollen.information.vote.creatorUser=You are identified as the poll's creator. You can't vote with this URL.
pollen.information.vote.deleted=Vote deleted.
pollen.information.voteNotVisible.anonymousPoll=Votes are not visible\: Anonymous poll
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-08-24 15:46:34 UTC (rev 3626)
@@ -142,6 +142,7 @@
pollen.common.pollOption.reminderHourCountdown=heures avant la fin du sondage
pollen.common.pollType=Qui peut voter ?
pollen.common.pollType.help=Libre \: accessible à tout le monde <br/><br/> Restreint \: accessible uniquement à une liste de votants <br/><br/> Groupe \: accessible à plusieurs listes de votants
+pollen.common.pollVoteVisibility=Visibilité des votes
pollen.common.postDate=Date du commentaire
pollen.common.resultAction=Dépouillement
pollen.common.results=Résultats \:
@@ -303,6 +304,7 @@
pollen.information.user.updated=Utilisateur '<strong>%s</strong>' a été mis à jour.
pollen.information.vote.created=Vote enregistré
pollen.information.vote.createdWithUpdateUrl=Vote enregistré, vous pourrez le modifier à l'adresse suivante \: <br/> <a href\="%1$s">%1$s</a>
+pollen.information.vote.createdWithUpdateUrl.notConnected=Vote enregistré, vous pourrez le modifier à l'adresse suivante (lorsque vous n'êtes pas connecté) \: <br/> <a href\="%1$s">%1$s</a>
pollen.information.vote.creatorUser=Vous êtes identifié comme le créateur du sondage. Vous ne pouvez pas voter avec cette URL.
pollen.information.vote.deleted=Vote supprimé.
pollen.information.voteNotVisible.anonymousPoll=Votes non visibles \: Sondage anonyme
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-08-24 15:46:34 UTC (rev 3626)
@@ -148,6 +148,10 @@
key='pollen.common.voteCountingType'
tooltip="%{voteCountingTypeHelp}"
tooltipIconPath="/img/tooltip.png"/>
+ <s:label value="%{pollVoteVisibilityName}"
+ key='pollen.common.pollVoteVisibility'
+ tooltip="%{pollVoteVisibilityHelp}"
+ tooltipIconPath="/img/tooltip.png"/>
</fieldset>
</div>
Modified: trunk/pollen-ui-struts2/src/main/webapp/css/vote.css
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/css/vote.css 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/main/webapp/css/vote.css 2012-08-24 15:46:34 UTC (rev 3626)
@@ -32,7 +32,7 @@
}
#pollTop fieldset {
- width: 350px;
+ width: 400px;
border: 1px solid #aab;
padding: 15px;
padding-bottom: 10px;
Modified: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt 2012-08-23 23:05:40 UTC (rev 3625)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt 2012-08-24 15:46:34 UTC (rev 3626)
@@ -1,8 +1,8 @@
-================
-PollVoteVibility
-================
+==================
+PollVoteVisibility
+==================
-Pour tester la portée des votes (http://chorem.org/issues/742)
+Pour tester la portée des votes (http://chorem.org/issues/742)
anonymous free poll
-------------------
@@ -10,28 +10,141 @@
by not connected user
~~~~~~~~~~~~~~~~~~~~~
-admin cacb52f4d49047b7a7aa24ec528fcc87:e814ba6e25174d5983ad796c400520f5 (peut voter)
-vote anonyme cacb52f4d49047b7a7aa24ec528fcc87:56acbf87f3c049c2adc757ef1da88ee1 (a,b)
-vote creator (interdit)
-vote user cacb52f4d49047b7a7aa24ec528fcc87:c54a12ffde5d44a4ad9e609aa644fc80 (a) (sondage non present dans sondages participes)
-vote admin cacb52f4d49047b7a7aa24ec528fcc87:15500943e49842c88d6ceeefaa62e2ed (b) (sondage non present dans sondages participes)
+admin cacb52f4d49047b7a7aa24ec528fcc87:e814ba6e25174d5983ad796c400520f5 (peut voter)
+vote anonyme cacb52f4d49047b7a7aa24ec528fcc87:56acbf87f3c049c2adc757ef1da88ee1 (a,b) (votes non visibles)
+vote creator (interdit, votes non visibles)
+vote moderate (votes non visibles)
+vote user cacb52f4d49047b7a7aa24ec528fcc87:c54a12ffde5d44a4ad9e609aa644fc80 (a) (votes non visibles) (sondage non present dans sondages participes)
+vote admin cacb52f4d49047b7a7aa24ec528fcc87:15500943e49842c88d6ceeefaa62e2ed (b) (votes non visibles) (sondage non present dans sondages participes)
by connected user
~~~~~~~~~~~~~~~~~
-admin fdd43f4c8d614a9aa48047804583508a:9a8e8523f1ba404f8fde45d1844c59ac (peut voter)
-vote anonyme fdd43f4c8d614a9aa48047804583508a:07dc154dce514d368441eaa9f27d21e0 (a,b)
-vote creator (interdit connecté ou pas)
-vote user fdd43f4c8d614a9aa48047804583508a:e67a14d729c7440ebe4a55d589cba515 (a) (sondage non present dans sondages participes)
-vote admin fdd43f4c8d614a9aa48047804583508a:29993520034a41168def96f908d2696b (b) (sondage non present dans sondages participes)
+admin fdd43f4c8d614a9aa48047804583508a:9a8e8523f1ba404f8fde45d1844c59ac (peut voter)
+vote anonyme fdd43f4c8d614a9aa48047804583508a:07dc154dce514d368441eaa9f27d21e0 (a,b) (votes non visibles)
+vote creator (interdit connecté ou pas, votes non visibles)
+vote moderate (votes non visibles)
+vote user fdd43f4c8d614a9aa48047804583508a:e67a14d729c7440ebe4a55d589cba515 (a) (votes non visibles) (sondage non present dans sondages participes)
+vote admin fdd43f4c8d614a9aa48047804583508a:29993520034a41168def96f908d2696b (b) (votes non visibles) (sondage non present dans sondages participes)
sondage crées (sondage present, peut voter)
by admin user
~~~~~~~~~~~~~
-admin 87cb5b1529374ac0b8c6b7f0b98e169c:65a3caf0bf204226bfcd259c69e56ca8 (peut voter)
-vote anonyme 87cb5b1529374ac0b8c6b7f0b98e169c:a0ff6892a28b4a65809b16cd8903245e (a,b)
-vote creator (interdit connecté ou pas)
-vote user 87cb5b1529374ac0b8c6b7f0b98e169c:fd47e01378354fcaa220a4ffd0974417 (a) (sondage non present dans sondages participes)
-vote admin 87cb5b1529374ac0b8c6b7f0b98e169c:010f05042ff3485c834d1ecdc4d17f1e (b) (sondage non present dans sondages participes)
+admin 87cb5b1529374ac0b8c6b7f0b98e169c:65a3caf0bf204226bfcd259c69e56ca8 (peut voter)
+vote anonyme 87cb5b1529374ac0b8c6b7f0b98e169c:a0ff6892a28b4a65809b16cd8903245e (a,b)
+vote creator (interdit connecté ou pas, votes non visibles)
+vote moderate (votes non visibles)
+vote user 87cb5b1529374ac0b8c6b7f0b98e169c:fd47e01378354fcaa220a4ffd0974417 (a) (votes non visibles) (sondage non present dans sondages participes)
+vote admin 87cb5b1529374ac0b8c6b7f0b98e169c:010f05042ff3485c834d1ecdc4d17f1e (b) (votes non visibles) (sondage non present dans sondages participes)
sondage crées (sondage present, peut voter)
+
+onlyCreator free poll
+---------------------
+
+by not connected user
+~~~~~~~~~~~~~~~~~~~~~
+
+admin e61a350a1d714e479aad526ee85b7bc6:8517bd2f6b414072b3d9d6c4cb7e5fd0 (peut voter)
+vote anonyme e61a350a1d714e479aad526ee85b7bc6:e8fd28021faa434aa466c5f6bdbc6e94 (a,b) (votes non visibles)
+vote creator (vote interdit, votes visibles)
+vote moderate (vote interdit, votes visibles)
+vote user e61a350a1d714e479aad526ee85b7bc6:52ef06ee93dd4095ae7498edb9e1c28e (a) (votes visibles) (sondage present dans sondages participes)
+vote admin e61a350a1d714e479aad526ee85b7bc6:c86b0b775e154fdeaf51ae1e5ef4074d (b) (votes visibles) (sondage present dans sondages participes)
+ en connecté peut admin les votes, mais pas en deconnecté
+sondage crées (sondage present, peut voter)
+
+by connected user
+~~~~~~~~~~~~~~~~~
+
+admin 075ab18c50c74f83b894c042bba84ff5:0f51b7c953f6427f9c85807fa838d44f (peut voter)
+vote anonyme 075ab18c50c74f83b894c042bba84ff5:4937a887797a4ab5ac618152383512ae (a,b) (votes non visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 075ab18c50c74f83b894c042bba84ff5:f162acd5dd8a4242a6f38b098ecec3c3 (a) (votes visibles si connecté) (sondage present dans sondages participes)
+vote user2 075ab18c50c74f83b894c042bba84ff5:320e5771bede4c64888a7254fc84a56c () (votes non visibles) (sondage present dans sondages participes)
+vote admin 075ab18c50c74f83b894c042bba84ff5:02dbe56ac36d458d95f1fe07ba783f61 (b) (votes visibles si connecté) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by admin user
+~~~~~~~~~~~~~
+
+admin a04bd349d8964c4fad48ac6ececc60a0:a1346bb80bb84913983e91673c76e80c (peut voter)
+vote anonyme a04bd349d8964c4fad48ac6ececc60a0:e6fa20f2afb24bdebfdc579c2574a3ab (a,b) (votes non visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user a04bd349d8964c4fad48ac6ececc60a0:01b2b146c6874593b678261f42014935 (a) (votes non visibles) (sondage present dans sondages participes)
+vote admin a04bd349d8964c4fad48ac6ececc60a0:cf4f77e74b2f40428595452ce2ee6fbf (b) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+onlyVoter free poll
+--------------------
+
+by not connected user
+~~~~~~~~~~~~~~~~~~~~~
+
+admin 8518ede7bf1247d2ba0dfe222575c5ba:ea5c96d4d44547f9b0717f30bfa6dd03 (peut voter)
+vote anonyme 8518ede7bf1247d2ba0dfe222575c5ba:fa914a31f6c94cfa8561f48e3c45d6cf (a,b) (votes visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 8518ede7bf1247d2ba0dfe222575c5ba:5c67d277460b4b4eb1fb59a26bf4a622 (a) (votes visibles connecté ou non) (sondage present dans sondages participes)
+vote admin 8518ede7bf1247d2ba0dfe222575c5ba:28d450be407e4eabbb787739ec27ae52 (b) (votes visibles connecté ou non) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by connected user
+~~~~~~~~~~~~~~~~~
+
+admin b321ddccf7d743bf9c67b2664231d14f:a48f1b97a3f84443845009c074298bce (peut voter)
+vote anonyme b321ddccf7d743bf9c67b2664231d14f:938e4831d7d547a59fd6d76c3bdfe6b5 (a,b) (votes visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user b321ddccf7d743bf9c67b2664231d14f:b3e407acc97b4911b0de470b1d45a68f (a) (votes visibles connecté ou non) (sondage present dans sondages participes)
+vote admin b321ddccf7d743bf9c67b2664231d14f:6f980a4541e04edd9dec95d3dbde0830 (b) (votes visibles connecté ou non) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by admin user
+~~~~~~~~~~~~~
+
+admin 7103c6d4a79246699425e99e1f344b98:717ebe61a3b64fcea453c9cba5953149 (peut voter)
+vote anonyme 7103c6d4a79246699425e99e1f344b98:ad50a5d406d84aa09e3a02dd9ad0116c (a,b) (vote visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 7103c6d4a79246699425e99e1f344b98:24abe4ba077341b489af505531ac93de (a) (sondage present dans sondages participes)
+vote admin 7103c6d4a79246699425e99e1f344b98:2237dbc51f7c4268a8a7e10f6146ae87 (b) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+everybody free poll
+-------------------
+
+by not connected user
+~~~~~~~~~~~~~~~~~~~~~
+
+admin 2262a31f374e4969bb3593e762c0cae6:659bb046fc06493f9909ca9f34ca6261 (peut voter)
+vote anonyme 2262a31f374e4969bb3593e762c0cae6:6909131490ab4a1abae0daaf15129cdb (a,b) (votes visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 2262a31f374e4969bb3593e762c0cae6:f058910736af48e9905f83f3f5de5b8d (a) (sondage present dans sondages participes)
+vote admin 2262a31f374e4969bb3593e762c0cae6:2d97c079df054a7c9fc321b2df3488f3 (b) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by connected user
+~~~~~~~~~~~~~~~~~
+
+admin 4cd79d032aa7433d9944ec9376c385c0:f26e253004d14547b465b5a414b65a7f (peut voter)
+vote anonyme 4cd79d032aa7433d9944ec9376c385c0:307222b5e17442758bd23fc9d8a19f5e (a,b) (votes visibles)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 4cd79d032aa7433d9944ec9376c385c0:8a10f049538142669ca84bb034f7a886 (a) (sondage present dans sondages participes)
+vote admin 4cd79d032aa7433d9944ec9376c385c0:6e92bf48f672429ea265a2647bef415d (b) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by admin user
+~~~~~~~~~~~~~
+
+admin 3300e59939bd4c9797e360060b8e54be:c370172faf7a4108be0d76630af34c4b (peut voter)
+vote anonyme 3300e59939bd4c9797e360060b8e54be:4399e0ff6dbe4544b64861d1e234ee1a (a,b) (sondage present dans sondages participes)
+vote creator (vote interdit mais peut admin les votes)
+vote moderate (vote interdit mais peut admin les votes)
+vote user 3300e59939bd4c9797e360060b8e54be:5af1c33357084f89a56d1cde89584cb7 (a) (sondage present dans sondages participes)
+vote admin 3300e59939bd4c9797e360060b8e54be:335e6a3921fb4dd5b6220c55311b7931 (b) (sondage present dans sondages participes)
+sondage crées (sondage present, peut voter)
\ No newline at end of file
Modified: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/pollendb.h2.db
===================================================================
(Binary files differ)
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/075ab18c50c74f83b894c042bba84ff5.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/075ab18c50c74f83b894c042bba84ff5.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/075ab18c50c74f83b894c042bba84ff5.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyCreator free poll (by conntected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par le créateur ou un administrateur (crée par un utilisateur connecté)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5</id>
+ <updated>2012-08-24T09:22:00Z</updated>
+ <published>2012-08-24T09:22:00Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:22:00Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connecter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5</id>
+ <updated>2012-08-24T09:23:34Z</updated>
+ <published>2012-08-24T09:23:34Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:23:34Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5</id>
+ <updated>2012-08-24T09:25:15Z</updated>
+ <published>2012-08-24T09:25:15Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:25:15Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5</id>
+ <updated>2012-08-24T09:25:43Z</updated>
+ <published>2012-08-24T09:25:43Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:25:43Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5</id>
+ <updated>2012-08-24T09:27:46Z</updated>
+ <published>2012-08-24T09:27:46Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:27:46Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user2(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/075ab18c50c74f83b894c042bba84ff5" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T09:33:30Z</updated>
+ <published>2012-08-24T09:33:30Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T09:33:30Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/075ab18c50c74f83b894c042bba84ff5.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/2262a31f374e4969bb3593e762c0cae6.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/2262a31f374e4969bb3593e762c0cae6.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/2262a31f374e4969bb3593e762c0cae6.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : everybody free poll (by not connected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <subtitle>sondage libre dont les votes sont visibles par tous (crée par un utilisateur non connecté)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6</id>
+ <updated>2012-08-24T09:53:11Z</updated>
+ <published>2012-08-24T09:53:11Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:53:11Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6</id>
+ <updated>2012-08-24T12:18:52Z</updated>
+ <published>2012-08-24T12:18:52Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:18:52Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6</id>
+ <updated>2012-08-24T12:20:02Z</updated>
+ <published>2012-08-24T12:20:02Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:20:02Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6</id>
+ <updated>2012-08-24T12:24:43Z</updated>
+ <published>2012-08-24T12:24:43Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:24:43Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/2262a31f374e4969bb3593e762c0cae6" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T12:25:10Z</updated>
+ <published>2012-08-24T12:25:10Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T12:25:10Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/2262a31f374e4969bb3593e762c0cae6.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/3300e59939bd4c9797e360060b8e54be.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/3300e59939bd4c9797e360060b8e54be.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/3300e59939bd4c9797e360060b8e54be.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : everybody free poll (by admin user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be" />
+ <subtitle>sondage libre dont les votes sont visibles par tous (crée par un administrateur)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be</id>
+ <updated>2012-08-24T09:52:27Z</updated>
+ <published>2012-08-24T09:52:27Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:52:27Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be</id>
+ <updated>2012-08-24T13:28:22Z</updated>
+ <published>2012-08-24T13:28:22Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T13:28:22Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be</id>
+ <updated>2012-08-24T13:29:19Z</updated>
+ <published>2012-08-24T13:29:19Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T13:29:19Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/3300e59939bd4c9797e360060b8e54be" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T13:30:31Z</updated>
+ <published>2012-08-24T13:30:31Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T13:30:31Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/3300e59939bd4c9797e360060b8e54be.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/4cd79d032aa7433d9944ec9376c385c0.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/4cd79d032aa7433d9944ec9376c385c0.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/4cd79d032aa7433d9944ec9376c385c0.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : everybody free poll (by connected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0" />
+ <subtitle>sondage libre dont les votes sont visibles par tous (crée par un utilisateur connecté)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0</id>
+ <updated>2012-08-24T09:53:59Z</updated>
+ <published>2012-08-24T09:53:59Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:53:59Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0</id>
+ <updated>2012-08-24T12:36:22Z</updated>
+ <published>2012-08-24T12:36:22Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:36:22Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0</id>
+ <updated>2012-08-24T13:12:31Z</updated>
+ <published>2012-08-24T13:12:31Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T13:12:31Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/4cd79d032aa7433d9944ec9376c385c0" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T13:24:53Z</updated>
+ <published>2012-08-24T13:24:53Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T13:24:53Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/4cd79d032aa7433d9944ec9376c385c0.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/7103c6d4a79246699425e99e1f344b98.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/7103c6d4a79246699425e99e1f344b98.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/7103c6d4a79246699425e99e1f344b98.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyVoter free poll (by admin user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par les participants, créateurs et admin (crée par un administrateur)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T09:51:17Z</updated>
+ <published>2012-08-24T09:51:17Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:51:17Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T11:07:26Z</updated>
+ <published>2012-08-24T11:07:26Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:07:26Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T11:09:10Z</updated>
+ <published>2012-08-24T11:09:10Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:09:10Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T11:10:31Z</updated>
+ <published>2012-08-24T11:10:31Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:10:31Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T11:12:33Z</updated>
+ <published>2012-08-24T11:12:33Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:12:33Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T11:15:22Z</updated>
+ <published>2012-08-24T11:15:22Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:15:22Z</dc:date>
+ </entry>
+ <entry>
+ <title>Delete vote of 'not connected' for reason ''</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98</id>
+ <updated>2012-08-24T12:16:02Z</updated>
+ <published>2012-08-24T12:16:02Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:16:02Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/7103c6d4a79246699425e99e1f344b98" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T12:17:13Z</updated>
+ <published>2012-08-24T12:17:13Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T12:17:13Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/7103c6d4a79246699425e99e1f344b98.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/8518ede7bf1247d2ba0dfe222575c5ba.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/8518ede7bf1247d2ba0dfe222575c5ba.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/8518ede7bf1247d2ba0dfe222575c5ba.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyVoter free poll (by admin user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par les participants, créateurs et admin</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba</id>
+ <updated>2012-08-24T09:48:47Z</updated>
+ <published>2012-08-24T09:48:47Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:48:47Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba</id>
+ <updated>2012-08-24T10:13:26Z</updated>
+ <published>2012-08-24T10:13:26Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T10:13:26Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba</id>
+ <updated>2012-08-24T11:02:46Z</updated>
+ <published>2012-08-24T11:02:46Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T11:02:46Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/8518ede7bf1247d2ba0dfe222575c5ba" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T11:05:11Z</updated>
+ <published>2012-08-24T11:05:11Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T11:05:11Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/8518ede7bf1247d2ba0dfe222575c5ba.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/a04bd349d8964c4fad48ac6ececc60a0.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/a04bd349d8964c4fad48ac6ececc60a0.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/a04bd349d8964c4fad48ac6ececc60a0.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyCreator free poll (by admin user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par le créateur ou un administrateur (crée par un administrateur)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0</id>
+ <updated>2012-08-24T09:36:06Z</updated>
+ <published>2012-08-24T09:36:06Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:36:06Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0</id>
+ <updated>2012-08-24T09:37:01Z</updated>
+ <published>2012-08-24T09:37:01Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:37:01Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0</id>
+ <updated>2012-08-24T09:38:20Z</updated>
+ <published>2012-08-24T09:38:20Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T09:38:20Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/a04bd349d8964c4fad48ac6ececc60a0" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T09:40:27Z</updated>
+ <published>2012-08-24T09:40:27Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T09:40:27Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/a04bd349d8964c4fad48ac6ececc60a0.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/b321ddccf7d743bf9c67b2664231d14f.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/b321ddccf7d743bf9c67b2664231d14f.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/b321ddccf7d743bf9c67b2664231d14f.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyVoter free poll (by connected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par les participants, créateurs et admin (crée par un utilisateur connecté)</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f</id>
+ <updated>2012-08-24T09:50:21Z</updated>
+ <published>2012-08-24T09:50:21Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T09:50:21Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f</id>
+ <updated>2012-08-24T12:27:30Z</updated>
+ <published>2012-08-24T12:27:30Z</published>
+ <summary type="text">Poll result: a=0, b=0</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:27:30Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'not connected'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f</id>
+ <updated>2012-08-24T12:29:20Z</updated>
+ <published>2012-08-24T12:29:20Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:29:20Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f</id>
+ <updated>2012-08-24T12:29:26Z</updated>
+ <published>2012-08-24T12:29:26Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:29:26Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f</id>
+ <updated>2012-08-24T12:31:23Z</updated>
+ <published>2012-08-24T12:31:23Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T12:31:23Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/b321ddccf7d743bf9c67b2664231d14f" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T12:34:12Z</updated>
+ <published>2012-08-24T12:34:12Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T12:34:12Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/b321ddccf7d743bf9c67b2664231d14f.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/e61a350a1d714e479aad526ee85b7bc6.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/e61a350a1d714e479aad526ee85b7bc6.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/e61a350a1d714e479aad526ee85b7bc6.xml 2012-08-24 15:46:34 UTC (rev 3626)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : onlyCreator free poll (by not conntected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <subtitle>sondage libre dont les votes ne sont visibles que par le créateur ou un administrateur</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:28:00Z</updated>
+ <published>2012-08-24T08:28:00Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-24T08:28:00Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'anonymous vote'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:33:09Z</updated>
+ <published>2012-08-24T08:33:09Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T08:33:09Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:42:02Z</updated>
+ <published>2012-08-24T08:42:02Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T08:42:02Z</dc:date>
+ </entry>
+ <entry>
+ <title>Delete vote of 'chemit+user(a)codelutin.com' for reason ''</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:48:37Z</updated>
+ <published>2012-08-24T08:48:37Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T08:48:37Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'chemit+user(a)codelutin.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:50:58Z</updated>
+ <published>2012-08-24T08:50:58Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T08:50:58Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6</id>
+ <updated>2012-08-24T08:54:08Z</updated>
+ <published>2012-08-24T08:54:08Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-24T08:54:08Z</dc:date>
+ </entry>
+ <entry>
+ <title>Vote modified for 'admin(a)domain.com'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/e61a350a1d714e479aad526ee85b7bc6" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-24T08:54:45Z</updated>
+ <published>2012-08-24T08:54:45Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-24T08:54:45Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/e61a350a1d714e479aad526ee85b7bc6.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
r3625 - trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility
by tchemit@users.chorem.org 23 Aug '12
by tchemit@users.chorem.org 23 Aug '12
23 Aug '12
Author: tchemit
Date: 2012-08-24 01:05:40 +0200 (Fri, 24 Aug 2012)
New Revision: 3625
Url: http://chorem.org/repositories/revision/pollen/3625
Log:
remove not used directory in it
Removed:
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/emails/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/tmp/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/uploadedImages/
1
0
r3624 - in trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui: . actions
by tchemit@users.chorem.org 23 Aug '12
by tchemit@users.chorem.org 23 Aug '12
23 Aug '12
Author: tchemit
Date: 2012-08-24 01:05:15 +0200 (Fri, 24 Aug 2012)
New Revision: 3624
Url: http://chorem.org/repositories/revision/pollen/3624
Log:
improve flash messages (using a Set instead of a List to avoid duplicated messages)
Modified:
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-08-23 22:56:27 UTC (rev 3623)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenSession.java 2012-08-23 23:05:15 UTC (rev 3624)
@@ -22,8 +22,8 @@
*/
package org.chorem.pollen.ui;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
import com.opensymphony.xwork2.ActionContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,8 +34,8 @@
import javax.servlet.http.HttpSession;
import java.io.Serializable;
import java.util.Iterator;
-import java.util.List;
import java.util.Map;
+import java.util.Set;
/**
* User session to put in servlet session.
@@ -108,9 +108,9 @@
return (T) result;
}
- public <T extends Serializable> List<T> getDynamicListData(String token) {
+ public <T extends Serializable> Set<T> getDynamicSetData(String token) {
Serializable result = getDynamicData().get(token);
- return (List<T>) result;
+ return (Set<T>) result;
}
public <T extends Serializable> T consumeDynamicData(String token) {
@@ -121,15 +121,15 @@
return result;
}
- public <T extends Serializable> List<T> consumeDynamicListData(String token) {
- List<T> result = getDynamicListData(token);
+ public <T extends Serializable> Set<T> consumeDynamicSetData(String token) {
+ Set<T> result = getDynamicSetData(token);
if (result != null) {
removeDynamicData(token);
}
return result;
}
- public <T extends Serializable> void putDynamicListData(String token, List<T> data) {
+ public <T extends Serializable> void putDynamicSetData(String token, Set<T> data) {
getDynamicData().put(token, (Serializable) data);
if (log.isDebugEnabled()) {
log.debug("Dynamic attributes size : " + getDynamicData().size());
@@ -167,10 +167,10 @@
}
public void addMessage(String messageScope, String message) {
- List<String> messages = getDynamicListData(messageScope);
+ Set<String> messages = getDynamicSetData(messageScope);
if (messages == null) {
- messages = Lists.newArrayList(message);
- putDynamicListData(messageScope, messages);
+ messages = Sets.newHashSet(message);
+ putDynamicSetData(messageScope, messages);
} else {
messages.add(message);
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-08-23 22:56:27 UTC (rev 3623)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-08-23 23:05:15 UTC (rev 3624)
@@ -305,44 +305,44 @@
}
public Collection<String> getFlashMessages() {
- List<String> result = getPollenSession().consumeDynamicListData(PollenSession.SESSION_TOKEN_MESSAGES);
+ Collection<String> result = getPollenSession().consumeDynamicSetData(PollenSession.SESSION_TOKEN_MESSAGES);
return result;
}
public Collection<String> getFlashErrors() {
- List<String> result = getPollenSession().consumeDynamicListData(PollenSession.SESSION_TOKEN_ERRORS);
+ Collection<String> result = getPollenSession().consumeDynamicSetData(PollenSession.SESSION_TOKEN_ERRORS);
return result;
}
public Collection<String> getFlashWarnings() {
- List<String> result = getPollenSession().consumeDynamicListData(PollenSession.SESSION_TOKEN_WARNINGS);
+ Collection<String> result = getPollenSession().consumeDynamicSetData(PollenSession.SESSION_TOKEN_WARNINGS);
return result;
}
public boolean hasFlashMessages() {
- List<String> result = getPollenSession().getDynamicListData(PollenSession.SESSION_TOKEN_MESSAGES);
+ Collection<String> result = getPollenSession().getDynamicSetData(PollenSession.SESSION_TOKEN_MESSAGES);
return CollectionUtils.isNotEmpty(result);
}
public boolean hasFlashErrors() {
- List<String> result = getPollenSession().getDynamicListData(PollenSession.SESSION_TOKEN_ERRORS);
+ Collection<String> result = getPollenSession().getDynamicSetData(PollenSession.SESSION_TOKEN_ERRORS);
return CollectionUtils.isNotEmpty(result);
}
public boolean hasFlashWarnings() {
- List<String> result = getPollenSession().getDynamicListData(PollenSession.SESSION_TOKEN_WARNINGS);
+ Collection<String> result = getPollenSession().getDynamicSetData(PollenSession.SESSION_TOKEN_WARNINGS);
return CollectionUtils.isNotEmpty(result);
}
public void clearFlashMessages() {
- List<String> result = getPollenSession().getDynamicListData(PollenSession.SESSION_TOKEN_MESSAGES);
+ Collection<String> result = getPollenSession().getDynamicSetData(PollenSession.SESSION_TOKEN_MESSAGES);
if (result != null) {
result.clear();
}
}
public void clearFlashErrors() {
- List<String> result = getPollenSession().getDynamicListData(PollenSession.SESSION_TOKEN_ERRORS);
+ Collection<String> result = getPollenSession().getDynamicSetData(PollenSession.SESSION_TOKEN_ERRORS);
if (result != null) {
result.clear();
}
1
0
Author: tchemit
Date: 2012-08-24 00:56:27 +0200 (Fri, 24 Aug 2012)
New Revision: 3623
Url: http://chorem.org/repositories/revision/pollen/3623
Log:
refs #742: Option to allow all users to show voting of others users (test for anonymous poll) + improve service code (remove none public api)
Added:
trunk/pollen-ui-struts2/src/test/resources/its/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/pollendb.h2.db
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/emails/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/87cb5b1529374ac0b8c6b7f0b98e169c.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/cacb52f4d49047b7a7aa24ec528fcc87.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/fdd43f4c8d614a9aa48047804583508a.xml
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/tmp/
trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/uploadedImages/
Modified:
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/admin/SummaryPoll.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/PollService.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -95,8 +95,6 @@
* @param userAccount Optinal User account to attach to the creator
* @param clone Flag to copy or not ids in case of poll cloning
* @return the Poll ready for edition (no longer linked to the topia context)
- * @see #getNewPoll(UserAccount)
- * @see #getNewPollCopy(String, UserAccount, boolean)
*/
public Poll getPollEditable(String pollUid,
UserAccount userAccount,
@@ -106,11 +104,118 @@
if (StringUtils.isEmpty(pollUid)) {
// creates a new poll
- result = getNewPoll(userAccount);
+ PollDAO pollDAO = getDAO(Poll.class);
+ result = newInstance(pollDAO);
+
+ PollenConfiguration configuration = getConfiguration();
+
+ // default values from configuration
+ result.setChoiceType(configuration.getDefaultChoiceType());
+ result.setVoteCountingType(configuration.getDefaultVoteCountingType());
+ result.setPollType(configuration.getDefaultPollType());
+ result.setPollVoteVisibility(configuration.getDefaultPollVoteVisibility());
+ result.setPollCommentVisibility(configuration.getDefaultPollCommentVisibility());
+
+ // Initialize creator of the poll
+ PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
+ PollAccount creator = newInstance(pollAccountDAO);
+
+ if (userAccount != null) {
+
+ // Link the creator with the user
+ creator.setVotingId(userAccount.getDisplayName());
+ creator.setEmail(userAccount.getEmail());
+ creator.setUserAccount(userAccount);
+ }
+ result.setCreator(creator);
} else {
// obtains a copy of an existing poll
- result = getNewPollCopy(pollUid, userAccount, clone);
+
+ // load for sure existing poll
+ Poll poll = getExistingPollByPollId(pollUid);
+
+ PollDAO pollDAO = getDAO(Poll.class);
+ result = newInstance(pollDAO);
+
+ PollenBinderHelper.simpleCopy(poll, result, !clone);
+ if (clone) {
+ // reset id for clone case
+ result.setPollId(null);
+ }
+
+ // -- Creator -- //
+ PollAccount creatorLoaded = poll.getCreator();
+ PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
+ PollAccount creatorEditable = newInstance(pollAccountDAO);
+ result.setCreator(creatorEditable);
+
+ PollenBinderHelper.simpleCopy(creatorLoaded, creatorEditable, !clone);
+ if (clone) {
+ // reset id for clone case
+ creatorEditable.setAccountId(null);
+ }
+
+ if (creatorEditable.getUserAccount() == null) {
+ // use the incoming userAccount
+ creatorEditable.setUserAccount(userAccount);
+ }
+
+ // -- Choice -- //
+ Function<Choice, Choice> choiceCreator =
+ PollenServiceFunctions.newChoiceCreator(poll.getChoiceType());
+ Iterable<Choice> choices =
+ Iterables.transform(poll.getChoice(), choiceCreator);
+
+ for (Choice choiceLoaded : choices) {
+ if (clone) {
+ // reset id for clone case
+ choiceLoaded.setTopiaId(null);
+ }
+ result.addChoice(choiceLoaded);
+ }
+
+ // -- VotingList -- //
+ VotingListDAO votingListDAO = getDAO(VotingList.class);
+ PersonToListDAO personToListDAO = getDAO(PersonToList.class);
+ for (VotingList votingListLoaded : poll.getVotingList()) {
+ VotingList votingListEditable = newInstance(votingListDAO);
+ result.addVotingList(votingListEditable);
+ // Do not keep votingLists topiaId, to simplify the update will delete old votingLists and create new ones
+ PollenBinderHelper.simpleCopy(
+ votingListLoaded, votingListEditable, false);
+
+ for (PersonToList personToListLoaded : votingListLoaded.getPollAccountPersonToList()) {
+ PersonToList personToListEditable = newInstance(personToListDAO);
+ votingListEditable.addPollAccountPersonToList(personToListEditable);
+ // Do not keep personToLists topiaId, to simplify the update will delete old personToLists and create new ones
+ PollenBinderHelper.simpleCopy(
+ personToListLoaded, personToListEditable, false);
+
+ PollAccount personLoaded = personToListLoaded.getPollAccount();
+ PollAccount personEditable = newInstance(pollAccountDAO);
+ personToListEditable.setPollAccount(personEditable);
+ // copy the person, keeping topiaId is useless because we have the link with PersonToList
+ PollenBinderHelper.simpleCopy(
+ personLoaded, personEditable, false);
+ if (clone) {
+ // reset id for clone case
+ personEditable.setAccountId(null);
+ }
+ }
+ }
+
+ // -- PreventRule -- //
+ PreventRuleDAO preventRuleDAO = getDAO(PreventRule.class);
+ for (PreventRule preventRuleLoaded : poll.getPreventRule()) {
+ PreventRule preventRuleEditable = newInstance(preventRuleDAO);
+ PollenBinderHelper.simpleCopy(
+ preventRuleLoaded, preventRuleEditable, !clone);
+ result.addPreventRule(preventRuleEditable);
+ }
+
+ // Load votes to have the correct size used to check if vote is started
+ result.setVote(poll.getVote());
}
return result;
}
@@ -415,19 +520,12 @@
public Poll getExistingPollByPollId(String pollId) throws PollNotFoundException {
- Preconditions.checkNotNull(pollId);
- try {
- PollDAO dao = getDAO(Poll.class);
- Poll result = dao.findByPollId(pollId);
+ Poll result = getPollByPollId(pollId);
- if (result == null) {
- throw new PollNotFoundException();
- }
- return result;
- } catch (TopiaException e) {
- throw new PollenTechnicalException(
- "Could not find poll with pollId '" + pollId + "'", e);
+ if (result == null) {
+ throw new PollNotFoundException();
}
+ return result;
}
/**
@@ -485,7 +583,9 @@
if (pollAccountLoaded != null) {
// copy the loaded pollAccount
- result = copyPollAccount(pollAccountLoaded);
+ result = newInstance(dao);
+ PollenBinderHelper.copy("", pollAccountLoaded, result, true);
+ result.setUserAccount(pollAccountLoaded.getUserAccount());
// Don't remove or update userAccount link if already set
if (withUserAccount && result.getUserAccount() == null) {
@@ -499,173 +599,14 @@
if (result == null) {
// create a new pollAccount linked to given userAccount (if not null)
- result = getNewPollAccount(userAccount);
+ result = newInstance(dao);
+ String votingId = userAccount != null ? userAccount.getDisplayName() : "";
+ result.setVotingId(votingId);
+ result.setUserAccount(userAccount);
}
return result;
}
- /**
- * Build a new Poll instance with given {@code user} as creator
- *
- * @param user Build a new Poll instance with given {@code user} as creator
- * @return Build a new Poll instance with given {@code user} as creator
- */
- protected Poll getNewPoll(UserAccount user) {
-
- PollDAO pollDAO = getDAO(Poll.class);
- Poll result = newInstance(pollDAO);
-
- PollenConfiguration configuration = getConfiguration();
-
- // default values from configuration
- result.setChoiceType(configuration.getDefaultChoiceType());
- result.setVoteCountingType(configuration.getDefaultVoteCountingType());
- result.setPollType(configuration.getDefaultPollType());
- result.setPollVoteVisibility(configuration.getDefaultPollVoteVisibility());
- result.setPollCommentVisibility(configuration.getDefaultPollCommentVisibility());
-
- // Initialize creator of the poll
- PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
- PollAccount creator = newInstance(pollAccountDAO);
-
- if (user != null) {
-
- // Link the creator with the user
- creator.setVotingId(user.getDisplayName());
- creator.setEmail(user.getEmail());
- creator.setUserAccount(user);
- }
- result.setCreator(creator);
-
- return result;
- }
-
- /**
- * Obtains a copy of an existing poll given his {@code pollUid}.
- * <p/>
- * If flag {@code clone} is setted to {@code true}, then all id will
- * be removed (pollId, accountId, topiaId).
- *
- * @param pollUid the {@link Poll#getPollId()} of the poll to copy
- * @param userAccount optional incoming user account to link to the
- * {@link Poll#getCreator()}
- * @param clone flag to clone or not the copy of the poll (if setted
- * to {@code true} then all id will be removed).
- * @return the copy of the poll
- * @throws PollNotFoundException if poll was not found
- */
- protected Poll getNewPollCopy(String pollUid,
- UserAccount userAccount,
- boolean clone) throws PollNotFoundException {
-
- // pollUid can not be blank
- Preconditions.checkState(StringUtils.isNotBlank(pollUid));
-
- // load for sure existing poll
- Poll poll = getExistingPollByPollId(pollUid);
-
- PollDAO pollDAO = getDAO(Poll.class);
- Poll result = newInstance(pollDAO);
-
- PollenBinderHelper.simpleCopy(poll, result, !clone);
- if (clone) {
- // reset id for clone case
- result.setPollId(null);
- }
-
- // -- Creator -- //
- PollAccount creatorLoaded = poll.getCreator();
- PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
- PollAccount creatorEditable = newInstance(pollAccountDAO);
- result.setCreator(creatorEditable);
-
- PollenBinderHelper.simpleCopy(creatorLoaded, creatorEditable, !clone);
- if (clone) {
- // reset id for clone case
- creatorEditable.setAccountId(null);
- }
-
- if (creatorEditable.getUserAccount() == null) {
- // use the incoming userAccount
- creatorEditable.setUserAccount(userAccount);
- }
-
- // -- Choice -- //
- Function<Choice, Choice> choiceCreator =
- PollenServiceFunctions.newChoiceCreator(poll.getChoiceType());
- Iterable<Choice> choices =
- Iterables.transform(poll.getChoice(), choiceCreator);
-
- for (Choice choiceLoaded : choices) {
- if (clone) {
- // reset id for clone case
- choiceLoaded.setTopiaId(null);
- }
- result.addChoice(choiceLoaded);
- }
-
- // -- VotingList -- //
- VotingListDAO votingListDAO = getDAO(VotingList.class);
- PersonToListDAO personToListDAO = getDAO(PersonToList.class);
- for (VotingList votingListLoaded : poll.getVotingList()) {
- VotingList votingListEditable = newInstance(votingListDAO);
- result.addVotingList(votingListEditable);
- // Do not keep votingLists topiaId, to simplify the update will delete old votingLists and create new ones
- PollenBinderHelper.simpleCopy(
- votingListLoaded, votingListEditable, false);
-
- for (PersonToList personToListLoaded : votingListLoaded.getPollAccountPersonToList()) {
- PersonToList personToListEditable = newInstance(personToListDAO);
- votingListEditable.addPollAccountPersonToList(personToListEditable);
- // Do not keep personToLists topiaId, to simplify the update will delete old personToLists and create new ones
- PollenBinderHelper.simpleCopy(
- personToListLoaded, personToListEditable, false);
-
- PollAccount personLoaded = personToListLoaded.getPollAccount();
- PollAccount personEditable = newInstance(pollAccountDAO);
- personToListEditable.setPollAccount(personEditable);
- // copy the person, keeping topiaId is useless because we have the link with PersonToList
- PollenBinderHelper.simpleCopy(
- personLoaded, personEditable, false);
- if (clone) {
- // reset id for clone case
- personEditable.setAccountId(null);
- }
- }
- }
-
- // -- PreventRule -- //
- PreventRuleDAO preventRuleDAO = getDAO(PreventRule.class);
- for (PreventRule preventRuleLoaded : poll.getPreventRule()) {
- PreventRule preventRuleEditable = newInstance(preventRuleDAO);
- PollenBinderHelper.simpleCopy(
- preventRuleLoaded, preventRuleEditable, !clone);
- result.addPreventRule(preventRuleEditable);
- }
-
- // Load votes to have the correct size used to check if vote is started
- result.setVote(poll.getVote());
-
- return result;
- }
-
- protected PollAccount copyPollAccount(PollAccount source) {
- PollAccountDAO dao = getDAO(PollAccount.class);
- PollAccount result = newInstance(dao);
- PollenBinderHelper.copy("", source, result, true);
- result.setUserAccount(source.getUserAccount());
- return result;
- }
-
- public PollAccount getNewPollAccount(UserAccount userAccount) {
- PollAccountDAO dao = getDAO(PollAccount.class);
- PollAccount result = newInstance(dao);
- String votingId = userAccount != null ? userAccount.getDisplayName() : "";
- result.setVotingId(votingId);
- result.setUserAccount(userAccount);
- return result;
- }
-
public void deletePoll(String pollId) throws PollNotFoundException {
// can not have an null nor empty pollId
@@ -1094,4 +1035,166 @@
}
}
+
+// /**
+// * Build a new Poll instance with given {@code user} as creator
+// *
+// * @param user Build a new Poll instance with given {@code user} as creator
+// * @return Build a new Poll instance with given {@code user} as creator
+// */
+// protected Poll getNewPoll(UserAccount user) {
+//
+// PollDAO pollDAO = getDAO(Poll.class);
+// Poll result = newInstance(pollDAO);
+//
+// PollenConfiguration configuration = getConfiguration();
+//
+// // default values from configuration
+// result.setChoiceType(configuration.getDefaultChoiceType());
+// result.setVoteCountingType(configuration.getDefaultVoteCountingType());
+// result.setPollType(configuration.getDefaultPollType());
+// result.setPollVoteVisibility(configuration.getDefaultPollVoteVisibility());
+// result.setPollCommentVisibility(configuration.getDefaultPollCommentVisibility());
+//
+// // Initialize creator of the poll
+// PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
+// PollAccount creator = newInstance(pollAccountDAO);
+//
+// if (user != null) {
+//
+// // Link the creator with the user
+// creator.setVotingId(user.getDisplayName());
+// creator.setEmail(user.getEmail());
+// creator.setUserAccount(user);
+// }
+// result.setCreator(creator);
+//
+// return result;
+// }
+//
+// /**
+// * Obtains a copy of an existing poll given his {@code pollUid}.
+// * <p/>
+// * If flag {@code clone} is setted to {@code true}, then all id will
+// * be removed (pollId, accountId, topiaId).
+// *
+// * @param pollUid the {@link Poll#getPollId()} of the poll to copy
+// * @param userAccount optional incoming user account to link to the
+// * {@link Poll#getCreator()}
+// * @param clone flag to clone or not the copy of the poll (if setted
+// * to {@code true} then all id will be removed).
+// * @return the copy of the poll
+// * @throws PollNotFoundException if poll was not found
+// */
+// protected Poll getNewPollCopy(String pollUid,
+// UserAccount userAccount,
+// boolean clone) throws PollNotFoundException {
+//
+// // pollUid can not be blank
+// Preconditions.checkState(StringUtils.isNotBlank(pollUid));
+//
+// // load for sure existing poll
+// Poll poll = getExistingPollByPollId(pollUid);
+//
+// PollDAO pollDAO = getDAO(Poll.class);
+// Poll result = newInstance(pollDAO);
+//
+// PollenBinderHelper.simpleCopy(poll, result, !clone);
+// if (clone) {
+// // reset id for clone case
+// result.setPollId(null);
+// }
+//
+// // -- Creator -- //
+// PollAccount creatorLoaded = poll.getCreator();
+// PollAccountDAO pollAccountDAO = getDAO(PollAccount.class);
+// PollAccount creatorEditable = newInstance(pollAccountDAO);
+// result.setCreator(creatorEditable);
+//
+// PollenBinderHelper.simpleCopy(creatorLoaded, creatorEditable, !clone);
+// if (clone) {
+// // reset id for clone case
+// creatorEditable.setAccountId(null);
+// }
+//
+// if (creatorEditable.getUserAccount() == null) {
+// // use the incoming userAccount
+// creatorEditable.setUserAccount(userAccount);
+// }
+//
+// // -- Choice -- //
+// Function<Choice, Choice> choiceCreator =
+// PollenServiceFunctions.newChoiceCreator(poll.getChoiceType());
+// Iterable<Choice> choices =
+// Iterables.transform(poll.getChoice(), choiceCreator);
+//
+// for (Choice choiceLoaded : choices) {
+// if (clone) {
+// // reset id for clone case
+// choiceLoaded.setTopiaId(null);
+// }
+// result.addChoice(choiceLoaded);
+// }
+//
+// // -- VotingList -- //
+// VotingListDAO votingListDAO = getDAO(VotingList.class);
+// PersonToListDAO personToListDAO = getDAO(PersonToList.class);
+// for (VotingList votingListLoaded : poll.getVotingList()) {
+// VotingList votingListEditable = newInstance(votingListDAO);
+// result.addVotingList(votingListEditable);
+// // Do not keep votingLists topiaId, to simplify the update will delete old votingLists and create new ones
+// PollenBinderHelper.simpleCopy(
+// votingListLoaded, votingListEditable, false);
+//
+// for (PersonToList personToListLoaded : votingListLoaded.getPollAccountPersonToList()) {
+// PersonToList personToListEditable = newInstance(personToListDAO);
+// votingListEditable.addPollAccountPersonToList(personToListEditable);
+// // Do not keep personToLists topiaId, to simplify the update will delete old personToLists and create new ones
+// PollenBinderHelper.simpleCopy(
+// personToListLoaded, personToListEditable, false);
+//
+// PollAccount personLoaded = personToListLoaded.getPollAccount();
+// PollAccount personEditable = newInstance(pollAccountDAO);
+// personToListEditable.setPollAccount(personEditable);
+// // copy the person, keeping topiaId is useless because we have the link with PersonToList
+// PollenBinderHelper.simpleCopy(
+// personLoaded, personEditable, false);
+// if (clone) {
+// // reset id for clone case
+// personEditable.setAccountId(null);
+// }
+// }
+// }
+//
+// // -- PreventRule -- //
+// PreventRuleDAO preventRuleDAO = getDAO(PreventRule.class);
+// for (PreventRule preventRuleLoaded : poll.getPreventRule()) {
+// PreventRule preventRuleEditable = newInstance(preventRuleDAO);
+// PollenBinderHelper.simpleCopy(
+// preventRuleLoaded, preventRuleEditable, !clone);
+// result.addPreventRule(preventRuleEditable);
+// }
+//
+// // Load votes to have the correct size used to check if vote is started
+// result.setVote(poll.getVote());
+//
+// return result;
+// }
+
+// protected PollAccount copyPollAccount(PollAccount source) {
+// PollAccountDAO dao = getDAO(PollAccount.class);
+// PollAccount result = newInstance(dao);
+// PollenBinderHelper.copy("", source, result, true);
+// result.setUserAccount(source.getUserAccount());
+// return result;
+// }
+
+// public PollAccount getNewPollAccount(UserAccount userAccount) {
+// PollAccountDAO dao = getDAO(PollAccount.class);
+// PollAccount result = newInstance(dao);
+// String votingId = userAccount != null ? userAccount.getDisplayName() : "";
+// result.setVotingId(votingId);
+// result.setUserAccount(userAccount);
+// return result;
+// }
}
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/SecurityService.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -23,6 +23,7 @@
package org.chorem.pollen.services.impl;
import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.PollenTechnicalException;
@@ -31,6 +32,7 @@
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
import org.chorem.pollen.business.persistence.PollAccountDAO;
+import org.chorem.pollen.business.persistence.PollVoteVisibility;
import org.chorem.pollen.business.persistence.UserAccount;
import org.chorem.pollen.business.persistence.Vote;
import org.chorem.pollen.services.PollenServiceSupport;
@@ -38,6 +40,7 @@
import java.util.Date;
import java.util.EnumSet;
+import java.util.List;
import java.util.Set;
import static org.chorem.pollen.PollenUserSecurityContext.PollenUserSecurityRole;
@@ -157,6 +160,7 @@
}
if (securityContext.isAdmin()) {
+
// pollen admin can always access vote page
return null;
}
@@ -188,6 +192,13 @@
return false;
}
+ if (securityContext.isWithAccountId() &&
+ securityContext.getAccountId().equals(poll.getCreator().getAccountId())) {
+
+ // user can not vote with his creator accountId (must use a new one)
+ return false;
+ }
+
if (!poll.isPollFree() && !securityContext.isRestrictedVoter()) {
// on none free poll, only restricted user can vote
@@ -198,6 +209,28 @@
return true;
}
+ public boolean isCanVoteFromSummary(PollenUserSecurityContext securityContext) {
+
+ Poll poll = securityContext.getPoll();
+
+ Date now = serviceContext.getCurrentTime();
+
+ if (!poll.isRunning(now)) {
+
+ // poll is not running, can not vote
+ return false;
+ }
+
+ if (!poll.isPollFree() && !securityContext.isRestrictedVoter()) {
+
+ // on none free poll, only restricted user can vote
+ return false;
+ }
+
+ // ok can vote
+ return true;
+ }
+
public boolean isCanModifyVote(PollenUserSecurityContext securityContext,
String voteId) {
@@ -353,6 +386,47 @@
return result;
}
+ public List<Vote> filterVotes(Poll poll,
+ List<Vote> allVotes,
+ PollenUserSecurityContext userSecurityContext) {
+ List<Vote> result = null;
+
+ PollVoteVisibility voteVisibility = poll.getPollVoteVisibility();
+ switch (voteVisibility) {
+
+ case NOBODY:
+
+ // no votes visible to anybody
+ break;
+ case CREATOR_ONLY:
+
+ if (userSecurityContext.isAdmin() ||
+ userSecurityContext.isCreator()) {
+ // only admin or creator can see votes
+ result = allVotes;
+ }
+ break;
+ case PARTICIPANT_ONLY:
+
+ if (userSecurityContext.isRestrictedVoter() ||
+ userSecurityContext.isVoter()) {
+ // only participant or voter can see votes
+ result = allVotes;
+ }
+ break;
+ case EVERYBODY:
+
+ // no restriction, everybody can sse votes
+ result = allVotes;
+ break;
+ }
+
+ if (result == null) {
+ result = Lists.newArrayList();
+ }
+ return result;
+ }
+
protected boolean isPollCreator(Poll poll,
String accountId,
UserAccount userAccount) {
@@ -432,5 +506,4 @@
"from poll '" + pollId + "'", e);
}
}
-
}
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/impl/VoteService.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -57,27 +57,27 @@
/** Logger. */
private static final Log log = LogFactory.getLog(VoteService.class);
- public Vote getNewVote(Poll poll, PollAccount account) {
+// public Vote getNewVote(Poll poll, PollAccount account) {
+//
+// Preconditions.checkNotNull(poll);
+//
+// VoteDAO voteDAO = getDAO(Vote.class);
+// VoteToChoiceDAO voteToChoiceDAO = getDAO(VoteToChoice.class);
+//
+// Vote result = newInstance(voteDAO);
+// result.setPollAccount(account);
+// result.setWeight(1.);
+//
+// // Prepare the List of VoteToChoice with Poll's choices
+// for (Choice choice : poll.getChoice()) {
+// VoteToChoice element = newInstance(voteToChoiceDAO);
+// element.setChoice(choice);
+// result.addChoiceVoteToChoice(element);
+// }
+//
+// return result;
+// }
- Preconditions.checkNotNull(poll);
-
- VoteDAO voteDAO = getDAO(Vote.class);
- VoteToChoiceDAO voteToChoiceDAO = getDAO(VoteToChoice.class);
-
- Vote result = newInstance(voteDAO);
- result.setPollAccount(account);
- result.setWeight(1.);
-
- // Prepare the List of VoteToChoice with Poll's choices
- for (Choice choice : poll.getChoice()) {
- VoteToChoice element = newInstance(voteToChoiceDAO);
- element.setChoice(choice);
- result.addChoiceVoteToChoice(element);
- }
-
- return result;
- }
-
public Vote getVoteEditable(Poll poll, PollAccount accountEditable) {
Preconditions.checkNotNull(poll);
@@ -128,7 +128,18 @@
result.setChoiceVoteToChoice(voteToChoices);
} else {
- result = getNewVote(poll, accountEditable);
+
+ result = newInstance(dao);
+ result.setPollAccount(accountEditable);
+ result.setWeight(1.);
+
+ VoteToChoiceDAO voteToChoiceDAO = getDAO(VoteToChoice.class);
+ // Prepare the List of VoteToChoice with Poll's choices
+ for (Choice choice : poll.getChoice()) {
+ VoteToChoice element = newInstance(voteToChoiceDAO);
+ element.setChoice(choice);
+ result.addChoiceVoteToChoice(element);
+ }
}
// Retrieve weight for Restricted Poll with existing account
@@ -153,7 +164,6 @@
String pollAccountId = pollAccount.getTopiaId();
PollAccount pollAccountLoaded;
-
if (pollAccountId == null) {
// Create new account
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/admin/SummaryPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/admin/SummaryPoll.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/admin/SummaryPoll.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -112,7 +112,7 @@
}
public boolean isCanVote() {
- return getSecurityService().isCanVote(getUserSecurityContext());
+ return getSecurityService().isCanVoteFromSummary(getUserSecurityContext());
}
@Override
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/AbstractVoteAction.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -87,13 +87,6 @@
private boolean feedFileExisting;
/**
- * Is user the poll's creator ?
- *
- * @since 1.3
- */
- private boolean creatorUser;
-
- /**
* Loaded poll account (from the pollUri).
*
* @since 1.3
@@ -101,20 +94,6 @@
private PollAccount pollAccount;
/**
- * Is vote allowed for current user?
- *
- * @since 1.3
- */
- private boolean voteAllowed;
-
- /**
- * Is current user can go to results.
- *
- * @since 1.4
- */
- private boolean resultAllowed;
-
- /**
* All votes for the poll.
*
* @since 1.3
@@ -299,7 +278,8 @@
}
public boolean isCreatorOrAdmin() {
- return creatorUser || isUserAdmin();
+ return getUserSecurityContext().isCreator() ||
+ getUserSecurityContext().isAdmin();
}
public boolean isAccountFieldDisplayed() {
@@ -360,11 +340,11 @@
}
public boolean isVoteAllowed() {
- return voteAllowed;
+ return !isModerate() && getSecurityService().isCanVote(getUserSecurityContext());
}
public boolean isResultAllowed() {
- return resultAllowed;
+ return getSecurityService().isCanAccessResult(getUserSecurityContext());
}
public String getPollCreatorName() {
@@ -431,64 +411,63 @@
public String prepareVotePage() throws Exception {
- boolean moderate = isModerate();
-
+ // load poll
loadPoll();
// Current poll account
loadPollAccount();
- // All votes
+ // Get all votes
// TODO no pagination for the moment, need to retrieve the correct page depends on current pollAccount
- votes = getVoteService().getAllVotes(poll);
+ List<Vote> allVotes = getVoteService().getAllVotes(poll);
- // is vote allowed ?
- if (moderate) {
+ // only keep possible votes for current user security context
+ votes = getSecurityService().filterVotes(poll,
+ allVotes,
+ getUserSecurityContext());
- // while moderate vote, no way to vote
- voteAllowed = false;
+ if (isVoteAllowed()) {
- } else {
- voteAllowed = getSecurityService().isCanVote(getUserSecurityContext());
- }
-
- // is can display result link ?
- resultAllowed = getSecurityService().isCanAccessResult(getUserSecurityContext());
-
- if (voteAllowed) {
-
// load modifiable vote
vote = getVoteService().getVoteEditable(poll, pollAccount);
}
- // load poll results
- PollResultList pollResultList =
- getPollResultsService().getResults(poll);
+ if (isResultAllowed()) {
- results = pollResultList.getPollResults();
+ // load poll results
+ PollResultList pollResultList =
+ getPollResultsService().getResults(poll);
- if (log.isDebugEnabled()) {
- for (PollResult res : results) {
- log.debug(res.getName() + ": " + res.getValue()
- + ", (voteCounting=" + res.getVoteCountingType()
- + ", byGroup=" + res.isByGroup() + ")");
+ results = pollResultList.getPollResults();
+
+ if (log.isDebugEnabled()) {
+ for (PollResult res : results) {
+ log.debug(res.getName() + ": " + res.getValue()
+ + ", (voteCounting=" + res.getVoteCountingType()
+ + ", byGroup=" + res.isByGroup() + ")");
+ }
}
}
- // load comments
- comments = getPollCommentService().getAllComments(poll.getPollId());
+ if (isCommentAllowed()) {
+ // load comments
+ comments = getPollCommentService().getAllComments(poll.getPollId());
+ }
+
feedFileExisting = getPollFeedService().isFeedExists(poll);
- creatorUser = getUserSecurityContext().isCreator();
-
if (log.isInfoEnabled()) {
Date now = serviceContext.getCurrentTime();
log.info("pollChoiceOrVoteStarted = " + isPollChoiceOrVoteStarted());
log.info("pollChoiceRunning = " + isPollChoiceRunning());
log.info("pollRunning = " + poll.isRunning(now));
log.info("accountFieldDisplayed = " + isAccountFieldDisplayed());
- log.info("creatorUser = " + creatorUser);
+ log.info("creatorOrAdminUser = " + isCreatorOrAdmin());
+ log.info("isVoteAllowed = " + isVoteAllowed());
+ log.info("isCommentAllowed = " + isCommentAllowed());
+ log.info("isResultAllowed = " + isResultAllowed());
+ log.info("pollVoteVisibility = " + poll.getPollVoteVisibility());
}
return INPUT;
}
@@ -518,28 +497,7 @@
protected void loadPoll() throws PollNotFoundException {
-// setPollUri(getUserSecurityContext().getPollUri());
-
poll = getUserSecurityContext().getPoll();
-
-// // Ensure uri for poll and pollAccount loading
-// PollUri pollUri = getPollUri();
-// if (pollUri == null) {
-// String[] values = getParameters().get(PARAM_POLL_URI);
-// pollUri = PollUriConverter.convertFromString(values);
-// setPollUri(pollUri);
-// }
-//
-// String pollId = pollUri.getPollId();
-// if (StringUtils.isNotEmpty(pollId)) {
-// poll = getPollService().getExistingPollByPollId(pollId);
-// }
-//// Preconditions.checkNotNull(poll,
-//// "Can't load poll with id = [" + pollId + "]");
-////
-//// if (log.isDebugEnabled()) {
-//// log.debug("Poll TopiaId: " + poll.getTopiaId());
-//// }
}
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/vote/VoteForPoll.java 2012-08-23 22:56:27 UTC (rev 3623)
@@ -27,9 +27,11 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.PollenUserSecurityContext;
import org.chorem.pollen.bean.PollUrl;
import org.chorem.pollen.business.persistence.Poll;
import org.chorem.pollen.business.persistence.PollAccount;
+import org.chorem.pollen.business.persistence.PollVoteVisibility;
import org.chorem.pollen.business.persistence.Vote;
import org.chorem.pollen.business.persistence.VoteToChoice;
import org.chorem.pollen.services.impl.VoteService;
@@ -59,15 +61,63 @@
prepareVotePage();
// Messages
- if (getPoll().isClosed()) {
+ Poll poll = getPoll();
+
+ PollenUserSecurityContext securityContext = getUserSecurityContext();
+
+ if (poll.isClosed()) {
addFlashWarning(_("pollen.information.pollClosed"));
} else if (!isPollStarted()) {
addFlashWarning(_("pollen.information.pollNotStarted"));
} else if (isPollFinished()) {
addFlashWarning(_("pollen.information.pollFinished"));
} else if (!isVoteAllowed()) {
- addFlashWarning(_("pollen.information.pollCanNotVote"));
+
+ // check crator does not try to vote with his creator id
+ if (securityContext.isCreator() && securityContext.isWithAccountId()) {
+
+ if (poll.getCreator().getAccountId().equals(securityContext.getAccountId())) {
+
+ // only participant can see votes
+ addFlashWarning(_("pollen.information.canNotvotewithCreatorAccountId"));
+ }
+ } else {
+
+ addFlashWarning(_("pollen.information.pollCanNotVote"));
+ }
}
+
+ if (isVoteAllowed()) {
+
+ PollVoteVisibility voteVisibility = poll.getPollVoteVisibility();
+ switch (voteVisibility) {
+
+ case NOBODY:
+ // anonymous poll (nobody can see votes)
+ addFlashWarning(_("pollen.information.voteNotVisible.anonymousPoll"));
+ break;
+ case CREATOR_ONLY:
+ if (!securityContext.isAdmin()) {
+
+ // only creator can see votes
+ addFlashWarning(_("pollen.information.voteNotVisible.onlyCreator"));
+ }
+ break;
+ case PARTICIPANT_ONLY:
+ if (!securityContext.isVoter() || securityContext.isRestrictedVoter()) {
+
+ // only participant can see votes
+ addFlashWarning(_("pollen.information.voteNotVisible.onlyParticipant"));
+ }
+ break;
+ case EVERYBODY:
+ // free to everybody
+ break;
+ }
+ } else {
+
+
+ }
if (isPollChoiceRunning()) {
addFlashMessage(_("pollen.information.pollChoiceRunning"));
}
@@ -191,7 +241,7 @@
// For free Poll, display the update Url (useless if user is logged or
// not using a modify url)
if (poll.isPollFree() &&
- !isUserLoggued() &&
+ (!isUserLoggued() || vote.isAnonymous()) &&
StringUtils.isBlank(getUserSecurityContext().getAccountId())) {
String pollId = poll.getPollId();
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-08-23 22:56:27 UTC (rev 3623)
@@ -260,6 +260,7 @@
pollen.fieldset.vote.options=Votes
pollen.fieldset.vote.options.help=Configure votes of the poll
pollen.image.not.loaded=Image not loaded
+pollen.information.canNotvotewithCreatorAccountId=You are not authorized to vote with your creator account Id
pollen.information.choice.deleted=Choice deleted.
pollen.information.comment.added=Comment added.
pollen.information.comment.deleted=Comment deleted.
@@ -303,6 +304,9 @@
pollen.information.vote.createdWithUpdateUrl=Vote saved, you can modify it using this address\: <br/> <a href\="%1$s">%1$s</a>
pollen.information.vote.creatorUser=You are identified as the poll's creator. You can't vote with this URL.
pollen.information.vote.deleted=Vote deleted.
+pollen.information.voteNotVisible.anonymousPoll=Votes are not visible\: Anonymous poll
+pollen.information.voteNotVisible.onlyCreator=Votes are not visible\: Only creator (or admin) can see votes
+pollen.information.voteNotVisible.onlyParticipant=Votes are not visible\: Only participant (or voter) can see votes
pollen.information.your.are.loggued=You are logged.
pollen.label.contact.administrator=Send an email to an administrator
pollen.label.pollClonePage=Clone your poll
Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-08-23 22:56:27 UTC (rev 3623)
@@ -261,6 +261,7 @@
pollen.fieldset.vote.options=Les votes
pollen.fieldset.vote.options.help=Configurer les votes du sondage
pollen.image.not.loaded=Image non chargée
+pollen.information.canNotvotewithCreatorAccountId=Vous n'êtes pas autorisé à voter avec votre identifiant de créateur
pollen.information.choice.deleted=Choix supprimé.
pollen.information.comment.added=Commentaire ajouté.
pollen.information.comment.deleted=Commentaire supprimé.
@@ -304,6 +305,9 @@
pollen.information.vote.createdWithUpdateUrl=Vote enregistré, vous pourrez le modifier à l'adresse suivante \: <br/> <a href\="%1$s">%1$s</a>
pollen.information.vote.creatorUser=Vous êtes identifié comme le créateur du sondage. Vous ne pouvez pas voter avec cette URL.
pollen.information.vote.deleted=Vote supprimé.
+pollen.information.voteNotVisible.anonymousPoll=Votes non visibles \: Sondage anonyme
+pollen.information.voteNotVisible.onlyCreator=Votes non visibles \: Seul le créateur (ou administrateur) peut les voir
+pollen.information.voteNotVisible.onlyParticipant=Votes non visibles \: Seul les participants peuvent les voir
pollen.information.your.are.loggued=Vous êtes connecté.
pollen.label.contact.administrator=Contacter un administrateur
pollen.label.pollClonePage=Cloner le sondage
Modified: trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp
===================================================================
--- trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-08-23 22:55:11 UTC (rev 3622)
+++ trunk/pollen-ui-struts2/src/main/webapp/WEB-INF/jsp/poll/vote.jsp 2012-08-23 22:56:27 UTC (rev 3623)
@@ -173,6 +173,9 @@
<s:form id="voteForm" validate="true">
<s:hidden key="pollUri" label=''/>
+<s:if test="poll.anonymous">
+ <s:hidden key="vote.anonymous" label="" value='true'/>
+</s:if>
<table id="poll">
<thead>
<tr>
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt 2012-08-23 22:56:27 UTC (rev 3623)
@@ -0,0 +1,37 @@
+================
+PollVoteVibility
+================
+
+Pour tester la portée des votes (http://chorem.org/issues/742)
+
+anonymous free poll
+-------------------
+
+by not connected user
+~~~~~~~~~~~~~~~~~~~~~
+
+admin cacb52f4d49047b7a7aa24ec528fcc87:e814ba6e25174d5983ad796c400520f5 (peut voter)
+vote anonyme cacb52f4d49047b7a7aa24ec528fcc87:56acbf87f3c049c2adc757ef1da88ee1 (a,b)
+vote creator (interdit)
+vote user cacb52f4d49047b7a7aa24ec528fcc87:c54a12ffde5d44a4ad9e609aa644fc80 (a) (sondage non present dans sondages participes)
+vote admin cacb52f4d49047b7a7aa24ec528fcc87:15500943e49842c88d6ceeefaa62e2ed (b) (sondage non present dans sondages participes)
+
+by connected user
+~~~~~~~~~~~~~~~~~
+
+admin fdd43f4c8d614a9aa48047804583508a:9a8e8523f1ba404f8fde45d1844c59ac (peut voter)
+vote anonyme fdd43f4c8d614a9aa48047804583508a:07dc154dce514d368441eaa9f27d21e0 (a,b)
+vote creator (interdit connecté ou pas)
+vote user fdd43f4c8d614a9aa48047804583508a:e67a14d729c7440ebe4a55d589cba515 (a) (sondage non present dans sondages participes)
+vote admin fdd43f4c8d614a9aa48047804583508a:29993520034a41168def96f908d2696b (b) (sondage non present dans sondages participes)
+sondage crées (sondage present, peut voter)
+
+by admin user
+~~~~~~~~~~~~~
+
+admin 87cb5b1529374ac0b8c6b7f0b98e169c:65a3caf0bf204226bfcd259c69e56ca8 (peut voter)
+vote anonyme 87cb5b1529374ac0b8c6b7f0b98e169c:a0ff6892a28b4a65809b16cd8903245e (a,b)
+vote creator (interdit connecté ou pas)
+vote user 87cb5b1529374ac0b8c6b7f0b98e169c:fd47e01378354fcaa220a4ffd0974417 (a) (sondage non present dans sondages participes)
+vote admin 87cb5b1529374ac0b8c6b7f0b98e169c:010f05042ff3485c834d1ecdc4d17f1e (b) (sondage non present dans sondages participes)
+sondage crées (sondage present, peut voter)
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/README.txt
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/pollendb.h2.db
===================================================================
(Binary files differ)
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/db/pollendb.h2.db
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/87cb5b1529374ac0b8c6b7f0b98e169c.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/87cb5b1529374ac0b8c6b7f0b98e169c.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/87cb5b1529374ac0b8c6b7f0b98e169c.xml 2012-08-23 22:56:27 UTC (rev 3623)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : anonymous free poll (by admin user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c" />
+ <subtitle>sondage anonyme libre (tout le monde peut voter mais personne ne voit les votes) créé par un administrateur</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c</id>
+ <updated>2012-08-23T22:28:04Z</updated>
+ <published>2012-08-23T22:28:04Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-23T22:28:04Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c</id>
+ <updated>2012-08-23T22:28:59Z</updated>
+ <published>2012-08-23T22:28:59Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:28:59Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c</id>
+ <updated>2012-08-23T22:29:49Z</updated>
+ <published>2012-08-23T22:29:49Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:29:49Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/87cb5b1529374ac0b8c6b7f0b98e169c" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-23T22:34:35Z</updated>
+ <published>2012-08-23T22:34:35Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-23T22:34:35Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/87cb5b1529374ac0b8c6b7f0b98e169c.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/cacb52f4d49047b7a7aa24ec528fcc87.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/cacb52f4d49047b7a7aa24ec528fcc87.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/cacb52f4d49047b7a7aa24ec528fcc87.xml 2012-08-23 22:56:27 UTC (rev 3623)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : anonymous free poll (by not connected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87" />
+ <subtitle>sondage anonyme libre (tout le monde peut voter mais personne ne voit les votes) créé par un utilisateur anonyme</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87</id>
+ <updated>2012-08-23T22:19:42Z</updated>
+ <published>2012-08-23T22:19:42Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-23T22:19:42Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87</id>
+ <updated>2012-08-23T22:20:28Z</updated>
+ <published>2012-08-23T22:20:28Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:20:28Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87</id>
+ <updated>2012-08-23T22:21:23Z</updated>
+ <published>2012-08-23T22:21:23Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:21:23Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/cacb52f4d49047b7a7aa24ec528fcc87" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-23T22:22:09Z</updated>
+ <published>2012-08-23T22:22:09Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-23T22:22:09Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/cacb52f4d49047b7a7aa24ec528fcc87.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/fdd43f4c8d614a9aa48047804583508a.xml
===================================================================
--- trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/fdd43f4c8d614a9aa48047804583508a.xml (rev 0)
+++ trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/fdd43f4c8d614a9aa48047804583508a.xml 2012-08-23 22:56:27 UTC (rev 3623)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <title>Pollen : anonymous free poll (by connected user)</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a" />
+ <subtitle>sondage anonyme libre (tout le monde peut voter mais personne ne voit les votes) créé par un utilisateur connecté</subtitle>
+ <entry>
+ <title />
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a</id>
+ <updated>2012-08-23T22:23:36Z</updated>
+ <published>2012-08-23T22:23:36Z</published>
+ <summary type="text" />
+ <dc:creator />
+ <dc:date>2012-08-23T22:23:36Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a</id>
+ <updated>2012-08-23T22:24:13Z</updated>
+ <published>2012-08-23T22:24:13Z</published>
+ <summary type="text">Poll result: a=1, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:24:13Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a" />
+ <author>
+ <name />
+ </author>
+ <id>http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a</id>
+ <updated>2012-08-23T22:25:09Z</updated>
+ <published>2012-08-23T22:25:09Z</published>
+ <summary type="text">Poll result: a=2, b=1</summary>
+ <dc:creator />
+ <dc:date>2012-08-23T22:25:09Z</dc:date>
+ </entry>
+ <entry>
+ <title>New vote from 'Anonymous voter'</title>
+ <link rel="alternate" href="http://localhost:8080/pollen/poll/votefor/fdd43f4c8d614a9aa48047804583508a" />
+ <author>
+ <name />
+ </author>
+ <updated>2012-08-23T22:26:18Z</updated>
+ <published>2012-08-23T22:26:18Z</published>
+ <summary type="text">Poll result: a=2, b=2</summary>
+ <dc:date>2012-08-23T22:26:18Z</dc:date>
+ </entry>
+</feed>
+
Property changes on: trunk/pollen-ui-struts2/src/test/resources/its/pollVoteVisibility/feeds/fdd43f4c8d614a9aa48047804583508a.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
23 Aug '12
Author: tchemit
Date: 2012-08-24 00:55:11 +0200 (Fri, 24 Aug 2012)
New Revision: 3622
Url: http://chorem.org/repositories/revision/pollen/3622
Log:
ameliration configuration logger
Modified:
trunk/pollen-ui-struts2/src/main/resources/log4j.properties
Modified: trunk/pollen-ui-struts2/src/main/resources/log4j.properties
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/log4j.properties 2012-08-23 22:54:44 UTC (rev 3621)
+++ trunk/pollen-ui-struts2/src/main/resources/log4j.properties 2012-08-23 22:55:11 UTC (rev 3622)
@@ -27,8 +27,7 @@
log4j.appender.console.layout.ConversionPattern=%d [%p] %c %m%n
log4j.logger.org.chorem.pollen=INFO
-log4j.logger.org.chorem.pollen.ui.PollenShiroIsAdministratorFilter=DEBUG
-log4j.logger.org.nuiton=INFO
+log4j.logger.org.nuiton=WARN
# FileAppender : need to have pollen.log.dir in system properties at application startup
log4j.appender.file=org.apache.log4j.RollingFileAppender
1
0
r3621 - in trunk: pollen-persistence/src/main/java/org/chorem/pollen pollen-ui-struts2/src/main/java/org/chorem/pollen/ui
by tchemit@users.chorem.org 23 Aug '12
by tchemit@users.chorem.org 23 Aug '12
23 Aug '12
Author: tchemit
Date: 2012-08-24 00:54:44 +0200 (Fri, 24 Aug 2012)
New Revision: 3621
Url: http://chorem.org/repositories/revision/pollen/3621
Log:
afficher la configuration au demarrage de l'application
Modified:
trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java
trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
Modified: trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java
===================================================================
--- trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java 2012-08-23 18:03:24 UTC (rev 3620)
+++ trunk/pollen-persistence/src/main/java/org/chorem/pollen/PollenConfiguration.java 2012-08-23 22:54:44 UTC (rev 3621)
@@ -23,6 +23,7 @@
package org.chorem.pollen;
import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.logging.Log;
@@ -39,7 +40,10 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Enumeration;
+import java.util.List;
import java.util.Properties;
/**
@@ -343,4 +347,23 @@
"Could not create directory " + directory, e);
}
}
+
+ public static final Comparator<PollenConfigurationOption> POLLEN_CONFIGURATION_OPTION_COMPARATOR = new Comparator<PollenConfigurationOption>() {
+ @Override
+ public int compare(PollenConfigurationOption o1, PollenConfigurationOption o2) {
+ return o1.key.compareTo(o2.key);
+ }
+ };
+
+ public String printConfig() {
+ StringBuilder builder = new StringBuilder();
+ List<PollenConfigurationOption> options = Lists.newArrayList(PollenConfigurationOption.values());
+ Collections.sort(options, POLLEN_CONFIGURATION_OPTION_COMPARATOR);
+ for (PollenConfigurationOption option : options) {
+ builder.append(String.format("\n%1$-40s = %2$s",
+ option.getKey(),
+ applicationConfig.getOption(option)));
+ }
+ return builder.toString();
+ }
}
Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java
===================================================================
--- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-08-23 18:03:24 UTC (rev 3620)
+++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationListener.java 2012-08-23 22:54:44 UTC (rev 3621)
@@ -175,6 +175,16 @@
*/
protected PollenConfiguration prepareConfiguration() {
PollenConfiguration configuration = new PollenConfiguration();
+ if (log.isInfoEnabled()) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("\n-----------------------------------------------------------------------------------------------------");
+ builder.append("\nPollen configuration:");
+ builder.append(configuration.printConfig());
+ builder.append("\n-----------------------------------------------------------------------------------------------------");
+ log.info(builder.toString());
+ }
+
+
return configuration;
}
1
0
Author: tchemit
Date: 2012-08-23 20:03:24 +0200 (Thu, 23 Aug 2012)
New Revision: 3620
Url: http://chorem.org/repositories/revision/pollen/3620
Log:
fixes #781: Updates to topia 2.6.12
fixes #720: Updates to nuiton-utils 2.6
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-08-19 11:20:12 UTC (rev 3619)
+++ trunk/pom.xml 2012-08-23 18:03:24 UTC (rev 3620)
@@ -153,12 +153,12 @@
<projectId>pollen</projectId>
<!-- customized versions -->
- <topiaVersion>2.6.12-SNAPSHOT</topiaVersion>
+ <topiaVersion>2.6.12</topiaVersion>
<eugenePluginVersion>2.5</eugenePluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
<nuitonWebVersion>1.11</nuitonWebVersion>
- <nuitonUtilsVersion>2.6-SNAPSHOT</nuitonUtilsVersion>
+ <nuitonUtilsVersion>2.6</nuitonUtilsVersion>
<h2Version>1.3.167</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
<struts2Version>2.3.4</struts2Version>
1
0
r3619 - in trunk/pollen-ui-struts2: . src/test/java/org/chorem/pollen/ui src/test/java/org/chorem/pollen/ui/it
by tchemit@users.chorem.org 19 Aug '12
by tchemit@users.chorem.org 19 Aug '12
19 Aug '12
Author: tchemit
Date: 2012-08-19 13:20:12 +0200 (Sun, 19 Aug 2012)
New Revision: 3619
Url: http://chorem.org/repositories/revision/pollen/3619
Log:
try selenium test with same driver for a complete class test
Added:
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java
Modified:
trunk/pollen-ui-struts2/pom.xml
trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
Modified: trunk/pollen-ui-struts2/pom.xml
===================================================================
--- trunk/pollen-ui-struts2/pom.xml 2012-08-19 11:19:48 UTC (rev 3618)
+++ trunk/pollen-ui-struts2/pom.xml 2012-08-19 11:20:12 UTC (rev 3619)
@@ -277,7 +277,8 @@
<deployFiles>target/${project.build.finalName}.war</deployFiles>
<defaultWebContextPath>pollen</defaultWebContextPath>
- <defaultSiteUrl>http://localhost:8080/${defaultWebContextPath}
+ <defaultSiteUrl>
+ http://localhost:8080/${defaultWebContextPath}
</defaultSiteUrl>
<defaultLogDir>${basedir}/target</defaultLogDir>
</properties>
@@ -605,7 +606,8 @@
<configuration>
<daemon>true</daemon>
<webAppConfig>
- <descriptor>${basedir}/src/test/resources/web-test.xml
+ <descriptor>
+ ${basedir}/src/test/resources/web-test.xml
</descriptor>
<contextPath>/${defaultWebContextPath}</contextPath>
@@ -648,7 +650,7 @@
<siteUrl>${pollenTestUrl}</siteUrl>
</environmentVariables>
<includes>
- <include>**/*SIT.java</include>
+ <include>**/LoginSIT.java</include>
</includes>
</configuration>
</execution>
@@ -660,6 +662,96 @@
</profile>
<profile>
+ <id>selenium2</id>
+ <!--activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation-->
+ <properties>
+ <pollenTestServerPort>8765</pollenTestServerPort>
+ <pollenTestUrl>
+ http://localhost:${pollenTestServerPort}/${defaultWebContextPath}
+ </pollenTestUrl>
+ </properties>
+
+ <build>
+ <defaultGoal>post-integration-test</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>start-pollen</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <daemon>true</daemon>
+ <webAppConfig>
+ <descriptor>
+ ${basedir}/src/test/resources/web-test.xml
+ </descriptor>
+ <contextPath>/${defaultWebContextPath}</contextPath>
+
+ </webAppConfig>
+ <useTestClasspath>true</useTestClasspath>
+ <systemProperties>
+ <systemProperty>
+ <name>siteUrl</name>
+ <value>${pollenTestUrl}</value>
+ </systemProperty>
+ <systemProperty>
+ <name>jetty.port</name>
+ <value>${pollenTestServerPort}</value>
+ </systemProperty>
+ </systemProperties>
+ </configuration>
+ </execution>
+
+ <execution>
+ <id>stop-pollen</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <environmentVariables>
+ <siteUrl>${pollenTestUrl}</siteUrl>
+ </environmentVariables>
+ <includes>
+ <include>**/*T.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*SIT.java</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
<id>selenium-server</id>
<properties>
<pollenTestServerPort>8765</pollenTestServerPort>
@@ -686,7 +778,8 @@
<configuration>
<daemon>false</daemon>
<webAppConfig>
- <descriptor>${basedir}/src/test/resources/web-test.xml
+ <descriptor>
+ ${basedir}/src/test/resources/web-test.xml
</descriptor>
<contextPath>/${defaultWebContextPath}</contextPath>
Modified: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-08-19 11:19:48 UTC (rev 3618)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/PollenFixtures.java 2012-08-19 11:20:12 UTC (rev 3619)
@@ -163,4 +163,7 @@
return date(year, month, day, 0, 0);
}
+ public String logoutURL() {
+ return baseUrl() + "user/logout";
+ }
}
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java 2012-08-19 11:20:12 UTC (rev 3619)
@@ -0,0 +1,205 @@
+package org.chorem.pollen.ui.it;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.pollen.ui.PollenFixtures;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */
+@RunWith(value = Parameterized.class)
+public abstract class AbstractPollenWebDriverIT {
+
+ /** Logger. */
+ protected final Log log = LogFactory.getLog(getClass());
+
+ @Parameterized.Parameters
+ public static Collection<Object[]> driverTypes() {
+ return WebDriverResources.driverTypes();
+ }
+
+ @ClassRule
+ public static final WebDriverResources seleniumServer = new WebDriverResources();
+
+ protected final Class<? extends WebDriver> driverType;
+
+ protected WebDriver driver;
+
+ protected PollenFixtures fixtures;
+
+ @Before
+ public void setUp() throws Exception {
+ driver = seleniumServer.getDriver(driverType);
+ fixtures = new PollenFixtures();
+ }
+
+ @After
+ public void after() {
+
+ // make sure driver came back in original state:
+ // go back to home page and logout if was loggued in
+
+ gotoUrl(fixtures.logoutURL(), fixtures.homeURL(), true);
+
+ }
+
+ protected AbstractPollenWebDriverIT(Class<? extends WebDriver> driverType) {
+ this.driverType = driverType;
+ }
+
+ protected void gotoUrl(String url, boolean strict) {
+ gotoUrl(url, null, strict);
+ }
+
+ protected void gotoUrl(String url) {
+ gotoUrl(url, null, true);
+ }
+
+ protected void gotoUrl(String url, String fallBackUrl) {
+ gotoUrl(url, fallBackUrl, true);
+ }
+
+ protected void gotoUrl(String url, String fallBackUrl, boolean strict) {
+ driver.get(url);
+ String expectedUrl;
+ if (fallBackUrl == null) {
+ expectedUrl = url;
+ } else {
+ expectedUrl = fallBackUrl;
+ }
+ checkCurrentUrl(expectedUrl, strict);
+ }
+
+ /**
+ * Check that the current URL is the expected one.
+ * If it is a strict comparison, the URL should be the same that the wanted.
+ * If not, it only checks that the current URL start with the wanted url.
+ */
+ protected void checkCurrentUrl(String expectedUrl, boolean strict) {
+ if (strict) {
+ Assert.assertEquals("Current url [" + driver.getCurrentUrl() + "] should be " + expectedUrl, expectedUrl, driver.getCurrentUrl());
+ } else {
+ Assert.assertTrue("Current url [" + driver.getCurrentUrl() + "] should starts with " + expectedUrl, driver.getCurrentUrl().startsWith(expectedUrl));
+ }
+ }
+
+ protected WebElement findElement(By by) {
+ WebElement element = driver.findElement(by);
+ return element;
+ }
+
+ protected List<WebElement> findElements(By by) {
+ List<WebElement> result = driver.findElements(by);
+ return result;
+ }
+
+ /** Try to log in using the given {@code username} and {@code password}. */
+ protected void connect(String username, String password) {
+
+ // click on tologin element (display the login form)
+ WebElement loginClick = driver.findElement(By.id("tologin"));
+ loginClick.click();
+
+ // Find the text input element by its name
+ WebElement loginElement = driver.findElement(By.name("login"));
+ Assert.assertEquals("input", loginElement.getTagName());
+ Assert.assertTrue(loginElement.isDisplayed());
+ loginElement.sendKeys(username);
+
+ WebElement passwordElement = driver.findElement(By.name("password"));
+ Assert.assertTrue(passwordElement.isDisplayed());
+ Assert.assertEquals("input", passwordElement.getTagName());
+ passwordElement.sendKeys(password);
+
+ WebElement submit = driver.findElement(By.name("action:login"));
+ submit.click();
+ }
+
+ /** Prepare the poll with general data : one title and two choices */
+ void preparePoll() {
+ // Go on home page
+ gotoUrl(fixtures.createPollURL());
+
+ // Set title
+ sendKeysByName("poll.title", "My Poll");
+
+ // Set first choice
+ sendKeysByName("textChoice_0.name", "Choix numero un");
+
+ // Set second choice
+ sendKeysByName("textChoice_1.name", "Choix numero deux");
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its id (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysById(String webElementId, String value) {
+ sendKeysBy(By.id(webElementId), value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to its name (given in parameter)</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysByName(String webElementName, String value) {
+ By byName = By.name(webElementName);
+ sendKeysBy(byName, value);
+ }
+
+ /**
+ * Set a value for a WebElement.
+ * This operations does 3 steps :
+ * <ul>
+ * <li>Get the WebElement thanks to a {@link By} locator</li>
+ * <li>check the element is an input</li>
+ * <li>check the element is displayed</li>
+ * <li>clear the element</li>
+ * <li>send the wanted keys</li>
+ * </ul>
+ */
+ protected void sendKeysBy(By by, String value) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ webElement.sendKeys(value);
+ Assert.assertEquals(value, webElement.getAttribute("value"));
+ }
+
+ /** Get a WebElement with a {@link By} locator, and check it is an input and that is value is the one expected. */
+ protected void checkWebElementValue(By by, String expectedValue) {
+ WebElement webElement = findElement(by);
+ Assert.assertEquals("input", webElement.getTagName());
+ Assert.assertTrue(webElement.isDisplayed());
+ Assert.assertEquals(expectedValue, webElement.getAttribute("value"));
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/AbstractPollenWebDriverIT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java 2012-08-19 11:20:12 UTC (rev 3619)
@@ -0,0 +1,62 @@
+package org.chorem.pollen.ui.it;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since TODO
+ */
+public class LoginT extends AbstractPollenWebDriverIT {
+
+ public LoginT(Class<? extends WebDriver> driverType) {
+ super(driverType);
+ }
+
+ @Test
+ public void loginAdmin() throws Exception {
+
+ gotoUrl(fixtures.homeURL());
+
+ connect("admin", "admin");
+
+ // check info_success is on
+ findElement(By.className("info_success"));
+
+ // check there is a admin menu (so 4 menus)
+ List<WebElement> menus = findElements(By.className("menu_elt"));
+ Assert.assertEquals(4, menus.size());
+ }
+
+ @Test
+ public void loginUser() throws Exception {
+
+ gotoUrl(fixtures.homeURL());
+
+ connect("user", "user");
+
+ // check info_success is on
+ findElement(By.className("info_success"));
+
+ // check there is not a admin menu (so 3 menus)
+ List<WebElement> menus = findElements(By.className("menu_elt"));
+ Assert.assertEquals(3, menus.size());
+ }
+
+ @Test
+ public void badLogin() throws Exception {
+
+ gotoUrl(fixtures.homeURL());
+
+ connect("admin", "admin" + System.currentTimeMillis());
+
+ findElement(By.className("info_error"));
+ }
+}
Property changes on: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/LoginT.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Added: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java
===================================================================
--- trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java (rev 0)
+++ trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java 2012-08-19 11:20:12 UTC (rev 3619)
@@ -0,0 +1,134 @@
+package org.chorem.pollen.ui.it;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Web driver resource.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.4
+ */
+public class WebDriverResources extends TestWatcher {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(WebDriverResources.class);
+
+ protected static Collection<Object[]> safeDrivers;
+
+ protected Map<Class<? extends WebDriver>, WebDriver> servers =
+ Maps.newHashMap();
+
+ public static Collection<Object[]> driverTypes() {
+ if (safeDrivers == null) {
+
+ List<Class<? extends WebDriver>> allDrivers = Lists.newArrayList();
+ allDrivers.add(HtmlUnitDriver.class);
+ allDrivers.add(FirefoxDriver.class);
+// allDrivers.add(ChromeDriver.class);
+// allDrivers.add(InternetExplorerDriver.class);
+// allDrivers.add(SafariDriver.class);
+
+ List<Class<?>> checkedDrivers = Lists.newArrayList();
+ for (Class<? extends WebDriver> driver : allDrivers) {
+ boolean ok = checkDriver(driver);
+ if (ok) {
+ checkedDrivers.add(driver);
+ }
+ }
+ Object[][] data = new Object[checkedDrivers.size()][1];
+ int i = 0;
+ for (Class<?> checkedDriver : checkedDrivers) {
+ data[i++][0] = checkedDriver;
+ }
+ safeDrivers = Arrays.asList(data);
+ }
+
+ return safeDrivers;
+ }
+
+
+ private static boolean checkDriver(Class<? extends WebDriver> driverType) {
+
+ boolean result = false;
+ try {
+ createDriver(driverType, true);
+ result = true;
+ } catch (Exception e) {
+
+ // can not use this driver
+ if (log.isInfoEnabled()) {
+ log.info("Can not use driver " + driverType.getName(), e);
+ }
+ }
+
+ return result;
+ }
+
+ public <W extends WebDriver> W getDriver(Class<W> driverType) throws Exception {
+ W result = (W) servers.get(driverType);
+ if (result == null) {
+ result = createDriver(driverType, false);
+
+ if (HtmlUnitDriver.class == driverType) {
+ ((HtmlUnitDriver) result).setJavascriptEnabled(true);
+ }
+ servers.put(driverType, result);
+ }
+ return result;
+ }
+
+ @Override
+ protected void starting(Description description) {
+ String testName =
+ description.getClassName() + "#" + description.getMethodName();
+
+ if (log.isInfoEnabled()) {
+ log.info("Start test " + testName);
+ }
+ }
+
+ @Override
+ protected void finished(Description description) {
+
+ // close all servers
+
+ for (WebDriver webDriver : servers.values()) {
+ try {
+ webDriver.quit();
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Could not close nicely driver " + webDriver, e);
+ }
+ }
+ }
+ }
+
+ protected static <W extends WebDriver> W createDriver(Class<W> driverType,
+ boolean clear)
+ throws Exception {
+ W result = driverType.getConstructor().newInstance();
+
+ if (clear) {
+ result.close();
+ }
+
+ if (HtmlUnitDriver.class == driverType) {
+ ((HtmlUnitDriver) result).setJavascriptEnabled(true);
+ }
+ return result;
+ }
+
+}
Property changes on: trunk/pollen-ui-struts2/src/test/java/org/chorem/pollen/ui/it/WebDriverResources.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
1
0
19 Aug '12
Author: tchemit
Date: 2012-08-19 13:19:48 +0200 (Sun, 19 Aug 2012)
New Revision: 3618
Url: http://chorem.org/repositories/revision/pollen/3618
Log:
to logout may not be connected (for test purpose)
Modified:
trunk/pollen-ui-struts2/src/main/resources/shiro.ini
Modified: trunk/pollen-ui-struts2/src/main/resources/shiro.ini
===================================================================
--- trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-08-19 11:19:16 UTC (rev 3617)
+++ trunk/pollen-ui-struts2/src/main/resources/shiro.ini 2012-08-19 11:19:48 UTC (rev 3618)
@@ -42,6 +42,7 @@
# anon urls
/user/login=anon
+/user/logout=anon
/user/changeLang=anon
/user/register**=anon
/user/lostPassword**=anon
1
0
r3617 - trunk/pollen-services/src/main/java/org/chorem/pollen/entities/migration
by tchemit@users.chorem.org 19 Aug '12
by tchemit@users.chorem.org 19 Aug '12
19 Aug '12
Author: tchemit
Date: 2012-08-19 13:19:16 +0200 (Sun, 19 Aug 2012)
New Revision: 3617
Url: http://chorem.org/repositories/revision/pollen/3617
Log:
add semi-column in migration query
Modified:
trunk/pollen-services/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4_5.java
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4_5.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4_5.java 2012-08-19 11:18:22 UTC (rev 3616)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/entities/migration/PollenMigrationCallbackV1_4_5.java 2012-08-19 11:19:16 UTC (rev 3617)
@@ -74,7 +74,7 @@
Poll.PROPERTY_POLL_VOTE_VISIBILITY + " = 3 WHERE anonymous = false;");
// remove Poll anonymous
- queries.add("ALTER TABLE poll DROP COLUMN anonymous");
+ queries.add("ALTER TABLE poll DROP COLUMN anonymous;");
}
private void addPollCommentVisibility(List<String> queries) throws TopiaException {
1
0