jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r820927 - in /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data: DataStoreAPITest.java TestAll.java
Date Fri, 02 Oct 2009 08:08:52 GMT
Author: thomasm
Date: Fri Oct  2 08:08:52 2009
New Revision: 820927

URL: http://svn.apache.org/viewvc?rev=820927&view=rev
Log:
JCR-1865 Add the Data Store to the Jackrabbit API

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreAPITest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreAPITest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreAPITest.java?rev=820927&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreAPITest.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/DataStoreAPITest.java
Fri Oct  2 08:08:52 2009
@@ -0,0 +1,77 @@
+/*
+ * 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.core.data;
+
+import java.io.File;
+import java.util.Properties;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.apache.jackrabbit.api.JackrabbitRepositoryFactory;
+import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
+import org.apache.jackrabbit.api.management.RepositoryManager;
+import org.apache.jackrabbit.core.RepositoryFactoryImpl;
+
+/**
+ * Test data store garbage collection as described in the wiki at
+ * http://wiki.apache.org/jackrabbit/DataStore
+ */
+public class DataStoreAPITest extends TestCase {
+
+    private static final String TEST_DIR = "target/repository-datastore-test";
+
+    /**
+     * Test data store garbage collection.
+     */
+    public void testDataStoreGarbageCollection() throws RepositoryException {
+        JackrabbitRepositoryFactory rf = new RepositoryFactoryImpl();
+        Properties prop = new Properties();
+        prop.setProperty("org.apache.jackrabbit.repository.home", TEST_DIR);
+        prop.setProperty("org.apache.jackrabbit.repository.conf", TEST_DIR + "/repository.xml");
+        JackrabbitRepository rep = (JackrabbitRepository) rf.getRepository(prop);
+        RepositoryManager rm = rf.getRepositoryManager(rep);
+
+        // need to login to start the repository
+        Session session = rep.login(new SimpleCredentials("", "".toCharArray()));
+
+        DataStoreGarbageCollector gc = rm.createDataStoreGarbageCollector();
+        try {
+            gc.mark();
+            gc.sweep();
+        } finally {
+            gc.close();
+        }
+
+        session.logout();
+        rm.stop();
+    }
+
+    public void tearDown() {
+        setUp();
+    }
+
+    public void setUp() {
+        FileUtils.deleteQuietly(new File(TEST_DIR));
+    }
+
+}

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java?rev=820927&r1=820926&r2=820927&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestAll.java
Fri Oct  2 08:08:52 2009
@@ -34,6 +34,7 @@
      */
     public static Test suite() {
         TestSuite suite = new ConcurrentTestSuite("Data tests");
+        suite.addTestSuite(DataStoreAPITest.class);
         suite.addTestSuite(LazyFileInputStreamTest.class);
         suite.addTestSuite(OpenFilesTest.class);
         suite.addTestSuite(DataStoreTest.class);



Mime
View raw message