You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2014/06/25 20:02:19 UTC
svn commit: r1605526 - in /jackrabbit/oak/trunk/oak-core/src:
main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Author: jukka
Date: Wed Jun 25 18:02:19 2014
New Revision: 1605526
URL: http://svn.apache.org/r1605526
Log:
OAK-1916: NodeStoreKernel doesn't handle array properties correctly
Adjust SegmentNodeState to work correctly with non-name type properties
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java?rev=1605526&r1=1605525&r2=1605526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeState.java Wed Jun 25 18:02:19 2014
@@ -116,10 +116,14 @@ public class SegmentNodeState extends Re
public PropertyState getProperty(String name) {
checkNotNull(name);
Template template = getTemplate();
+ PropertyState property = null;
if (JCR_PRIMARYTYPE.equals(name)) {
- return template.getPrimaryType();
+ property = template.getPrimaryType();
} else if (JCR_MIXINTYPES.equals(name)) {
- return template.getMixinTypes();
+ property = template.getMixinTypes();
+ }
+ if (property != null) {
+ return property;
}
PropertyTemplate propertyTemplate =
Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java?rev=1605526&r1=1605525&r2=1605526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/segment/RecordTest.java Wed Jun 25 18:02:19 2014
@@ -17,8 +17,12 @@
package org.apache.jackrabbit.oak.plugins.segment;
import static com.google.common.collect.Lists.newArrayList;
+import static java.util.Collections.singletonList;
+import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.fail;
import static org.apache.jackrabbit.oak.api.Type.BINARIES;
+import static org.apache.jackrabbit.oak.api.Type.STRING;
+import static org.apache.jackrabbit.oak.api.Type.STRINGS;
import static org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState.EMPTY_NODE;
import static org.apache.jackrabbit.oak.plugins.segment.ListRecord.LEVEL_SIZE;
import static org.junit.Assert.assertEquals;
@@ -354,4 +358,20 @@ public class RecordTest {
}
}
+ @Test
+ public void testStringPrimaryType() {
+ NodeBuilder builder = EMPTY_NODE.builder();
+ builder.setProperty("jcr:primaryType", "foo", STRING);
+ NodeState state = writer.writeNode(builder.getNodeState());
+ assertNotNull(state.getProperty("jcr:primaryType"));
+ }
+
+ @Test
+ public void testStringMixinTypes() {
+ NodeBuilder builder = EMPTY_NODE.builder();
+ builder.setProperty("jcr:mixinTypes", singletonList("foo"), STRINGS);
+ NodeState state = writer.writeNode(builder.getNodeState());
+ assertNotNull(state.getProperty("jcr:mixinTypes"));
+ }
+
}