jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: occasional TCK test failure
Date Sat, 05 May 2012 13:28:25 GMT


On 5.5.12 11:34, Julian Reschke wrote:
> Hi there,
>
> occasionally I get a test failure because the TCK discovers a node that
> lacks a primary type.
>
> As far as I recall, it's either /jcr:system or
> /jcr:system/jcr:namespaces (of course right now it doesn't occur).
>
> With the change below I tried to make sure the type is set, but maybe
> I'm doing something wrong?
>
> if (create) {
> system = tree.addChild("jcr:system");
> + system.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> } else {

This looks good to me. There are two things we should do further down 
the line however: 1. don't set nt:unstructured but treat it as implied 
and 2. have some utility for operating on Tree instances which encodes 
the content model. 2. frees us of setting primary type and related 
things all over again and also keeps the content model encapsulated 
which make it easier to adapt later on.

Michael

>
> Help appreciated, Julian
>
>
> -------- Original Message --------
> Subject: svn commit: r1334034 -
> /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
> Date: Fri, 04 May 2012 15:32:21 -0000
> From: reschke@apache.org
> Reply-To: oak-commits@jackrabbit.apache.org
> To: oak-commits@jackrabbit.apache.org
>
> Author: reschke
> Date: Fri May 4 15:32:20 2012
> New Revision: 1334034
>
> URL: http://svn.apache.org/viewvc?rev=1334034&view=rev
> Log:
> try to set node types on jcr:system and jcr:system/jcr:namespaces properly
>
> Modified:
>
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
>
> Modified:
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
>
> URL:
> http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java?rev=1334034&r1=1334033&r2=1334034&view=diff
>
> ==============================================================================
>
> ---
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
> (original)
> +++
> jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/name/NamespaceMappings.java
> Fri May 4 15:32:20 2012
> @@ -198,6 +198,7 @@ public class NamespaceMappings {
> if (system == null) {
> if (create) {
> system = tree.addChild("jcr:system");
> + system.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> } else {
> return null;
> }
> @@ -205,7 +206,7 @@ public class NamespaceMappings {
> Tree namespaces = system.getChild("jcr:namespaces");
> if (namespaces == null && create) {
> namespaces = system.addChild("jcr:namespaces");
> - namespaces.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("rep:system",
> PropertyType.NAME));
> + namespaces.setProperty("jcr:primaryType",
> this.session.getCoreValueFactory().createValue("nt:unstructured",
> PropertyType.NAME));
> }
> return namespaces;
> }
>
>
>


Mime
View raw message