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 mr...@apache.org on 2016/01/26 15:09:33 UTC
svn commit: r1726797 -
/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java
Author: mreutegg
Date: Tue Jan 26 14:09:33 2016
New Revision: 1726797
URL: http://svn.apache.org/viewvc?rev=1726797&view=rev
Log:
OAK-3929: RevisionGC does not invalidate document cache
Add ignored test
Added:
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java (with props)
Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java?rev=1726797&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java (added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java Tue Jan 26 14:09:33 2016
@@ -0,0 +1,109 @@
+/*
+ * 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.plugins.document;
+
+import java.io.IOException;
+
+import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
+import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.stats.Clock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import static java.util.concurrent.TimeUnit.HOURS;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * OAK-3929
+ */
+@RunWith(Parameterized.class)
+public class RevisionGCTest {
+
+ private DocumentStoreFixture fixture;
+
+ private Clock clock;
+
+ private DocumentNodeStore store;
+
+ private VersionGarbageCollector gc;
+
+ public RevisionGCTest(DocumentStoreFixture fixture) {
+ this.fixture = fixture;
+ }
+
+ @Parameterized.Parameters(name="{0}")
+ public static java.util.Collection<Object[]> fixtures() throws IOException {
+ return DocumentStoreFixture.getFixtures();
+ }
+
+ @Before
+ public void setUp() throws InterruptedException {
+ clock = new Clock.Virtual();
+ clock.waitUntil(System.currentTimeMillis());
+ Revision.setClock(clock);
+ store = new DocumentMK.Builder()
+ .clock(clock)
+ .setDocumentStore(fixture.createDocumentStore())
+ .setAsyncDelay(0)
+ .getNodeStore();
+ gc = store.getVersionGarbageCollector();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ store.dispose();
+ Revision.resetClockToDefault();
+ }
+
+ @Ignore("OAK-3929")
+ @Test
+ public void recreateRemovedNodeAfterGC() throws Exception {
+ NodeBuilder b = newNodeBuilder();
+ b.child("child");
+ merge(b);
+ b = newNodeBuilder();
+ b.child("child").remove();
+ merge(b);
+ store.runBackgroundOperations();
+
+ // wait two hours
+ clock.waitUntil(clock.getTime() + HOURS.toMillis(2));
+ // clean everything older than one hours
+ gc.gc(1, HOURS);
+
+ b = newNodeBuilder();
+ b.child("child");
+ merge(b);
+
+ assertTrue(store.getRoot().hasChildNode("child"));
+ }
+
+ private NodeBuilder newNodeBuilder() {
+ return store.getRoot().builder();
+ }
+
+ private void merge(NodeBuilder builder)
+ throws Exception {
+ store.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
+ }
+
+}
Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionGCTest.java
------------------------------------------------------------------------------
svn:eol-style = native