HXENG-64 refactor ATS

* Pick refactored t-core 3.0.0 and t-service 2.0.0.
* Use new package names from t-model
* Fix up a few test failures due to incomplete t-config which is now checked.
This commit is contained in:
Alan Davis
2022-09-14 22:07:07 +01:00
committed by GitHub
parent bec0ac0236
commit 64955658fc
30 changed files with 126 additions and 108 deletions

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2017 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -50,7 +50,7 @@ import org.junit.runners.Suite;
org.alfresco.repo.event2.RepoEvent2ITSuite.class,
// Requires running transformers
org.alfresco.transform.client.registry.LocalTransformServiceRegistryConfigTest.class,
org.alfresco.transform.registry.LocalTransformServiceRegistryConfigTest.class,
org.alfresco.repo.rendition2.RenditionService2IntegrationTest.class,
org.alfresco.repo.rendition2.LocalTransformServiceRegistryIntegrationTest.class,
org.alfresco.repo.rendition2.LocalTransformClientIntegrationTest.class,

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -58,7 +58,7 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.test_category.BaseSpringTestsCategory;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.registry.TransformServiceRegistry;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.GUID;
import org.junit.After;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -57,7 +57,7 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.registry.TransformServiceRegistry;
import org.alfresco.util.BaseSpringTest;
import org.alfresco.util.GUID;
import org.alfresco.util.PropertyMap;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2018 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -29,8 +29,8 @@ import junit.framework.AssertionFailedError;
import org.alfresco.repo.content.transform.TransformerDebug;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.thumbnail.ThumbnailDefinition;
import org.alfresco.transform.client.registry.AbstractTransformRegistry;
import org.alfresco.transform.client.registry.SupportedTransform;
import org.alfresco.transform.registry.AbstractTransformRegistry;
import org.alfresco.transform.registry.SupportedTransform;
import org.alfresco.util.testing.category.DebugTests;
import org.junit.Before;
import org.junit.Test;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2018 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -25,22 +25,15 @@
*/
package org.alfresco.repo.rendition2;
import org.alfresco.transform.client.registry.AbstractTransformRegistry;
import org.alfresco.transform.client.registry.SupportedTransform;
import org.alfresco.transform.registry.AbstractTransformRegistry;
import org.alfresco.util.testing.category.DebugTests;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import static org.alfresco.repo.content.MimetypeMap.MIMETYPE_TEXT_PLAIN;
/**
* Repeats quick file rendition tests with local transforms enabled but legacy transformers disabled.

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2019 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -26,8 +26,8 @@
package org.alfresco.repo.rendition2;
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
import org.alfresco.transform.client.registry.SupportedTransform;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.registry.SupportedTransform;
import org.alfresco.transform.registry.TransformServiceRegistry;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
@@ -39,8 +39,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IWORK_PAGES;
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_JPEG;
import static org.alfresco.transform.common.Mimetype.MIMETYPE_IWORK_PAGES;
/**
* Integration tests for {@link LocalTransformServiceRegistry}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2020 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -40,7 +40,7 @@ import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.rule.RuleService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.transform.client.registry.TransformServiceRegistryImpl;
import org.alfresco.transform.registry.TransformServiceRegistryImpl;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@@ -25,8 +25,8 @@
*/
package org.alfresco.repo.rendition2;
import org.alfresco.transform.client.model.config.CoreFunction;
import org.alfresco.transform.client.registry.TransformServiceRegistry;
import org.alfresco.transform.config.CoreFunction;
import org.alfresco.transform.registry.TransformServiceRegistry;
import java.util.Map;

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2021 Alfresco Software Limited
* Copyright (C) 2005 - 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -23,7 +23,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.client.registry;
package org.alfresco.transform.registry;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.alfresco.repo.content.MimetypeMap;
@@ -32,12 +32,12 @@ import org.alfresco.repo.content.transform.LocalPipelineTransform;
import org.alfresco.repo.content.transform.LocalTransformImpl;
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
import org.alfresco.repo.content.transform.TransformerDebug;
import org.alfresco.transform.client.model.config.SupportedSourceAndTarget;
import org.alfresco.transform.client.model.config.TransformConfig;
import org.alfresco.transform.client.model.config.TransformOption;
import org.alfresco.transform.client.model.config.TransformOptionGroup;
import org.alfresco.transform.client.model.config.TransformOptionValue;
import org.alfresco.transform.client.model.config.Transformer;
import org.alfresco.transform.config.SupportedSourceAndTarget;
import org.alfresco.transform.config.TransformConfig;
import org.alfresco.transform.config.TransformOption;
import org.alfresco.transform.config.TransformOptionGroup;
import org.alfresco.transform.config.TransformOptionValue;
import org.alfresco.transform.config.Transformer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.Level;
@@ -72,7 +72,7 @@ import static org.junit.Assert.fail;
/**
* Testing LocalTransformServiceRegistry.
*/
public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTest
public class LocalTransformServiceRegistryConfigTest extends TransformRegistryModelTest
{
public static final String HARD_CODED_VALUE = "hard coded value";
@@ -242,19 +242,21 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
protected int getExpectedTransformsForTestJsonPipeline()
{
// imagemagick
// {"sourceMediaType": "image/jpeg", "targetMediaType": "image/jpeg"},
// {"sourceMediaType": "image/jpeg", "targetMediaType": "image/png"},
// {"sourceMediaType": "image/jpeg", "targetMediaType": "image/bmp"}
// {"sourceMediaType": "image/png", "targetMediaType": "image/jpeg"},
// {"sourceMediaType": "image/png", "targetMediaType": "image/gif"},
// {"sourceMediaType": "image/png", "targetMediaType": "image/png"},
// {"sourceMediaType": "image/png", "targetMediaType": "image/tiff"}
// pdfrendere
// {"sourceMediaType": "application/pdf", "targetMediaType": "image/png" }
// libreoffice
// {"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/pdf"}
// {"sourceMediaType": "application/msword", "targetMediaType": "application/pdf" },
// officeToImageViaPdf
// {"sourceMediaType": "application/msword", "targetMediaType": "image/gif" },
// {"sourceMediaType": "application/msword", "targetMediaType": "image/jpeg"},
// {"sourceMediaType": "application/msword", "targetMediaType": "image/png" },
// {"sourceMediaType": "application/msword", "targetMediaType": "image/tiff"}
return 3 + 1 + 1 + 4; // 9
return 4 + 1 + 2 + 4; // 11
}
/**
@@ -391,6 +393,23 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
combinedConfig.register((TransformServiceRegistryImpl)registry);
}
// The super class uses org.junit.jupiter:junit-jupiter-engine:5.8.2
// This cannot be used in the Alfresco repo as other tests in this class fail as they expect junit 4
@Override
protected void assertSupported(String sourceMimetype, long sourceSizeInBytes, String targetMimetype,
Map<String, String> actualOptions, String renditionName, String unsupportedMsg)
{
boolean supported = registry.isSupported(sourceMimetype, sourceSizeInBytes, targetMimetype, actualOptions, renditionName);
if (unsupportedMsg != null && !unsupportedMsg.isEmpty())
{
assertFalse(supported);
}
else
{
assertTrue(supported);
}
}
@Test
public void testJsonConfig() throws IOException
{
@@ -802,7 +821,7 @@ public class LocalTransformServiceRegistryConfigTest extends TransformRegistryTe
public void testPipelineAndFailover()
{
retrieveLocalTransformList("alfresco/local-transform-service-config-pipeline-and-failover-test.json");
registry.assertErrorLogged("Transformer .* cannot have pipeline and failover sections.*pipeline-and-failover.*");
registry.assertErrorLogged("Transformer .* cannot have both pipeline and failover sections.*pipeline-and-failover.*");
}
@Test

View File

@@ -34,9 +34,10 @@
{
"transformerName": "imagemagick",
"supportedSourceAndTargetList": [
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/png"},
{"sourceMediaType": "image/jpeg", "targetMediaType": "image/bmp"}
{"sourceMediaType": "image/png", "targetMediaType": "image/jpeg"},
{"sourceMediaType": "image/png", "targetMediaType": "image/gif"},
{"sourceMediaType": "image/png", "targetMediaType": "image/png"},
{"sourceMediaType": "image/png", "targetMediaType": "image/tiff"}
],
"transformOptions": [
"imageMagickOptions"
@@ -54,6 +55,7 @@
{
"transformerName": "libreoffice",
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/msword", "targetMediaType": "application/pdf" },
{"sourceMediaType": "application/vnd.ms-outlook", "targetMediaType": "application/pdf"}
]
},

View File

@@ -1,16 +1,17 @@
{
"transformers": [
"overrideSupported": [
{
"transformerName": "rubbish",
"transformerPipeline" : [
{"transformerName": "appleIWorks", "targetMediaType": "image/jpeg"},
{"transformerName": "imagemagick"}
],
"supportedSourceAndTargetList": [
{"sourceMediaType": "application/vnd.apple.pages", "maxSourceSizeBytes": 786432, "targetMediaType": "rubbish"}
],
"transformOptions": [
]
"transformerName": "appleIWorks",
"sourceMediaType": "application/vnd.apple.pages",
"targetMediaType": "image/jpeg",
"maxSourceSizeBytes": 786432
}
],
"addSupported": [
{
"transformerName": "imagemagick",
"sourceMediaType": "image/jpeg",
"targetMediaType": "rubbish"
}
]
}