mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
ACS-2498 Add coreVersion to T-Engine config (#526)
The bulk of the changes in this PR are to do with adding a coreVersion element to the transform element in the T-Engine config. For more detail see the class header of CoreVersionDecorator. * Support the use of coreVersion so that it is possible to upgrade pods in any order * Moved the majority of the RequestParamMap static finals to alfresco-transform-model and added a new one: "includeCoreVersion" parameter.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Transform Core
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
@@ -35,6 +35,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -42,6 +43,8 @@ import java.util.Map;
|
||||
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_HTML;
|
||||
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||
import static org.alfresco.transform.client.model.config.CoreVersionDecorator.setOrClearCoreVersion;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.INCLUDE_CORE_VERSION;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.SOURCE_ENCODING;
|
||||
import static org.alfresco.transformer.util.RequestParamMap.TRANSFORM_NAME_PARAMETER;
|
||||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;
|
||||
@@ -88,10 +91,12 @@ public class AIOController extends AbstractTransformerController
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<TransformConfig> info()
|
||||
public ResponseEntity<TransformConfig> info(
|
||||
@RequestParam(value = INCLUDE_CORE_VERSION, required = false) Boolean includeCoreVersion)
|
||||
{
|
||||
logger.info("GET Transform Config.");
|
||||
logger.info("GET Transform Config" + (includeCoreVersion != null && includeCoreVersion ? " including coreVersion" : ""));
|
||||
TransformConfig transformConfig = transformRegistry.getTransformConfig();
|
||||
transformConfig = setOrClearCoreVersion(transformConfig, includeCoreVersion);
|
||||
return new ResponseEntity<>(transformConfig, OK);
|
||||
}
|
||||
|
||||
@@ -105,7 +110,7 @@ public class AIOController extends AbstractTransformerController
|
||||
Transformer transformer = transformRegistry.getByTransformName(transformName);
|
||||
if (transformer == null)
|
||||
{
|
||||
new TransformException(INTERNAL_SERVER_ERROR.value(), "No transformer mapping for - transform:"
|
||||
throw new TransformException(INTERNAL_SERVER_ERROR.value(), "No transformer mapping for - transform:"
|
||||
+ transformName + " sourceMimetype:" + sourceMimetype + " targetMimetype:" + targetMimetype);
|
||||
}
|
||||
|
||||
|
@@ -2,6 +2,7 @@ queue:
|
||||
engineRequestQueue: ${TRANSFORM_ENGINE_REQUEST_QUEUE:org.alfresco.transform.engine.aio.acs}
|
||||
transform:
|
||||
core:
|
||||
version: @project.version@
|
||||
pdfrenderer:
|
||||
exe: ${PDFRENDERER_EXE:/usr/bin/alfresco-pdf-renderer}
|
||||
libreoffice:
|
||||
|
@@ -106,6 +106,14 @@ public class AIOControllerImageMagickTest extends ImageMagickControllerTest
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfoExcludingCoreVersion()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetInfoFromConfigWithDuplicates()
|
||||
|
@@ -88,6 +88,13 @@ public class AIOControllerLibreOfficeTest extends LibreOfficeControllerTest
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfoExcludingCoreVersion()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetInfoFromConfigWithDuplicates()
|
||||
|
@@ -45,15 +45,22 @@ public class AIOControllerMiscTest extends MiscControllerTest
|
||||
// just test that we are actually testing against the AIOController (instead of MiscController)
|
||||
assertTrue(controller instanceof AIOController, "Wrong controller wired for test");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfo()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentality different.
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfoExcludingCoreVersion()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetInfoFromConfigWithDuplicates()
|
||||
|
@@ -84,9 +84,15 @@ public class AIOControllerPdfRendererTest extends AlfrescoPdfRendererControllerT
|
||||
public void testGetTransformConfigInfo()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfoExcludingCoreVersion()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetInfoFromConfigWithDuplicates()
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* #%L
|
||||
* Alfresco Transform Core
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2021 Alfresco Software Limited
|
||||
* Copyright (C) 2005 - 2022 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
@@ -38,7 +38,6 @@ import org.springframework.context.annotation.Import;
|
||||
@Import(AIOCustomConfig.class)
|
||||
public class AIOControllerTest //extends AbstractTransformerControllerTest
|
||||
{
|
||||
|
||||
@Autowired
|
||||
AIOController aioController;
|
||||
|
||||
@@ -64,6 +63,12 @@ public class AIOControllerTest //extends AbstractTransformerControllerTest
|
||||
@Test
|
||||
public void emptyTest()
|
||||
{
|
||||
aioController.info();
|
||||
aioController.info(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyTestWithIncludeCoreVersion()
|
||||
{
|
||||
aioController.info(true);
|
||||
}
|
||||
}
|
@@ -57,6 +57,14 @@ public class AIOControllerTikaTest extends TikaControllerTest
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetTransformConfigInfoExcludingCoreVersion()
|
||||
{
|
||||
// Ignore the test in super class as the way the AIO transformer provides config is fundamentally different.
|
||||
}
|
||||
|
||||
@Test
|
||||
@Override
|
||||
public void testGetInfoFromConfigWithDuplicates()
|
||||
|
Reference in New Issue
Block a user