Added test for CacheDirectory for Off heap memory.
Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/c022cd58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/c022cd58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/c022cd58 Branch: refs/heads/master Commit: c022cd587df12c58df4098d638cbfc5dd9833455 Parents: 890be50 Author: Aaron McCurry <[email protected]> Authored: Fri Sep 20 14:13:41 2013 -0400 Committer: Aaron McCurry <[email protected]> Committed: Fri Sep 20 14:13:41 2013 -0400 ---------------------------------------------------------------------- .../blur/store/CacheDirectoryTestSuite.java | 9 ++---- .../store/CacheDirectoryTestSuiteOffHeap.java | 33 ++++++++++++++++++++ .../store/CacheDirectoryTestSuiteOnHeap.java | 33 ++++++++++++++++++++ 3 files changed, 69 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c022cd58/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java ---------------------------------------------------------------------- diff --git a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java index c2baa1e..2085bd0 100644 --- a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java +++ b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuite.java @@ -28,9 +28,8 @@ import org.apache.blur.store.blockcache_v2.FileNameFilter; import org.apache.blur.store.buffer.BufferStore; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; -import org.junit.Test; -public class CacheDirectoryTestSuite extends BaseDirectoryTestSuite { +public abstract class CacheDirectoryTestSuite extends BaseDirectoryTestSuite { @Override protected void setupDirectory() throws IOException { @@ -58,15 +57,13 @@ public class CacheDirectoryTestSuite extends BaseDirectoryTestSuite { }; Cache cache = new BaseCache(totalNumberOfBytes, fileBufferSize, fileNameBlockSize, readFilter, writeFilter, - STORE.ON_HEAP); + getStore()); Directory dir = FSDirectory.open(new File(file, "cache")); BufferStore.init(128, 128); directory = new CacheDirectory("test", wrapLastModified(dir), cache); } - @Test - public void runsTheTests() { - } + protected abstract STORE getStore(); } http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c022cd58/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOffHeap.java ---------------------------------------------------------------------- diff --git a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOffHeap.java b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOffHeap.java new file mode 100644 index 0000000..6456765 --- /dev/null +++ b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOffHeap.java @@ -0,0 +1,33 @@ +package org.apache.blur.store; + +/** + * 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. + */ +import org.apache.blur.store.blockcache_v2.BaseCache.STORE; +import org.junit.Test; + +public class CacheDirectoryTestSuiteOffHeap extends CacheDirectoryTestSuite { + + @Test + public void runsTheTests() { + } + + @Override + protected STORE getStore() { + return STORE.OFF_HEAP; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/c022cd58/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOnHeap.java ---------------------------------------------------------------------- diff --git a/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOnHeap.java b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOnHeap.java new file mode 100644 index 0000000..7130fa8 --- /dev/null +++ b/blur-store/src/test/java/org/apache/blur/store/CacheDirectoryTestSuiteOnHeap.java @@ -0,0 +1,33 @@ +package org.apache.blur.store; + +/** + * 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. + */ +import org.apache.blur.store.blockcache_v2.BaseCache.STORE; +import org.junit.Test; + +public class CacheDirectoryTestSuiteOnHeap extends CacheDirectoryTestSuite { + + @Override + protected STORE getStore() { + return STORE.ON_HEAP; + } + + @Test + public void runsTheTests() { + } + +}
