Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)

59177: Fixes SlowContentStoreTest test breakage. Removes dependency on cachingstore/test-context.xml
   This fix essentially denormalizes the various Spring context XML files in the cachingstore directory. A previous fix had aliased the cachingContentStore to fileContentStore, but unfortunately this broke the SlowContentStoreTest tests, as the cachingContentStore created by those tests is not a real/working content store (the backingStore is a SlowContentStore dummy store), so the bootstrap process failed.
   By making each of the contexts standalone, the different tests are able to evolve as required without breaking the other tests.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-02-12 01:10:13 +00:00
parent bce41b2198
commit 1300d9bd3a
5 changed files with 36 additions and 9 deletions

View File

@@ -28,7 +28,6 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import org.alfresco.repo.content.caching.CacheFileProps; import org.alfresco.repo.content.caching.CacheFileProps;
@@ -39,10 +38,8 @@ import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.GUID; import org.alfresco.util.GUID;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@@ -64,9 +61,8 @@ public class CachedContentCleanupJobTest
@BeforeClass @BeforeClass
public static void beforeClass() public static void beforeClass()
{ {
String conf = "classpath:cachingstore/test-context.xml";
String cleanerConf = "classpath:cachingstore/test-cleaner-context.xml"; String cleanerConf = "classpath:cachingstore/test-cleaner-context.xml";
ctx = ApplicationContextHelper.getApplicationContext(new String[] { conf, cleanerConf }); ctx = ApplicationContextHelper.getApplicationContext(new String[] { cleanerConf });
} }

View File

@@ -50,9 +50,8 @@ public class ConcurrentCachingStoreTest
@Before @Before
public void setUp() public void setUp()
{ {
String conf = "classpath:cachingstore/test-context.xml";
String slowconf = "classpath:cachingstore/test-slow-context.xml"; String slowconf = "classpath:cachingstore/test-slow-context.xml";
ctx = ApplicationContextHelper.getApplicationContext(new String[] { conf, slowconf }); ctx = ApplicationContextHelper.getApplicationContext(new String[] { slowconf });
store = (CachingContentStore) ctx.getBean("cachingContentStore"); store = (CachingContentStore) ctx.getBean("cachingContentStore");
store.setCacheOnInbound(false); store.setCacheOnInbound(false);

View File

@@ -48,9 +48,8 @@ public class SlowContentStoreTest
@BeforeClass @BeforeClass
public static void setUpClass() public static void setUpClass()
{ {
String conf = "classpath:cachingstore/test-context.xml";
String slowconf = "classpath:cachingstore/test-slow-context.xml"; String slowconf = "classpath:cachingstore/test-slow-context.xml";
ctx = (ClassPathXmlApplicationContext) ApplicationContextHelper.getApplicationContext(new String[] { conf, slowconf }); ctx = (ClassPathXmlApplicationContext) ApplicationContextHelper.getApplicationContext(new String[] { slowconf });
} }
@Before @Before

View File

@@ -2,6 +2,20 @@
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans> <beans>
<import resource="classpath:alfresco/application-context.xml" />
<bean id="cachingContentStoreCache" class="org.alfresco.repo.cache.DefaultSimpleCache"/>
<bean id="contentCache" class="org.alfresco.repo.content.caching.ContentCacheImpl">
<property name="memoryStore" ref="cachingContentStoreCache"/>
<property name="cacheRoot" value="${dir.cachedcontent}"/>
</bean>
<bean id="cachingContentStore" class="org.alfresco.repo.content.caching.CachingContentStore">
<property name="backingStore" ref="backingStore"/>
<property name="cache" ref="contentCache"/>
<property name="cacheOnInbound" value="true"/>
</bean>
<!-- Override the backing store bean for the cleaner tests --> <!-- Override the backing store bean for the cleaner tests -->
<bean id="backingStore" class="org.alfresco.repo.content.caching.test.SlowContentStore"> <bean id="backingStore" class="org.alfresco.repo.content.caching.test.SlowContentStore">

View File

@@ -1,7 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?> <?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<!--
NOTE: this file does NOT alias cachingContentStore to fileContentStore, as SlowContentStore is not
a full implementation (so boostrap would fail). Operations using the fileContentStore will work as normal,
tests will use the cachingContentStore and associated beans explicitly, by name when required.
-->
<beans> <beans>
<import resource="classpath:alfresco/application-context.xml" />
<bean id="cachingContentStoreCache" class="org.alfresco.repo.cache.DefaultSimpleCache"/>
<bean id="contentCache" class="org.alfresco.repo.content.caching.ContentCacheImpl">
<property name="memoryStore" ref="cachingContentStoreCache"/>
<property name="cacheRoot" value="${dir.cachedcontent}"/>
</bean>
<bean id="cachingContentStore" class="org.alfresco.repo.content.caching.CachingContentStore">
<property name="backingStore" ref="backingStore"/>
<property name="cache" ref="contentCache"/>
<property name="cacheOnInbound" value="true"/>
</bean>
<bean id="backingStore" class="org.alfresco.repo.content.caching.test.SlowContentStore"/> <bean id="backingStore" class="org.alfresco.repo.content.caching.test.SlowContentStore"/>