jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dpfis...@apache.org
Subject svn commit: r1328403 - in /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store: ./ DefaultRevisionStoreTest.java
Date Fri, 20 Apr 2012 15:21:14 GMT
Author: dpfister
Date: Fri Apr 20 15:21:14 2012
New Revision: 1328403

URL: http://svn.apache.org/viewvc?rev=1328403&view=rev
Log:
GC for revisions
- add first smoke test

Added:
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
  (with props)

Added: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java?rev=1328403&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
(added)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
Fri Apr 20 15:21:14 2012
@@ -0,0 +1,72 @@
+/*
+ * 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.mk.store;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.blobs.MemoryBlobStore;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.mk.core.Repository;
+import org.apache.jackrabbit.mk.persistence.InMemPersistence;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests verifying the inner workings of <code>DefaultRevisionStore</code>.
+ */
+public class DefaultRevisionStoreTest {
+
+    private DefaultRevisionStore rs;
+    private MicroKernel mk;
+    
+    @Before
+    public void setup() throws Exception {
+        rs = new DefaultRevisionStore(new InMemPersistence()) {
+            @Override
+            protected void doMark() throws Exception {
+                markCommit(getHeadCommit());
+            }
+        };
+        rs.initialize();
+        mk = new MicroKernelImpl(new Repository(rs, new MemoryBlobStore()));
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (mk != null) {
+            mk.dispose();
+        }
+    }
+    
+    @Test
+    public void testGC() {
+        mk.commit("/", "+\"a\" : { \"c\":{}, \"d\":{} }", mk.getHeadRevision(), null);
+        mk.commit("/", "+\"b\" : {}", mk.getHeadRevision(), null);
+        mk.commit("/b", "+\"e\" : {}", mk.getHeadRevision(), null);
+        mk.commit("/a/c", "+\"f\" : {}", mk.getHeadRevision(), null);
+        
+        String headRevision = mk.getHeadRevision();
+        String contents = mk.getNodes("/", headRevision);
+        
+        rs.gc();
+        
+        assertEquals(headRevision, mk.getHeadRevision());
+        assertEquals(contents, mk.getNodes("/", headRevision));
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url



Mime
View raw message