REPO-4791 If possible, use Local transforms where Legacy transforms are called.

The objective of this PR is to replace all the ContentService calls related to transforms with calls to the SynchronousTransformClient that switches between Local and Legacy transforms. This will allow us to remove the Legacy transforms at some point and also take advantage of the T-Engines which can be scaled.

- Introduced a ContentTransformService interface to hold all the ContentService calls related to transforms and an implementation class ContentTransformServiceAdaptor as a super class of ContentServiceImpl. The Adaptor provides code to allow the SynchronousTransformClient to be called. As a result any external custom code that uses these methods will be able to take advantage of Local or Legacy transforms.
- The transform code originally in ContentServiceImpl has been moved to ContentTransformServiceImpl, which is a super class of the LegacySynchronousTransformClient.
- All calls in the repository have been replaced with calls to SynchronousTransformClient. There are still a few calls to these methods in ContentServiceImplTest and ArchiveContentTransformerTest that have not been changes as they test Legacy transform code.
- The asynchronous LocalTransformClient now uses the SynchronousTransformClient.
- Bug fix to the TransformationOptionsConverter as it was found that the page number being used for images was wrong. Legacy transformers start at page 1, where as Local and ImageMagick itself start at 0.
- Added a conversion to the new transform option (Map<String,String) in TransformationOptionsConverter, as some of the ContentTransformServiceAdaptor methods need to wrap a Local transformer in a Legacy transformer, so that it may be returned.
- A number of existing tests were passing because the wrong exception was being thrown. When the Local  transformer was used this became more obvious as the tests would fail.
- To avoid other test failing the Local Transform registry is loaded on start up rather than waiting for it to be scheduled, as a few milliseconds needed to read the config was till too large for the test to run and fail. A similar approach had been taken before with tests.
This commit is contained in:
alandavis
2019-11-29 22:13:43 +00:00
committed by GitHub
parent da62a5de31
commit 2af1a96211
66 changed files with 1734 additions and 1388 deletions

View File

@@ -115,6 +115,9 @@ public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest
@Autowired
protected LegacyTransformServiceRegistry legacyTransformServiceRegistry;
@Autowired
protected TransformationOptionsConverter converter;
static String PASSWORD = "password";
protected static final String ADMIN = "admin";
@@ -207,6 +210,8 @@ public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest
renditionDefinitionRegistry2.afterPropertiesSet();
thumbnailRegistry.setTransformServiceRegistry(transformServiceRegistry);
thumbnailRegistry.setLocalTransformServiceRegistry(localTransformServiceRegistry);
thumbnailRegistry.setConverter(converter);
}
@After