On Jan 30, 2009, at 12:37 PM, fmancinelli (SVN) wrote:
> Author: fmancinelli
> Date: 2009-01-30 12:37:35 +0100 (Fri, 30 Jan 2009)
> New Revision: 15898
>
> Modified:
> enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/
> xwiki/xmlrpc/PagesTest.java
> Log:
> [Minor] Fixed a stability bug of the page history test.
>
> The problem was due to the fact that if pages are stored too fast,
> they will have the same timestamp in the modification list (the
> granularity is 1 sec.) and they will be returned in an arbitrary
> order (depending on the server side query result).
>
> This means that the modified page in the test, even if it's present
> in the modification list, could not be returned as the first item of
> that list, causing the assertion to fail.
>
> The solution was to wait 2 seconds before storing the page. This
> will guarantee that the timestamp will surely be different from any
> previous modification (and that the page will be on the top of the
> list if things work well)
>
> Modified: enterprise/trunk/distribution-test/xmlrpc-tests/src/test/
> it/org/xwiki/xmlrpc/PagesTest.java
> ===================================================================
> --- enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/
> xwiki/xmlrpc/PagesTest.java 2009-01-30 10:27:52 UTC (rev 15897)
> +++ enterprise/trunk/distribution-test/xmlrpc-tests/src/test/it/org/
> xwiki/xmlrpc/PagesTest.java 2009-01-30 11:37:35 UTC (rev 15898)
> @@ -663,13 +663,33 @@
>
> TestUtils.banner("TEST:
> getAllModifiedPageHistoryCorrectness()");
>
> + /*
> + * Wait 2 seconds before making the modification. This is
> necessary because if pages are stored in the same
> + * second, they will have the same timestamp and they could
> be returned in an arbitrary order making the
> + * following assert fail randomly
> + */
> + try {
> + Thread.sleep(2000);
> + } catch (InterruptedException e) {
> +
> + }
ouch this is bad... We need to find a better way IMO, like changing
the date and adding 1 second after it's stored or something but not
using timers.
-Vincent
>
> +
> XWikiPage page = this.rpc.getPage(pages.get(0).getId());
>
> + System.out.format("Modifying: %s\n", page);
> +
> page.setContent(String.format("Modified %d",
> System.currentTimeMillis()));
> page = rpc.storePage(page);
>
> - List<XWikiPageHistorySummary> modifications =
> rpc.getModifiedPagesHistory(1, 0);
> + System.out.format("Modified: %s\n", page);
>
> + List<XWikiPageHistorySummary> modifications =
> rpc.getModifiedPagesHistory(3, 0);
> +
> + System.out.format("Modifications:\n");
> + for (XWikiPageHistorySummary modification : modifications) {
> + System.out.format("%s\n", modification);
> + }
> +
> assertEquals(page.getId(),
> modifications.get(0).getBasePageId());
> assertEquals(page.getModified(),
> modifications.get(0).getModified());
> }
Hello devs,
We need a deprecation/compatibility strategy for our javascript APIs, as
we do have one for Java (see
http://lists.xwiki.org/pipermail/devs/2008-February/005067.html and
http://dev.xwiki.org/xwiki/bin/view/Community/DevelopmentPractices#HBackwar…).
I propose we embrace the same idea: keep backward compatibility separate
from actual code, creating a file "compatibility.js". Since it's a
compatibility layer, our releases should work properly without including
this file. We should discuss if we want include it by default or not.
As we are doing with the velocity uberspector, I propose we also log a
warning for every call to a deprecated JS API to help our users update
their code. For this I propose we have a depreciate method in
compatibility.js with the following signature :
function depreciate(scope, method, since, useInstead);
That method would weave the warning log before the actual call to the
method.
A typicall deprecation would then look like this, in compatibility.js :
window.checkAdvancedContent = XWiki.isAdvancedContent // keep compatbility
depreciate(window, checkAdvancedContent, "1.8M2",
"XWiki.isAdvancedContent"); // but log every call to checkAdvancedContent
As for Java APIs, I propose we keep compatibility at least 2 full
releases after the current version is released as final before we allow
ourselves to remove deprecated methods.
As for what should go through this deprecation cycle, I would say
everything that is now in xwiki.js. There are methods we publicly
advertise, for example updateName
(http://www.theserverside.com/tt/articles/article.tss?l=XWiki). For our
other files (usersandgroups.js, ajaxSuggest.js, fullscreenEdit.js, etc.)
I think we can refactor them without going through a deprecation cycle.
In any case, for the future we should be more careful and expose as APIs
only what we plan to support.
My +1 for this strategy
WDYT ?
Jerome
We need a deprecation strategy, i.e. decide for how long we keep
@deprecated methods/classes.
I propose to keep them for 2 full releases after the current version
is released as final.
For example if a method is deprecated in, say Core 1.3M2 then the
method will be removed in 1.6M1. Of course any major new release can
deprecate anything so a XWiki 2.0 is expected to break backward
compatibility.
So for methods deprecated in 1.0 we can remove them in 1.3M1, M2, etc.
WDYT?
If ok then I'll add this to our dev practice guide too.
Note that for this to be easy anyone deprecating methods should add
the information of when it was deprecated. For example:
/**
* @param time the time in milliseconds
* @return the time delta in milliseconds between the current
date and the time passed
* as parameter
* @deprecated replaced by {@link
com.xpn.xwiki.api.Util#getTimeDelta(long)} since 1.3M2
*/
public int XWiki.getTimeDelta(long time)
{
return this.util.getTimeDelta(time);
}
Here's my +1
Thanks
-Vincent
Thomas Mortagne (JIRA) wrote:
> [ http://jira.xwiki.org/jira/browse/XWIKI-2882?page=com.atlassian.jira.plugin… ]
>
> Thomas Mortagne edited comment on XWIKI-2882 at 1/28/09 3:40 PM:
> -----------------------------------------------------------------
>
> * this macro should not depends on radeox, expecially if it's just to use org.radeox.util.Encoder. You should directly generate the List<Block> and not generate a html string and call html macro to do it in RssMacro.renderSearch.
>
> * in RssMacro.renderEntries() you should use ParserUtils.parseInlineNonWiki to parse the description, WordBlock is supposed to contains only one work and not an entire paragraph.
>
> * never use wiki syntax in macros
> -- macro is supposed to not be syntax dependent
> -- a macro is supposed to work on XDOM level
> -- create directly the right block is way faster
> If the problem is that you can't pass List<Block> for the title to BoxMacroParameters, do it another way:
> -- you could define a protected List<Box> getTitle() methods in AbstractBoxMacro like you have getClassProperty() and extend it with a RSSEntryMacro class
> -- you could also add a set/getBlockTitle in BoxMacroParameters based on List<Block> which can be used from java (we could even imagine to be able to use it from wiki syntax with the tight BeanUtil converter)
> -- ...
Regarding the last issue, about whether to use or not wiki syntax for
rendering the title I must say I'm a bit puzzled. I thought that the
point of allowing wiki syntax to be specified in the title for the
boxMacro was right this, to properly render the titles of the rss
entries in the RssMacro.
................................
[15:42:26] Vincent Massol: now re the links I'm not sure yet
[15:42:37] … there are different ways of doing that I guess
[15:43:29] … one idea (brainstorming): we could allow inline wiki syntax
to be used the title parameter maybe
[15:44:14] Dan Miron: yes, it could be a way
[15:44:17] Thomas Mortagne: I like that yes
[15:46:45] Vincent Massol: hmm I wonder if this is something we'd want
for all macros
[15:47:09] … not sure
[15:47:17] Thomas Mortagne: at wors we can add a isTitleWiki
[15:47:19] Vincent Massol: even for this use case I'm stil not fully sure
[15:47:51] … it sounds good but I wonder if we'd get side effects
[15:48:09] … actually we wan't do that in a generic way for all macros
[15:48:20] … since it's not going to generate text
[15:48:25] … but Blocks
[15:48:32] … so the macro needs to handle that
[15:48:50] … s/Wan't/can't/
[15:49:33] … ok I think I'm +1 for making the image and title params
allow inline wiki syntax here for this macro
[15:49:45] … (it's a good experiment, we'll see how it goes)
[15:49:49] … wdyt?
[15:49:53] Thomas Mortagne: +1
[15:50:03] Jean-Vincent Drean: +1
..................................
Anyway, if we need to quit using wiki syntax in the title, i'd prefer
the second choice, "add a set/getBlockTitle in BoxMacroParameters based
on List<Block> which can be used from java". Should I go on with this?
Tnx,
Dan
I've made quite a few improvements to the original TodoApplication, and
was told to send it here for review. First, here's a list of introduced
features:
* extended Todo class
* revamped class sheet/template
* revamped webhome (many improvements)
* ability to add todo's right from side-panel
* ability to show completeness percentage
* more..
The naming was suggested by 'jvelociter' (on irc) due to the fact that
the TodoApplication is used for a tutorial and must be kept simple..
suggestions are welcome, I've tinkered with the todo panel to make it
more compatible with toucan and albatross based skins just before i sent
this to you, so tell me if you have any takes (i.e. if it looks ugly)..
On Jan 28, 2009, at 6:28 AM, sdumitriu (SVN) wrote:
> Author: sdumitriu
> Date: 2009-01-28 06:28:25 +0100 (Wed, 28 Jan 2009)
> New Revision: 15808
>
> Modified:
> platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/
> Document.java
> Log:
> XWIKI-3168: Changing the document syntax without saving the document
> can cause an invalid document state
> Fixed.
>
>
> Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/
> api/Document.java
> ===================================================================
> --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/
> Document.java 2009-01-27 23:34:55 UTC (rev 15807)
> +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/
> Document.java 2009-01-28 05:28:25 UTC (rev 15808)
> @@ -273,6 +273,15 @@
> }
>
> /**
> + * @return the Syntax id representing the syntax used for the
> current document. For example "xwiki/1.0" represents
> + * the first version XWiki syntax while "xwiki/2.0"
> represents version 2.0 of the XWiki Syntax.
> + */
> + public String getSyntaxId()
> + {
> + return this.doc.getSyntaxId();
should this be getDoc().getSyntaxId()?
Should all methods use getDoc() instead of this.doc?
> + }
> +
> + /**
> * return the language of the document if it's a traduction,
> otherwise, it return default
> */
> public String getLanguage()
> @@ -1498,6 +1507,10 @@
> getDoc().setContent(content);
> }
>
> + /**
> + * @param syntaxId the Syntax id representing the syntax used
> for the current document. For example "xwiki/1.0" represents
> + * the first version XWiki syntax while "xwiki/2.0"
> represents version 2.0 of the XWiki Syntax.
> + */
> public void setSyntaxId(String syntaxId)
> {
> getDoc().setSyntaxId(syntaxId);
> @@ -1900,15 +1913,6 @@
> }
>
> /**
> - * @return the Syntax id representing the syntax used for the
> current document. For example "xwiki/1.0" represents
> - * the first version XWiki syntax while "xwiki/2.0"
> represents version 2.0 of the XWiki Syntax.
> - */
> - public String getSyntaxId()
> - {
> - return this.doc.getSyntaxId();
> - }
> -
> - /**
> * Convert the current document content from its current syntax
> to the new syntax passed as parameter.
> *
> * @param targetSyntaxId the syntax to convert to (eg "xwiki/
> 2.0", "xhtml/1.0", etc)
> @@ -1917,7 +1921,7 @@
> public boolean convertSyntax(String targetSyntaxId) throws
> XWikiException
> {
> try {
> - this.doc.convertSyntax(targetSyntaxId);
> + getDoc().convertSyntax(targetSyntaxId);
> } catch (Exception ex) {
> return false;
> }
Thanks
-Vincent
http://xwiki.comhttp://xwiki.orghttp://massol.net
Hi,
I'm about to commit silk icons so that we bundle them with our webapp.
I want to commit them under xwiki-web-standard but we don't have any
standard place where to put this kind of common resources.
We currently have common resources (js and icons) under the root of
our webapp (yui,xwiki.js,etc) and in the albatross skin (most of
them).
Those resources are independant from a particular skin and thus
shouldn't be placed in one of them (at least imho).
I suggest that we move javascript and icon files out of albatross and
that we introduce a new rule: don't put javascript in our skins.
Note that I'm not suggesting to deprecate our baseskin mechanism since
being able to use inheritance between skins is a good thing (it allows
to customize only part of the styles).
Proposal 1
========
Tree:
xwiki/
-- resources/
---- icons/
------ tango/
------ silk/
---- javascript/
------ lib/ (we could minimize files in this folder at build time with rhino)
-------- prototype/
-------- scriptaculous/
-------- yui/
------ xwiki/ (files get from this directory would be parsed since
almost xwiki js files contains velocity calls)
-- skins/
---- toucan/
-- templates/
-- META-INF/
-- WEB-INF/
Getter methods:
Util.getJavascriptResource(String filename)
Util.getIconResource(String filename)
The resources directory would be held by xwiki-web-standard.
Note that this way of getting resources would prevent overloading of
icons and javascript from the skin (unlike xwiki.getSkinFile).
Proposal 2
========
Tree:
xwiki/
-- skins/
---- commons/
------ icons/
-------- tango/
-------- silk/
------ javascript/
-------- lib/ (we could minimize files in this folder at build time with rhino)
---------- prototype/
---------- scriptaculous/
---------- tinymce/
---------- yui/
-------- xwiki/ (files get from this directory would be parsed since
almost xwiki js files contains velocity calls)
---- toucan/
-- templates/
-- META-INF/
-- WEB-INF/
Getter methods:
Modify getSkinFile to look into commons after looking into skin and
baseskin (toucan then albatross in our distrib).
The skins/commons/ directory would be held by xwiki-web-standard.
I'd also like to take advantage of this refactoring to remove some
files from the root of our webapp if we all agree:
- JSTrim*
- freemind (unused)
- s5 (moved out of XE 2 years ago IIRW)
WDYT ?
Thanks,
JV.