Author: rhauch
Date: 2009-04-15 08:31:49 -0400 (Wed, 15 Apr 2009)
New Revision: 824
Modified:
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrBuiltinNodeTypeSource.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TypeRegistrationTest.java
Log:
DNA-352 Version Tests in SerializationTest Fail Due to TCK Bug
Applied the patch that removes the version-related built-in node types, modifies the
canAddMixin(...) method, modifies test that had coincidental dependency on one of the
version built-in types. This change was needed because of what appears to be incorrect
behavior in the TCK unit tests. For more details, see DNA-352.
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2009-04-14 20:06:32
UTC (rev 823)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/AbstractJcrNode.java 2009-04-15 12:31:49
UTC (rev 824)
@@ -615,6 +615,17 @@
CheckArg.isNotNull(mixinName, "mixinName");
CheckArg.isNotZeroLength(mixinName, "mixinName");
+ /*
+ * Special workaround for SeralizationTest (and others) in JR TCK that
incorrectly test whether a repository supports
+ * versioning by trying to add mix:versionable to a node. The 1.0.1 says in
section 4.11 that:
+ * "A node is versionable if and only if it has been assigned the mixin type
mix:versionable,
+ * otherwise it is nonversionable. Repositories that do not support versioning
will simply not
+ * provide this mixin type, whereas repositories that do support versioning must
provide it."
+ */
+ if (JcrMixLexicon.VERSIONABLE.getString(namespaces()).equals(mixinName)) {
+ return false;
+ }
+
JcrNodeType mixinCandidateType = cache.nodeTypes().getNodeType(mixinName);
if (this.isLocked()) {
@@ -1354,7 +1365,7 @@
* @throws UnsupportedRepositoryOperationException always
* @see javax.jcr.Node#checkout()
*/
- public final void checkout() throws UnsupportedRepositoryOperationException {
+ public final void checkout() throws UnsupportedRepositoryOperationException {
throw new UnsupportedRepositoryOperationException();
}
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrBuiltinNodeTypeSource.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrBuiltinNodeTypeSource.java 2009-04-14
20:06:32 UTC (rev 823)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrBuiltinNodeTypeSource.java 2009-04-15
12:31:49 UTC (rev 824)
@@ -31,8 +31,6 @@
import javax.jcr.Value;
import net.jcip.annotations.Immutable;
import org.jboss.dna.graph.ExecutionContext;
-import org.jboss.dna.graph.property.Name;
-import org.jboss.dna.graph.property.basic.BasicName;
/**
* {@link JcrNodeTypeSource} that provides built-in node types per the 1.0
specification.
@@ -56,7 +54,7 @@
/*
* These values get created without a session cache, as they aren't tied to
any particular session.
*/
- Value trueValue = new JcrValue(context.getValueFactories(), null,
PropertyType.BOOLEAN, Boolean.TRUE);
+ // Value trueValue = new JcrValue(context.getValueFactories(), null,
PropertyType.BOOLEAN, Boolean.TRUE);
Value ntBaseValue = new JcrValue(context.getValueFactories(), null,
PropertyType.NAME, JcrNtLexicon.BASE);
// Stubbing in child node and property definitions for now
@@ -458,118 +456,119 @@
PropertyType.UNDEFINED, NO_CONSTRAINTS, true),}),
NOT_MIXIN, ORDERABLE_CHILD_NODES);
- JcrNodeType version = new JcrNodeType(
- context,
- NO_NODE_TYPE_MANAGER,
- JcrNtLexicon.VERSION,
- Arrays.asList(new JcrNodeType[] {base,
referenceable}),
- NO_PRIMARY_ITEM_NAME,
- Arrays.asList(new JcrNodeDefinition[] {new
JcrNodeDefinition(
-
context,
-
null,
-
JcrLexicon.FROZEN_NODE,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
-
false,
-
false,
-
true,
-
false,
-
null,
-
new JcrNodeType[] {frozenNode}),}),
- Arrays.asList(new JcrPropertyDefinition[]
{
- new JcrPropertyDefinition(context,
null, JcrLexicon.CREATED,
-
OnParentVersionBehavior.ABORT.getJcrValue(), true,
- true, true,
NO_DEFAULT_VALUES, PropertyType.DATE,
-
NO_CONSTRAINTS, false),
- new JcrPropertyDefinition(context,
null, JcrLexicon.PREDECESSORS,
-
OnParentVersionBehavior.ABORT.getJcrValue(), false,
- false, true,
NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, true),
- new JcrPropertyDefinition(context,
null, JcrLexicon.SUCCESSORS,
-
OnParentVersionBehavior.ABORT.getJcrValue(), false,
- false, true,
NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, true),}),
- NOT_MIXIN, UNORDERABLE_CHILD_NODES);
+ // JcrNodeType version = new JcrNodeType(
+ // context,
+ // NO_NODE_TYPE_MANAGER,
+ // JcrNtLexicon.VERSION,
+ // Arrays.asList(new JcrNodeType[] {base, referenceable}),
+ // NO_PRIMARY_ITEM_NAME,
+ // Arrays.asList(new JcrNodeDefinition[] {new JcrNodeDefinition(
+ // context,
+ // null,
+ // JcrLexicon.FROZEN_NODE,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // false,
+ // false,
+ // true,
+ // false,
+ // null,
+ // new JcrNodeType[] {frozenNode}),}),
+ // Arrays.asList(new JcrPropertyDefinition[] {
+ // new JcrPropertyDefinition(context, null, JcrLexicon.CREATED,
+ // OnParentVersionBehavior.ABORT.getJcrValue(), true,
+ // true, true, NO_DEFAULT_VALUES, PropertyType.DATE,
+ // NO_CONSTRAINTS, false),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.PREDECESSORS,
+ // OnParentVersionBehavior.ABORT.getJcrValue(), false,
+ // false, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, true),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.SUCCESSORS,
+ // OnParentVersionBehavior.ABORT.getJcrValue(), false,
+ // false, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, true),}),
+ // NOT_MIXIN, UNORDERABLE_CHILD_NODES);
+ //
+ // JcrNodeType versionLabels = new JcrNodeType(
+ // context,
+ // NO_NODE_TYPE_MANAGER,
+ // JcrNtLexicon.VERSION_LABELS,
+ // Arrays.asList(new JcrNodeType[] {base}),
+ // NO_PRIMARY_ITEM_NAME,
+ // NO_CHILD_NODES,
+ // Arrays.asList(new JcrPropertyDefinition[] {new JcrPropertyDefinition(
+ // context,
+ // null,
+ // ALL_NODES,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // false,
+ // false,
+ // true,
+ // NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE,
+ // NO_CONSTRAINTS,
+ // false),}),
+ // NOT_MIXIN, UNORDERABLE_CHILD_NODES);
+ //
+ // JcrNodeType versionHistory = new JcrNodeType(
+ // context,
+ // NO_NODE_TYPE_MANAGER,
+ // JcrNtLexicon.VERSION_HISTORY,
+ // Arrays.asList(new JcrNodeType[] {base, referenceable}),
+ // NO_PRIMARY_ITEM_NAME,
+ // Arrays.asList(new JcrNodeDefinition[] {
+ // new JcrNodeDefinition(context, null, JcrLexicon.ROOT_VERSION,
+ // OnParentVersionBehavior.ABORT.getJcrValue(), true,
+ // true, true, false, JcrNtLexicon.VERSION,
+ // new JcrNodeType[] {version}),
+ // new JcrNodeDefinition(context, null, JcrLexicon.VERSION_LABELS,
+ // OnParentVersionBehavior.ABORT.getJcrValue(), true,
+ // true, true, false, JcrNtLexicon.VERSION_LABELS,
+ // new JcrNodeType[] {versionLabels}),
+ // new JcrNodeDefinition(context, null, ALL_NODES,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // false, false, true, false, JcrNtLexicon.VERSION,
+ // new JcrNodeType[] {version}),}),
+ // Arrays.asList(new JcrPropertyDefinition[] {new JcrPropertyDefinition(
+ // context,
+ // null,
+ // JcrLexicon.VERSIONABLE_UUID,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // true,
+ // true,
+ // true,
+ // NO_DEFAULT_VALUES,
+ // PropertyType.STRING,
+ // NO_CONSTRAINTS,
+ // false),}),
+ // NOT_MIXIN, UNORDERABLE_CHILD_NODES);
+ //
+ // Name CHILD_VERSION_HISTORY = new BasicName(JcrLexicon.Namespace.URI,
"childVersionHistory");
+ // JcrNodeType versionedChild = new JcrNodeType(
+ // context,
+ // NO_NODE_TYPE_MANAGER,
+ // JcrNtLexicon.VERSIONED_CHILD,
+ // Arrays.asList(new JcrNodeType[] {base}),
+ // NO_PRIMARY_ITEM_NAME,
+ // NO_CHILD_NODES,
+ // Arrays.asList(new JcrPropertyDefinition[] {new JcrPropertyDefinition(
+ // context,
+ // null,
+ // CHILD_VERSION_HISTORY,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // true,
+ // true,
+ // true,
+ // NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE,
+ // NO_CONSTRAINTS,
+ // false),}),
+ // NOT_MIXIN, UNORDERABLE_CHILD_NODES);
- JcrNodeType versionLabels = new JcrNodeType(
- context,
- NO_NODE_TYPE_MANAGER,
- JcrNtLexicon.VERSION_LABELS,
- Arrays.asList(new JcrNodeType[]
{base}),
- NO_PRIMARY_ITEM_NAME,
- NO_CHILD_NODES,
- Arrays.asList(new
JcrPropertyDefinition[] {new JcrPropertyDefinition(
-
context,
-
null,
-
ALL_NODES,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
-
false,
-
false,
-
true,
-
NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE,
-
NO_CONSTRAINTS,
-
false),}),
- NOT_MIXIN, UNORDERABLE_CHILD_NODES);
+ // Disabling version-related types until DNA supports versioning, as per section
4.11 of the 1.0.1 specification
+ nodeTypes.addAll(Arrays.asList(new JcrNodeType[] {base, unstructured,
childNodeDefinition, file, folder, frozenNode,
+ hierarchyNode, linkedFile, nodeType, propertyDefinition, query, resource,
nodeType /*, version, versionHistory,
+ versionLabels, versionedChild */}));
- JcrNodeType versionHistory = new JcrNodeType(
- context,
- NO_NODE_TYPE_MANAGER,
- JcrNtLexicon.VERSION_HISTORY,
- Arrays.asList(new JcrNodeType[]
{base, referenceable}),
- NO_PRIMARY_ITEM_NAME,
- Arrays.asList(new
JcrNodeDefinition[] {
- new JcrNodeDefinition(context,
null, JcrLexicon.ROOT_VERSION,
-
OnParentVersionBehavior.ABORT.getJcrValue(), true,
- true,
true, false, JcrNtLexicon.VERSION,
- new
JcrNodeType[] {version}),
- new JcrNodeDefinition(context,
null, JcrLexicon.VERSION_LABELS,
-
OnParentVersionBehavior.ABORT.getJcrValue(), true,
- true,
true, false, JcrNtLexicon.VERSION_LABELS,
- new
JcrNodeType[] {versionLabels}),
- new JcrNodeDefinition(context,
null, ALL_NODES,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
- false,
false, true, false, JcrNtLexicon.VERSION,
- new
JcrNodeType[] {version}),}),
- Arrays.asList(new
JcrPropertyDefinition[] {new JcrPropertyDefinition(
-
context,
-
null,
-
JcrLexicon.VERSIONABLE_UUID,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
-
true,
-
true,
-
true,
-
NO_DEFAULT_VALUES,
-
PropertyType.STRING,
-
NO_CONSTRAINTS,
-
false),}),
- NOT_MIXIN,
UNORDERABLE_CHILD_NODES);
-
- Name CHILD_VERSION_HISTORY = new BasicName(JcrLexicon.Namespace.URI,
"childVersionHistory");
- JcrNodeType versionedChild = new JcrNodeType(
- context,
- NO_NODE_TYPE_MANAGER,
- JcrNtLexicon.VERSIONED_CHILD,
- Arrays.asList(new JcrNodeType[]
{base}),
- NO_PRIMARY_ITEM_NAME,
- NO_CHILD_NODES,
- Arrays.asList(new
JcrPropertyDefinition[] {new JcrPropertyDefinition(
-
context,
-
null,
-
CHILD_VERSION_HISTORY,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
-
true,
-
true,
-
true,
-
NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE,
-
NO_CONSTRAINTS,
-
false),}),
- NOT_MIXIN,
UNORDERABLE_CHILD_NODES);
-
- nodeTypes.addAll(Arrays.asList(new JcrNodeType[] {base, unstructured,
childNodeDefinition, file, folder,
- frozenNode, hierarchyNode, linkedFile, nodeType, propertyDefinition, query,
resource, nodeType, version,
- versionHistory, versionLabels, versionedChild}));
-
JcrNodeType lockable = new JcrNodeType(context, NO_NODE_TYPE_MANAGER,
JcrMixLexicon.LOCKABLE, NO_SUPERTYPES,
NO_PRIMARY_ITEM_NAME, NO_CHILD_NODES,
Arrays.asList(new JcrPropertyDefinition[] {
new JcrPropertyDefinition(context,
null, JcrLexicon.LOCK_IS_DEEP,
@@ -582,37 +581,38 @@
NO_CONSTRAINTS, false)}), IS_A_MIXIN,
UNORDERABLE_CHILD_NODES);
- JcrNodeType versionable = new JcrNodeType(
- context,
- NO_NODE_TYPE_MANAGER,
- JcrMixLexicon.VERSIONABLE,
- Arrays.asList(new JcrNodeType[]
{referenceable}),
- NO_PRIMARY_ITEM_NAME,
- NO_CHILD_NODES,
- Arrays.asList(new
JcrPropertyDefinition[] {
- new JcrPropertyDefinition(context,
null, JcrLexicon.BASE_VERSION,
-
OnParentVersionBehavior.IGNORE.getJcrValue(),
- false,
true, true, NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, false),
- new JcrPropertyDefinition(context,
null, JcrLexicon.IS_CHECKED_OUT,
-
OnParentVersionBehavior.IGNORE.getJcrValue(),
- true,
true, true, new Value[] {trueValue},
-
PropertyType.BOOLEAN, NO_CONSTRAINTS, false),
- new JcrPropertyDefinition(context,
null, JcrLexicon.MERGE_FAILED,
-
OnParentVersionBehavior.ABORT.getJcrValue(),
- false,
false, true, NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, true),
- new JcrPropertyDefinition(context,
null, JcrLexicon.PREDECESSORS,
-
OnParentVersionBehavior.COPY.getJcrValue(),
- false,
true, true, NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, true),
- new JcrPropertyDefinition(context,
null, JcrLexicon.VERSION_HISTORY,
-
OnParentVersionBehavior.COPY.getJcrValue(),
- false,
true, true, NO_DEFAULT_VALUES,
-
PropertyType.REFERENCE, NO_CONSTRAINTS, false),}),
- IS_A_MIXIN, UNORDERABLE_CHILD_NODES);
+ // JcrNodeType versionable = new JcrNodeType(
+ // context,
+ // NO_NODE_TYPE_MANAGER,
+ // JcrMixLexicon.VERSIONABLE,
+ // Arrays.asList(new JcrNodeType[] {referenceable}),
+ // NO_PRIMARY_ITEM_NAME,
+ // NO_CHILD_NODES,
+ // Arrays.asList(new JcrPropertyDefinition[] {
+ // new JcrPropertyDefinition(context, null, JcrLexicon.BASE_VERSION,
+ // OnParentVersionBehavior.IGNORE.getJcrValue(),
+ // false, true, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, false),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.IS_CHECKED_OUT,
+ // OnParentVersionBehavior.IGNORE.getJcrValue(),
+ // true, true, true, new Value[] {trueValue},
+ // PropertyType.BOOLEAN, NO_CONSTRAINTS, false),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.MERGE_FAILED,
+ // OnParentVersionBehavior.ABORT.getJcrValue(),
+ // false, false, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, true),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.PREDECESSORS,
+ // OnParentVersionBehavior.COPY.getJcrValue(),
+ // false, true, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, true),
+ // new JcrPropertyDefinition(context, null, JcrLexicon.VERSION_HISTORY,
+ // OnParentVersionBehavior.COPY.getJcrValue(),
+ // false, true, true, NO_DEFAULT_VALUES,
+ // PropertyType.REFERENCE, NO_CONSTRAINTS, false),}),
+ // IS_A_MIXIN, UNORDERABLE_CHILD_NODES);
- nodeTypes.addAll(Arrays.asList(new JcrNodeType[] {lockable, referenceable,
versionable}));
+ // Removing lockable as per section 4.11 of the JCR 1.0.1 specification
+ nodeTypes.addAll(Arrays.asList(new JcrNodeType[] {lockable, referenceable /*,
versionable */}));
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TypeRegistrationTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TypeRegistrationTest.java 2009-04-14
20:06:32 UTC (rev 823)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/TypeRegistrationTest.java 2009-04-15
12:31:49 UTC (rev 824)
@@ -55,7 +55,6 @@
private JcrNodeType referenceable;
private JcrNodeType unstructured;
private JcrNodeType root;
- private JcrNodeType versionHistory;
private JcrNodeType hierarchyNode;
private JcrNodeType file;
@@ -74,7 +73,6 @@
referenceable = repoTypeManager.getNodeType(JcrMixLexicon.REFERENCEABLE);
unstructured = repoTypeManager.getNodeType(JcrNtLexicon.UNSTRUCTURED);
root = repoTypeManager.getNodeType(DnaLexicon.ROOT);
- versionHistory = repoTypeManager.getNodeType(JcrNtLexicon.VERSION_HISTORY);
hierarchyNode = repoTypeManager.getNodeType(JcrNtLexicon.HIERARCHY_NODE);
file = repoTypeManager.getNodeType(JcrNtLexicon.FILE);
}
@@ -548,12 +546,12 @@
context,
AbstractJcrNodeTypeSource.NO_NODE_TYPE_MANAGER,
nameFor(TEST_TYPE_NAME),
- Arrays.asList(new JcrNodeType[] {versionHistory}),
+ Arrays.asList(new JcrNodeType[] {file}),
AbstractJcrNodeTypeSource.NO_PRIMARY_ITEM_NAME,
Arrays.asList(new JcrNodeDefinition[] {new
JcrNodeDefinition(
context,
null,
-
JcrLexicon.ROOT_VERSION,
+
JcrLexicon.CONTENT,
OnParentVersionBehavior.VERSION.getJcrValue(),
false, false, false, false,
JcrNtLexicon.BASE,