On Jun 10, 2010, at 5:43 PM, tmortagne (SVN) wrote:
> Author: tmortagne
> Date: 2010-06-10 17:43:32 +0200 (Thu, 10 Jun 2010)
> New Revision: 29399
>
> Modified:
>
> platform/core/trunk/xwiki-configuration/xwiki-configuration-default/src/main/java/org/xwiki/configuration/internal/SpacePreferencesConfigurationSource.java
>
> platform/core/trunk/xwiki-configuration/xwiki-configuration-default/src/test/java/org/xwiki/configuration/internal/SpacePreferencesConfigurationSourceTest.java
> Log:
> XWIKI-5264: Cannot get the value of a property stored in the space
> preferences using the configuration module
> Fix important regression: when using a peace of enityreference to create
> another one it should be cloned otherwise it's breaking the initial reference
Thanks for the fix Thomas.
[snip]
> Modified:
> platform/core/trunk/xwiki-configuration/xwiki-configuration-default/src/test/java/org/xwiki/configuration/internal/SpacePreferencesConfigurationSourceTest.java
> ===================================================================
> ---
> platform/core/trunk/xwiki-configuration/xwiki-configuration-default/src/test/java/org/xwiki/configuration/internal/SpacePreferencesConfigurationSourceTest.java
> 2010-06-10 14:14:50 UTC (rev 29398)
> +++
> platform/core/trunk/xwiki-configuration/xwiki-configuration-default/src/test/java/org/xwiki/configuration/internal/SpacePreferencesConfigurationSourceTest.java
> 2010-06-10 15:43:32 UTC (rev 29399)
> @@ -55,15 +55,19 @@
> ConfigurationSource source =
> getComponentManager().lookup(ConfigurationSource.class, "space");
>
> final DocumentReference webPreferencesReference = new
> DocumentReference("wiki", "space", "WebPreferences");
> + final DocumentReference currentDocument = new
> DocumentReference("wiki", "space", "page");
> +
> mockery.checking(new Expectations() {{
> allowing(bridge).getCurrentDocumentReference();
> - will(returnValue(new DocumentReference("wiki", "space",
> "page")));
> + will(returnValue(currentDocument));
> oneOf(bridge).getProperty(webPreferencesReference,
> webPreferencesReference, "key");
> will(returnValue("value"));
> }});
>
> String result = source.getProperty("key", String.class);
> +
> Assert.assertEquals("value", result);
> + Assert.assertEquals(currentDocument.getName(),
> currentDocument.getParent().getChild().getName());
This last line is going to be very hard to remember in the future (ie why we've
written that). IMO it's not the right place for this test. If you want to keep
it at least it needs to be heavily commented (but this indicates IMO that it's
not the right place).
Thanks
-Vincent
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs