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 fr...@apache.org on 2016/06/30 11:44:42 UTC
svn commit: r1750775 -
/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java
Author: frm
Date: Thu Jun 30 11:44:42 2016
New Revision: 1750775
URL: http://svn.apache.org/viewvc?rev=1750775&view=rev
Log:
OAK-4525 - Add ignored test to verify the presence of non-root unreferenced node records
Added:
jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java (with props)
Added: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java?rev=1750775&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java (added)
+++ jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java Thu Jun 30 11:44:42 2016
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.segment.file;
+
+import static org.junit.Assert.assertTrue;
+
+import org.apache.jackrabbit.oak.plugins.memory.EmptyNodeState;
+import org.apache.jackrabbit.oak.segment.RecordType;
+import org.apache.jackrabbit.oak.segment.Segment;
+import org.apache.jackrabbit.oak.segment.SegmentNodeState;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+public class NodeRecordTest {
+
+ @Rule
+ public TemporaryFolder root = new TemporaryFolder();
+
+ private FileStore newFileStore() throws Exception {
+ return FileStoreBuilder.fileStoreBuilder(root.getRoot()).build();
+ }
+
+ @Test
+ @Ignore("OAK-4525")
+ public void newNodeRecordShouldBeRoot() throws Exception {
+ try (FileStore store = newFileStore()) {
+ assertTrue(isRootRecord(store.getWriter().writeNode(EmptyNodeState.EMPTY_NODE)));
+ }
+ }
+
+ private boolean isRootRecord(SegmentNodeState sns) {
+ Segment segment = sns.getRecordId().getSegment();
+
+ for (int i = 0; i < segment.getRootCount(); i++) {
+ if (segment.getRootType(i) != RecordType.NODE) {
+ continue;
+ }
+
+ if (segment.getRootOffset(i) != sns.getRecordId().getOffset()) {
+ continue;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+}
Propchange: jackrabbit/oak/trunk/oak-segment-tar/src/test/java/org/apache/jackrabbit/oak/segment/file/NodeRecordTest.java
------------------------------------------------------------------------------
svn:eol-style = native