REPO-4329 Configure Custom Renditions (#537)

Break done of changes:
-    Removed rendition definition spring beans and created 0100-baseRenditions.json. Changes are picked up periodically by the running system.
-    Refactored TransformServiceRegistryImpl to extract ConfigFileFinder to reads json from resources, files or directories.
 -   Refactored TransformServiceRegistryImpl to extract ConfigScheduler to periodically reads config data.
 -   Used ConfigFileFinder and ConfigScheduler in RenditionDefinition2Impl to read rendition defs.
 -   Removed the need for a current 'Data' parameter to be passed to register methods when adding transforms or renditions.
 -   Changes in test classes of AbstractRenditionIntegrationTests to force the config to be read once before each test, as tests were sometimes not getting the correct config due to scheduling.
This commit is contained in:
alandavis
2019-08-02 17:46:33 +01:00
committed by GitHub
parent 46c6359181
commit bebd04f49e
21 changed files with 973 additions and 508 deletions

View File

@@ -53,6 +53,7 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.quartz.CronExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ResourceUtils;
@@ -119,6 +120,9 @@ public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest
protected static final String ADMIN = "admin";
protected static final String DOC_LIB = "doclib";
private CronExpression origLocalTransCron;
private CronExpression origRenditionCron;
@BeforeClass
public static void before()
{
@@ -192,16 +196,25 @@ public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest
legacyTransformServiceRegistry.setEnabled(Boolean.parseBoolean(System.getProperty("legacy.transform.service.enabled")));
legacyTransformServiceRegistry.afterPropertiesSet();
origLocalTransCron = localTransformServiceRegistry.getCronExpression();
localTransformServiceRegistry.setCronExpression(null);
localTransformServiceRegistry.setEnabled(Boolean.parseBoolean(System.getProperty("local.transform.service.enabled")));
localTransformServiceRegistry.afterPropertiesSet();
origRenditionCron = renditionDefinitionRegistry2.getCronExpression();
renditionDefinitionRegistry2.setCronExpression(null);
renditionDefinitionRegistry2.setTransformServiceRegistry(transformServiceRegistry);
renditionDefinitionRegistry2.afterPropertiesSet();
thumbnailRegistry.setTransformServiceRegistry(transformServiceRegistry);
}
@After
public void cleanUp()
{
localTransformServiceRegistry.setCronExpression(origLocalTransCron);
renditionDefinitionRegistry2.setCronExpression(origRenditionCron);
AuthenticationUtil.clearCurrentSecurityContext();
}