Catch null reference in case no vc cache is defined
Change-Id: I6dda338e03e46030f2b6d2741cef73d9e1bbf71d
diff --git a/src/test/java/de/ids_mannheim/korap/collection/TestCollectionCache.java b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionCache.java
new file mode 100644
index 0000000..5591494
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/collection/TestCollectionCache.java
@@ -0,0 +1,24 @@
+package de.ids_mannheim.korap.collection;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+import de.ids_mannheim.korap.KrillCollection;
+import de.ids_mannheim.korap.KrillIndex;
+import de.ids_mannheim.korap.index.FieldDocument;
+
+public class TestCollectionCache {
+
+ @Test
+ public void testNullCache() throws IOException{
+ assertTrue(KrillCollection.cache != null);
+
+ KrillCollection.cache = null;
+ KrillIndex ki = new KrillIndex();
+ ki.addDoc(new FieldDocument());
+ ki.commit();
+ }
+}
diff --git a/src/test/resources/ehcache.xml b/src/test/resources/ehcache.xml
deleted file mode 100644
index b293534..0000000
--- a/src/test/resources/ehcache.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<ehcache xsi:noNamespaceSchemaLocation="http://www.ehcache.org/ehcache.xsd"
- updateCheck="true" monitoring="autodetect" dynamicConfig="true">
-
- <diskStore path="./krill_cache" />
-
- <defaultCache
- maxEntriesLocalHeap="0"
- eternal="false"
- timeToIdleSeconds="1200"
- timeToLiveSeconds="1200">
- </defaultCache>
-
- <cache name="named_vc"
- eternal="true"
- memoryStoreEvictionPolicy="LRU"
- maxElementsInMemory="1"
- maxBytesLocalDisk="1G"
- diskExpiryThreadIntervalSeconds = "120" >
- <persistence strategy="localTempSwap"/>
- </cache>
-
-</ehcache>
\ No newline at end of file
diff --git a/src/test/resources/krill.properties b/src/test/resources/krill.properties
index a6302b6..ea60670 100644
--- a/src/test/resources/krill.properties
+++ b/src/test/resources/krill.properties
@@ -1,4 +1,5 @@
krill.version = ${project.version}
krill.name = ${project.name}
krill.indexDir = test-output
-krill.namedVC = vc
\ No newline at end of file
+krill.namedVC = vc
+krill.index.commit.count = 15
\ No newline at end of file