Hello XWiki devs,
I've been playing a bit to adapt the xwiki lucene plugin, actually the
curriki lucene plugin which is very similar, to the tastes of Intergeo.
One thing that surprised me is that most of the fields in the lucene
plugin are stored fields. This sounds like a big overkill when you
think that all the values of the fields of a document are loaded when
you have this document as match.
Not surprisingly, the curriki search result was almost only using
fullname, using lucene directly is somewhat faster, I think it's good
practice.
Could this be configurable? (i.e. the names of the fields that are
stored)
One powerful way to make it configurable would to migrate to solr
which bases on lucene but uses a schema that describes well type of
the fields.
Three other pluggeabilities I would wish:
- the search-result class really would wish to be subclassable, the
configuration could define a search-result-factory or something such
which would help (a lot) as a cursor exploiting the hits list
- I deem it very important to also have query expansion but maybe that
can be inside the rest of the application
- what is indexed how should also be subclasses (a pluggeable factory
for ObjectData?)
Finally, I wanted to use different analyzers per language, using the
Snowball family of analyzers so that stemming really does happen.
I kind of have it now but I would like to test it in unit tests and,
well... how can I do that?
Is there a way to get a "unit-test xwiki environment" (context, xwiki)
where my unit tests would create a few documents then query them?
Is there active work on this plugin?
Which patch is most interesting for the others?
paul
Hi Devs,
I have committed the initial xwiki-refactoring module which has support for
splitting a document into multiple documents.
The design of the DocumentSplitter component is somewhat like
http://i39.tinypic.com/28k24w4.png (there are few minor changes).
Anyway, we need to think of a proper desgin for the Refactoring module that
will allow us to extend this module in future. I can see two approaches for
this desgin:
1. We implement each refactoring operation as a single component - like
currently it is done with DocumentSplitter. But this might not be a good
idea because the refactoring module itself will not provide a well-defined
API to users (it will be scattered into multiple component interfaces).
2. We define a single Refactoring plexus component interface that will
include all the currently suppported refactoring operations (like a facade)
- this way we have a high-level refactoring interface that can be easliy
understood and used by users.
I think the 2 approach is more usable than the first one.
WDYT? may be there is a third approach?
Thanks.
- Asiri
Hi devs,
Most of you already know Guillaume Lerouge since he's been active on
these lists. Guillaume is interested and willing to act as our first
OSS Product Manager. This is not a role that exists in many OSS
projects. Actually I've never encountered it before but I can see
value in it and I think we should recognize this role in the same
manner that we recognize the role of Committer.
See some rationale here:
http://www.productbeautiful.com/2008/05/02/why-product-management-is-open-s…
So I see Guillaume's role as:
* Monitoring the lists for users requests/needs
* Talking to people who implement XWiki out there in the wild, in
companies and see what their needs are
* Monitoring the enterprise wiki landscape for new features we should
have
* Comparing XWiki with other wiki engines out there
Guillaume should provide us devs with visibility on the most wanted
features and help us prepare our roadmaps.
Regarding votes I propose that we has the same binding votes as
Committers (obviously since Guillaume is not technical he probably
won't vote on tech matters). Example of domain where he could vote on:
UI decisions.
This is what Guillaume has already started doing for some time but
we've never really voted him in this role so I propose to fix this now
and make this role official.
Here's my +1
Thanks
-Vincent
PS: This doesn't mean that any of us shouldn't do this too. Quite the
opposite. It just means that Guillaume is willing to spend a lot of
his time working on this.
PPS: Disclaimer: Guillaume is working for XWiki SAS. For more details
on the XWiki project and XWiki SAS see
http://massol.myxwiki.org/xwiki/bin/view/Blog/XWikiSASAndOpenSource
Hi devs,
I have completed implementing office importer document splitting
functionality and I would like to commit this code in trunk. However the
functionality of splitting a xwiki document into many sub documents does not
belong to the officeimporter module. Rather it belongs to the more generic
topic of refactoring existing wiki documents.
There for, I propose to introduce a new core module: xwiki-core-refactoring
and include the document splitting code into this module rather than having
splitting code within the officeimporter code base. This will allow us to
extend the refactoring module in future to include following possibilities:
- Split an exiting document into multiple documents (first refactoring)
- Merge documents to form a single document
- Rename documents
- Rename attachments
- Replace words
- More...
Here's my +1 for introducing the xwiki-core-refactoring module and comitting
document splitting code in it.
Thanks.
- Asiri
Hi,
Now that we have a DocumentName and factory/serializer I'd like to
propose that we change all document access bridge APIs to use
DocumentName instead of String. The idea is that string way of
referencing a document should be used only at boundaries of the xwiki
system and internally we should ony use DocumentName. The reasons are
multiple:
* less errors since it's a strongly typed api
* whenever code manipulates DocumentName it can be sure it contains
valid and non null data and thus doesn't need to recheck again
Here's my +1
Thanks
-Vincent
HI,
my xwiki did not evaluate any of the snippets or groovy/velocity class that i wrote
until now not even a helloworld script he just ignore them and display the code as a simple text
the wiki syntax is 1.0
what is going wrong there??
help me with this one please thanks
--
View this message in context: http://n2.nabble.com/Problems-with-scripting-tp2580143p2580143.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
Hi developers,
I would like to refactor
String getURL(String documentName, String action, String queryString, String
anchor)
in the DocumentAccessBridge (whose documentName is actually used as a document
fullName) to
String getURL(DocumentName documentName, String action, String queryString,
String anchor)
and implement multiwiki support for it, since now it uses XWiki.getURL() which
uses current context wiki to generate the URL.
The calls to current function would be transformed in:
DocumentNameFactory docNameFactory = ...
getURL(docNameFactory.createDocumentName(fullName), ...)
which will have the same result as before.
Since we will need to change all internal reference to documents in
DocumentNames instead of fullNames as Strings, this would be a step in this
direction, facilitated by the new DocumentNameSerializer and DocumentNameFactory.
Here's my +1
WDYT?
Thanks,
Anca Luca
Hi,
Can anyone give me a part of code using XWikiXmlRpcClient in java to get
and put a XWikiPage wich is a XWikiClass (like page XWiki.XWikiSkins page).
I get Class information using :
XWikiClass xwikiClass = curClient.getClass(this.fullName);
SystemOut(xwikiClass.toMap().toString()) ;
But My problem is to put this information because I could only call the
following method wich have no information about Class:
curClient.storePage(xwikiPage);
Thanks,
Julien
Shouldn't we have only one component which do the
serialize/unserialize to make sure the same rule is applied in the two
way ? It seems weird to me to be able to change the way to parse a
document reference and let the document reference creation to another
implementation.
On Fri, Apr 3, 2009 at 22:48, vmassol <platform-notifications(a)xwiki.org> wrote:
> Author: vmassol
> Date: 2009-04-03 22:48:34 +0200 (Fri, 03 Apr 2009)
> New Revision: 18236
>
> Added:
> Â platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameFactory.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameSerializer.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameFactory.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializer.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameFactoryTest.java
> Â platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializerTest.java
> Modified:
> Â platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/resources/META-INF/plexus/components.xml
> Log:
> XWIKI-3501: Add Document Name factory and serializer
>
> Merged from trunk (rev 18235)
>
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameFactory.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameFactory.java              (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameFactory.java  2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,41 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.bridge;
> +
> +/**
> + * Generate a Document Name from a raw string reference.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public interface DocumentNameFactory
> +{
> + Â Â /**
> + Â Â * Role for looking up implementing components.
> + Â Â */
> + Â Â String ROLE = DocumentNameFactory.class.getName();
> +
> + Â Â /**
> + Â Â * @param reference the document's name as a string using a textual format (eg {@code wiki:space.page}).
> + Â Â * Â Â Â Â The supported format is up to implementers of this method.
> + Â Â * @return the object representing a document reference
> + Â Â */
> + Â Â DocumentName createDocumentName(String reference);
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameSerializer.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameSerializer.java                (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-bridge/src/main/java/org/xwiki/bridge/DocumentNameSerializer.java    2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,41 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.bridge;
> +
> +/**
> + * Generate a fully qualified document reference string (ie of the form
> + * {@code wiki:space.page}) out of a {@link DocumentName}.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public interface DocumentNameSerializer
> +{
> + Â Â /**
> + Â Â * Role for looking up implementing components.
> + Â Â */
> + Â Â String ROLE = DocumentNameSerializer.class.getName();
> +
> + Â Â /**
> + Â Â * @param documentName the document name to serialize
> + Â Â * @return the fully qualified document reference string (ie of the form {@code wiki:space.page})
> + Â Â */
> + Â Â String serialize(DocumentName documentName);
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameFactory.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameFactory.java               (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameFactory.java   2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,163 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.doc;
> +
> +import org.apache.commons.lang.StringUtils;
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.bridge.DocumentNameFactory;
> +import org.xwiki.context.Execution;
> +
> +import com.xpn.xwiki.XWikiContext;
> +
> +/**
> + * Generate a Document Name from a raw string reference.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public class DefaultDocumentNameFactory implements DocumentNameFactory
> +{
> + Â Â /**
> + Â Â * Default space to use when the user has not specified any space and there's no current space set in the context.
> + Â Â */
> + Â Â private static final String DEFAULT_SPACE = "XWiki";
> +
> + Â Â /**
> + Â Â * Default page name when the user has not specified the page name.
> + Â Â */
> + Â Â private static final String DEFAULT_PAGE = "WebHome";
> +
> + Â Â /**
> + Â Â * Default wiki to use when the user has not specified any wiki and there's no current wiki set in the context.
> + Â Â */
> + Â Â private static final String DEFAULT_WIKI = "xwiki";
> +
> + Â Â private static final String WIKI_SEPARATOR = ":";
> +
> + Â Â private static final String SPACE_SEPARATOR = ".";
> +
> + Â Â /**
> + Â Â * Execution context handler, needed for accessing the XWikiContext.
> + Â Â */
> + Â Â private Execution execution;
> +
> + Â Â public DocumentName createDocumentName(String reference)
> + Â Â {
> + Â Â Â Â String wiki;
> + Â Â Â Â String space;
> + Â Â Â Â String page;
> +
> + Â Â Â Â if (StringUtils.isBlank(reference)) {
> + Â Â Â Â Â Â wiki = getDefaultWikiName();
> + Â Â Â Â Â Â space = getDefaultSpaceName();
> + Â Â Â Â Â Â page = DEFAULT_PAGE;
> + Â Â Â Â } else {
> +
> + Â Â Â Â Â Â // Step 1: Extract the wiki name
> +
> + Â Â Â Â Â Â // We allow the wiki separator in wiki names and thus we look for the last wiki sep in the reference.
> + Â Â Â Â Â Â // TODO: Note that this was done to have the same behavior of XWikiDocument.setFullName() but it would
> + Â Â Â Â Â Â // Â Â Â seem better to me to allow the wiki sep in space names rather than in wiki names (since wiki
> + Â Â Â Â Â Â // Â Â Â names are constrained by database schema names).
> + Â Â Â Â Â Â int spaceSeparatorPosition;
> + Â Â Â Â Â Â int wikiSeparatorPosition = reference.lastIndexOf(WIKI_SEPARATOR);
> + Â Â Â Â Â Â if (wikiSeparatorPosition != -1) {
> + Â Â Â Â Â Â Â Â wiki = reference.substring(0, wikiSeparatorPosition);
> + Â Â Â Â Â Â Â Â if (wiki.length() == 0) {
> + Â Â Â Â Â Â Â Â Â Â wiki = getDefaultWikiName();
> + Â Â Â Â Â Â Â Â }
> +
> + Â Â Â Â Â Â Â Â spaceSeparatorPosition = reference.indexOf(SPACE_SEPARATOR, wikiSeparatorPosition);
> + Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â // No wiki separator, use default wiki.
> + Â Â Â Â Â Â Â Â wiki = getDefaultWikiName();
> +
> + Â Â Â Â Â Â Â Â // We allow space sep in space names and thus we look for the last space sep in the reference.
> + Â Â Â Â Â Â Â Â // TODO: Note that this was done to have the same behavior of XWikiDocument.setFullName() but it would
> + Â Â Â Â Â Â Â Â // Â Â Â seem better to me to allow space sep in pages names rather than in space names (since users
> + Â Â Â Â Â Â Â Â // Â Â Â want more liberty in page names and usually create pages in existing spaces).
> + Â Â Â Â Â Â Â Â spaceSeparatorPosition = reference.lastIndexOf(SPACE_SEPARATOR);
> + Â Â Â Â Â Â }
> +
> + Â Â Â Â Â Â // Step 2: Extract the space and page names
> +
> + Â Â Â Â Â Â if (spaceSeparatorPosition != -1) {
> + Â Â Â Â Â Â Â Â space = reference.substring(wikiSeparatorPosition + WIKI_SEPARATOR.length(),
> + Â Â Â Â Â Â Â Â Â Â spaceSeparatorPosition);
> + Â Â Â Â Â Â Â Â if (space.length() == 0) {
> + Â Â Â Â Â Â Â Â Â Â space = getDefaultSpaceName();
> + Â Â Â Â Â Â Â Â }
> +
> + Â Â Â Â Â Â Â Â // Make sure the space separator is not the last char of the reference
> + Â Â Â Â Â Â Â Â if (spaceSeparatorPosition + SPACE_SEPARATOR.length() < reference.length()) {
> + Â Â Â Â Â Â Â Â Â Â page = reference.substring(spaceSeparatorPosition + SPACE_SEPARATOR.length());
> + Â Â Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â Â Â page = DEFAULT_PAGE;
> + Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â // No space separator the whole substring is thus the page.
> + Â Â Â Â Â Â Â Â space = getDefaultSpaceName();
> +
> + Â Â Â Â Â Â Â Â // Make sure the wiki separator is not the last char of the reference
> + Â Â Â Â Â Â Â Â if (wikiSeparatorPosition == -1
> + Â Â Â Â Â Â Â Â Â Â || wikiSeparatorPosition + WIKI_SEPARATOR.length() < reference.length())
> + Â Â Â Â Â Â Â Â {
> + Â Â Â Â Â Â Â Â Â Â page = reference.substring(wikiSeparatorPosition + WIKI_SEPARATOR.length());
> + Â Â Â Â Â Â Â Â } else {
> + Â Â Â Â Â Â Â Â Â Â page = DEFAULT_PAGE;
> + Â Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â }
> + Â Â Â Â }
> +
> + Â Â Â Â return new DocumentName(wiki, space, page);
> + Â Â }
> +
> + Â Â private String getDefaultWikiName()
> + Â Â {
> + Â Â Â Â String wiki = getContext().getDatabase();
> + Â Â Â Â if (wiki == null) {
> + Â Â Â Â Â Â wiki = DEFAULT_WIKI;
> + Â Â Â Â }
> + Â Â Â Â return wiki;
> + Â Â }
> +
> + Â Â private String getDefaultSpaceName()
> + Â Â {
> + Â Â Â Â String space;
> + Â Â Â Â XWikiDocument currentDocument = getContext().getDoc();
> + Â Â Â Â if (currentDocument == null) {
> + Â Â Â Â Â Â space = DEFAULT_SPACE;
> + Â Â Â Â } else {
> + Â Â Â Â Â Â space = currentDocument.getSpace();
> + Â Â Â Â Â Â if (space == null) {
> + Â Â Â Â Â Â Â Â space = DEFAULT_SPACE;
> + Â Â Â Â Â Â }
> + Â Â Â Â }
> + Â Â Â Â return space;
> + Â Â }
> +
> + Â Â /**
> + Â Â * @return the XWiki Context used to bridge with the old API
> + Â Â */
> + Â Â private XWikiContext getContext()
> + Â Â {
> + Â Â Â Â return (XWikiContext) this.execution.getContext().getProperty("xwikicontext");
> + Â Â }
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializer.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializer.java             (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializer.java 2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,51 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.doc;
> +
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.bridge.DocumentNameSerializer;
> +
> +/**
> + * Generate a fully qualified document reference string (ie of the form
> + * {@code <wiki>:<space>.<page>} out of a {@link DocumentName}.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public class DefaultDocumentNameSerializer implements DocumentNameSerializer
> +{
> + Â Â /**
> + Â Â * {@inheritDoc}
> + Â Â * @see DocumentNameSerializer#serialize(DocumentName)
> + Â Â */
> + Â Â public String serialize(DocumentName documentName)
> + Â Â {
> + Â Â Â Â // A valid DocumentName must not have any null value and thus we don't need to check for nulls here.
> + Â Â Â Â // It's the responsibility of creators of DocumentName factories to ensure it's valid.
> + Â Â Â Â StringBuffer result = new StringBuffer();
> + Â Â Â Â result.append(documentName.getWiki());
> + Â Â Â Â result.append(':');
> + Â Â Â Â result.append(documentName.getSpace());
> + Â Â Â Â result.append('.');
> + Â Â Â Â result.append(documentName.getPage());
> +
> + Â Â Â Â return result.toString();
> + Â Â }
> +}
>
> Modified: platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/resources/META-INF/plexus/components.xml
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/resources/META-INF/plexus/components.xml  2009-04-03 20:46:01 UTC (rev 18235)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/resources/META-INF/plexus/components.xml  2009-04-03 20:48:34 UTC (rev 18236)
> @@ -51,7 +51,6 @@
> Â Â Â <role-hint>default</role-hint>
> Â Â Â <implementation>com.xpn.xwiki.doc.DefaultDocumentAccessBridge</implementation>
> Â Â Â <instantiation-strategy>singleton</instantiation-strategy>
> - Â Â Â <lifecycle-handler>xwiki</lifecycle-handler>
> Â Â Â <requirements>
> Â Â Â Â <requirement>
> Â Â Â Â Â <role>org.xwiki.context.Execution</role>
> @@ -59,11 +58,27 @@
> Â Â Â </requirements>
> Â Â </component>
> Â Â <component>
> + Â Â Â <role>org.xwiki.bridge.DocumentNameFactory</role>
> + Â Â Â <role-hint>default</role-hint>
> + Â Â Â <implementation>com.xpn.xwiki.doc.DefaultDocumentNameFactory</implementation>
> + Â Â Â <instantiation-strategy>singleton</instantiation-strategy>
> + Â Â Â <requirements>
> + Â Â Â Â <requirement>
> + Â Â Â Â Â <role>org.xwiki.context.Execution</role>
> + Â Â Â Â </requirement>
> + Â Â Â </requirements>
> + Â Â </component>
> + Â Â <component>
> + Â Â Â <role>org.xwiki.bridge.DocumentNameSerializer</role>
> + Â Â Â <role-hint>default</role-hint>
> + Â Â Â <implementation>com.xpn.xwiki.doc.DefaultDocumentNameSerializer</implementation>
> + Â Â Â <instantiation-strategy>singleton</instantiation-strategy>
> + Â Â </component>
> + Â Â <component>
> Â Â Â <role>org.xwiki.bridge.SkinAccessBridge</role>
> Â Â Â <role-hint>default</role-hint>
> Â Â Â <implementation>com.xpn.xwiki.DefaultSkinAccessBridge</implementation>
> Â Â Â <instantiation-strategy>singleton</instantiation-strategy>
> - Â Â Â <lifecycle-handler>xwiki</lifecycle-handler>
> Â Â Â <requirements>
> Â Â Â Â <requirement>
> Â Â Â Â Â <role>org.xwiki.context.Execution</role>
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameFactoryTest.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameFactoryTest.java                 (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameFactoryTest.java     2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,119 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.doc;
> +
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.bridge.DocumentNameFactory;
> +
> +import com.xpn.xwiki.test.AbstractBridgedXWikiComponentTestCase;
> +
> +/**
> + * Unit tests for {@link DocumentNameFactory}.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public class DefaultDocumentNameFactoryTest extends AbstractBridgedXWikiComponentTestCase
> +{
> + Â Â private DocumentNameFactory factory;
> +
> + Â Â protected void setUp() throws Exception
> + Â Â {
> + Â Â Â Â super.setUp();
> + Â Â Â Â this.factory = (DocumentNameFactory) getComponentManager().lookup(DocumentNameFactory.ROLE);
> + Â Â }
> +
> + Â Â public void testCreateDocumentNameWhenCurrentDocSet() throws Exception
> + Â Â {
> + Â Â Â Â getContext().setDatabase("testwiki");
> + Â Â Â Â XWikiDocument document = new XWikiDocument();
> + Â Â Â Â document.setSpace("testspace");
> + Â Â Â Â getContext().setDoc(document);
> + Â Â Â Â verify("testwiki", "testspace");
> + Â Â }
> +
> + Â Â public void testCreateDocumentNameWhenNoCurrentDoc() throws Exception
> + Â Â {
> + Â Â Â Â verify("xwiki", "XWiki");
> + Â Â }
> +
> + Â Â private void verify(String expectedDefaultWiki, String expectedDefaultSpace)
> + Â Â {
> + Â Â Â Â DocumentName name = factory.createDocumentName("wiki:space.page");
> + Â Â Â Â assertEquals("wiki", name.getWiki());
> + Â Â Â Â assertEquals("space", name.getSpace());
> + Â Â Â Â assertEquals("page", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("wiki1:wiki2:page");
> + Â Â Â Â assertEquals("wiki1:wiki2", name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("page", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("wiki:");
> + Â Â Â Â assertEquals("wiki", name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("wiki1.wiki2:page");
> + Â Â Â Â assertEquals("wiki1.wiki2", name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("page", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("wiki:page");
> + Â Â Â Â assertEquals("wiki", name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("page", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("wiki:space.");
> + Â Â Â Â assertEquals("wiki", name.getWiki());
> + Â Â Â Â assertEquals("space", name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("space.");
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals("space", name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("page");
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("page", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName(".");
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName(":");
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName(null);
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> +
> + Â Â Â Â name = factory.createDocumentName("");
> + Â Â Â Â assertEquals(expectedDefaultWiki, name.getWiki());
> + Â Â Â Â assertEquals(expectedDefaultSpace, name.getSpace());
> + Â Â Â Â assertEquals("WebHome", name.getPage());
> + Â Â }
> +}
>
> Added: platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializerTest.java
> ===================================================================
> --- platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializerTest.java               (rev 0)
> +++ platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/DefaultDocumentNameSerializerTest.java   2009-04-03 20:48:34 UTC (rev 18236)
> @@ -0,0 +1,41 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package com.xpn.xwiki.doc;
> +
> +import org.xwiki.bridge.DocumentName;
> +import org.xwiki.bridge.DocumentNameSerializer;
> +import org.xwiki.test.AbstractXWikiComponentTestCase;
> +
> +/**
> + * Unit tests for {@link DocumentNameSerializer}.
> + *
> + * @version $Id: $
> + * @since 1.8.1
> + */
> +public class DefaultDocumentNameSerializerTest extends AbstractXWikiComponentTestCase
> +{
> + Â Â public void testSerialize() throws Exception
> + Â Â {
> + Â Â Â Â DocumentNameSerializer serializer =
> + Â Â Â Â Â Â (DocumentNameSerializer) getComponentManager().lookup(DocumentNameSerializer.ROLE);
> + Â Â Â Â DocumentName name = new DocumentName("wiki", "space", "page");
> + Â Â Â Â assertEquals("wiki:space.page", serializer.serialize(name));
> + Â Â }
> +}
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
--
Thomas Mortagne