add files and ensure file contains data

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-components/trunk@1447474 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java b/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java
new file mode 100644
index 0000000..02b21d6
--- /dev/null
+++ b/spring-cache-providers/spring-cache-ehcache/src/test/java/org/apache/archiva/redback/components/cache/ehcache/EhCacheDiskPathTest.java
@@ -0,0 +1,58 @@
+package org.apache.archiva.redback.components.cache.ehcache;
+/*
+ * 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 junit.framework.TestCase;
+import net.sf.ehcache.CacheManager;
+import org.apache.archiva.redback.components.cache.Cache;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.io.File;
+
+/**
+ * @author Olivier Lamy
+ */
+@RunWith( SpringJUnit4ClassRunner.class )
+@ContextConfiguration( locations = { "classpath*:/spring-context-disk.xml" } )
+public class EhCacheDiskPathTest
+    extends TestCase
+{
+    @Inject
+    @Named( value = "cache#test-cache-int-disk" )
+    Cache<String, Integer> cache;
+
+    @Test
+    public void testDisk()
+        throws Exception
+    {
+        for ( int i = 0; i < 1000; i++ )
+        {
+            cache.put( Integer.toString( i ), Integer.valueOf( i ) );
+        }
+        File cacheDiskFile = new File( System.getProperty( "basedir" ), "target/ehcache-test-store-disk-int" );
+        assertTrue( cacheDiskFile.exists() );
+
+        assertTrue( cacheDiskFile.length() > 0 );
+    }
+}
diff --git a/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml b/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml
new file mode 100644
index 0000000..a0ecd2b
--- /dev/null
+++ b/spring-cache-providers/spring-cache-ehcache/src/test/resources/spring-context-disk.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+
+  <bean name="cache#test-cache-int-disk" class="org.apache.archiva.redback.components.cache.ehcache.EhcacheCache">
+    <property name="diskExpiryThreadIntervalSeconds" value="600"/>
+    <property name="diskPersistent" value="true"/>
+    <property name="diskStorePath" value="./target/ehcache-test-store-disk-int"/>
+    <property name="eternal" value="true"/>
+    <!--property name="maxElementsInMemory"  value="1"/-->
+    <property name="memoryEvictionPolicy" value="LRU"/>
+    <property name="name" value="test-cache-int-disk"/>
+    <property name="overflowToDisk" value="true"/>
+    <property name="timeToIdleSeconds" value="6000"/>
+    <property name="timeToLiveSeconds" value="3000"/>
+    <property name="maxElementsOnDisk" value="10000"/>
+    <property name="maxBytesLocalHeap" value="1"/>
+  </bean>
+
+</beans>
\ No newline at end of file