Reorder classes in t-engine base [skip ci]

This commit is contained in:
alandavis
2022-08-03 12:20:04 +01:00
parent 5a856a0018
commit 331d9655fa
26 changed files with 48 additions and 66 deletions

View File

@@ -26,7 +26,7 @@
*/
package org.alfresco.transform.aio;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
import org.alfresco.transform.client.model.TransformRequest;
import java.util.UUID;

View File

@@ -28,6 +28,7 @@ package org.alfresco.transform.base;
import org.alfresco.transform.base.logging.LogEntry;
import org.alfresco.transform.base.probes.ProbeTransform;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.common.TransformException;
@@ -98,8 +99,7 @@ public class TransformController
private List<TransformEngine> transformEngines;
@Autowired
private TransformServiceRegistry transformRegistry;
@Autowired
TransformHandler transformHandler;
@Autowired TransformHandler transformHandler;
@Autowired
private String coreVersion;
@@ -204,7 +204,7 @@ public class TransformController
@RequestParam(value = CONFIG_VERSION, defaultValue = CONFIG_VERSION_DEFAULT) int configVersion)
{
logger.info("GET Transform Config version: " + configVersion);
TransformConfig transformConfig = ((TransformRegistryImpl) transformRegistry).getTransformConfig();
TransformConfig transformConfig = ((TransformRegistry) transformRegistry).getTransformConfig();
transformConfig = setOrClearCoreVersion(transformConfig, configVersion);
return new ResponseEntity<>(transformConfig, OK);
}

View File

@@ -39,12 +39,9 @@ import java.util.List;
import static org.alfresco.transform.config.CoreVersionDecorator.setCoreVersionOnSingleStepTransformers;
/**
* Used by clients to work out if a transformation is supported based on the engine_config.json.
*/
public class TransformRegistryImpl extends AbstractTransformRegistry
public class TransformRegistry extends AbstractTransformRegistry
{
private static final Logger log = LoggerFactory.getLogger(TransformRegistryImpl.class);
private static final Logger log = LoggerFactory.getLogger(TransformRegistry.class);
@Autowired(required = false)
private List<TransformEngine> transformEngines;

View File

@@ -26,13 +26,12 @@
*/
package org.alfresco.transform.base.config;
import org.alfresco.transform.base.TransformInterceptor;
import org.alfresco.transform.base.TransformRegistryImpl;
import org.alfresco.transform.base.html.TransformInterceptor;
import org.alfresco.transform.base.TransformRegistry;
import org.alfresco.transform.base.clients.AlfrescoSharedFileStoreClient;
import org.alfresco.transform.common.TransformerDebug;
import org.alfresco.transform.messages.TransformRequestValidator;
import org.alfresco.transform.registry.TransformServiceRegistry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -89,7 +88,7 @@ public class WebApplicationConfig implements WebMvcConfigurer
@Bean
public TransformServiceRegistry transformRegistry()
{
return new TransformRegistryImpl();
return new TransformRegistry();
}
@Bean

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.html;
import static org.alfresco.transform.base.fs.FileManager.SOURCE_FILE;
import static org.alfresco.transform.base.fs.FileManager.TARGET_FILE;

View File

@@ -24,10 +24,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.messaging;
import org.alfresco.transform.base.messaging.TransformMessageConverter;
import org.alfresco.transform.base.messaging.TransformReplySender;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.common.TransformException;
@@ -36,7 +35,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.support.converter.MessageConversionException;
import org.springframework.stereotype.Component;

View File

@@ -26,7 +26,7 @@
*/
package org.alfresco.transform.base.probes;
import org.alfresco.transform.base.TransformHandler;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.base.logging.LogEntry;
import org.alfresco.transform.common.TransformException;
import org.slf4j.Logger;

View File

@@ -24,8 +24,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.base.CustomTransformer;
import org.alfresco.transform.base.TransformEngine;
import org.alfresco.transform.base.clients.AlfrescoSharedFileStoreClient;
import org.alfresco.transform.base.messaging.TransformReplySender;
import org.alfresco.transform.base.model.FileRefResponse;

View File

@@ -24,8 +24,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.base.TransformManager;
import org.alfresco.transform.base.fs.FileManager;
import org.alfresco.transform.base.util.OutputStreamLengthRecorder;
import org.slf4j.Logger;

View File

@@ -24,8 +24,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.base.CustomTransformer;
import org.alfresco.transform.base.TransformController;
import org.alfresco.transform.base.logging.LogEntry;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.common.TransformException;
@@ -36,7 +38,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.jms.Destination;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.OutputStream;
import java.util.Map;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;

View File

@@ -24,7 +24,10 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.base.CustomTransformer;
import org.alfresco.transform.base.TransformManager;
import java.io.IOException;
import java.io.InputStream;

View File

@@ -33,6 +33,7 @@ import org.alfresco.transform.base.executors.RuntimeExec;
import org.alfresco.transform.base.model.FileRefEntity;
import org.alfresco.transform.base.model.FileRefResponse;
import org.alfresco.transform.base.probes.ProbeTransform;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.registry.TransformServiceRegistry;

View File

@@ -39,6 +39,8 @@ import org.alfresco.transform.base.fakes.FakeTransformerPdf2Png;
import org.alfresco.transform.base.fakes.FakeTransformerTxT2Pdf;
import org.alfresco.transform.base.model.FileRefEntity;
import org.alfresco.transform.base.model.FileRefResponse;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.base.transform.TransformHandlerTest;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.config.TransformConfig;
@@ -104,7 +106,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Tests the endpoints of the TransformController. Testing of transforms is limit as in that is covered by
* Tests the endpoints of the TransformController. Testing of transforms is limited as in that is covered by
* {@link TransformHandlerTest}.
*
* Also see {@link TransformControllerAllInOneTest}.

View File

@@ -24,11 +24,12 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.http;
import org.alfresco.transform.base.fakes.FakeTransformEngineWithTwoCustomTransformers;
import org.alfresco.transform.base.fakes.FakeTransformerPdf2Png;
import org.alfresco.transform.base.fakes.FakeTransformerTxT2Pdf;
import org.alfresco.transform.base.transform.TransformHandlerTest;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -51,9 +52,7 @@ import static org.springframework.http.HttpMethod.POST;
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA;
/**
* Very basic requests to the TransformController using http. No longer extended in t-engines as all http interaction
* is now done by the base. Also see {@link TransformControllerTest} and {@link TransformHandlerTest} for more extensive
* tests.
* Very basic requests to the TransformController using http.
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes={org.alfresco.transform.base.Application.class})

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.messaging;
import static org.junit.jupiter.api.Assertions.assertEquals;

View File

@@ -25,10 +25,9 @@
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.messaging;
import org.alfresco.transform.base.messaging.TransformMessageConverter;
import org.alfresco.transform.base.messaging.TransformReplySender;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.apache.activemq.command.ActiveMQObjectMessage;
@@ -38,8 +37,6 @@ import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jms.support.converter.MessageConversionException;
import javax.jms.Destination;
@@ -47,13 +44,11 @@ import javax.jms.JMSException;
import javax.jms.Message;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import static org.springframework.http.HttpStatus.BAD_REQUEST;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR;

View File

@@ -24,7 +24,7 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.metadata;
import static java.text.MessageFormat.format;
import static org.alfresco.transform.base.clients.HttpClient.sendTRequest;

View File

@@ -24,32 +24,15 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.client.model.TransformReply;
import org.alfresco.transform.client.model.TransformRequest;
import org.junit.jupiter.api.Test;
import org.alfresco.transform.base.transform.TransformHandler;
import org.alfresco.transform.base.transform.TransformProcess;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.io.File;
import java.util.Map;
import java.util.UUID;
import static org.alfresco.transform.common.RequestParamMap.DIRECT_ACCESS_URL;
import static org.alfresco.transform.common.RequestParamMap.ENDPOINT_TRANSFORM;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.springframework.http.HttpHeaders.ACCEPT;
import static org.springframework.http.HttpHeaders.CONTENT_TYPE;
import static org.springframework.http.HttpStatus.CREATED;
import static org.springframework.http.HttpStatus.OK;
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Tests {@link TransformHandler} and {@link TransformProcess}.

View File

@@ -24,8 +24,9 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
* #L%
*/
package org.alfresco.transform.base;
package org.alfresco.transform.base.transform;
import org.alfresco.transform.base.CustomTransformer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

View File

@@ -32,7 +32,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_PNG;
import java.util.UUID;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
/**
* @author Lucian Tuca

View File

@@ -31,7 +31,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_OPENXML_WORDPROCES
import java.util.UUID;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
/**
* @author Lucian Tuca

View File

@@ -31,7 +31,7 @@ import static org.alfresco.transform.base.clients.FileInfo.testFile;
import java.util.stream.Stream;
import org.alfresco.transform.base.AbstractMetadataExtractsIT;
import org.alfresco.transform.base.metadata.AbstractMetadataExtractsIT;
import org.alfresco.transform.base.clients.FileInfo;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

View File

@@ -32,7 +32,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
import java.util.UUID;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
public class MiscQueueIT extends AbstractQueueIT
{

View File

@@ -32,7 +32,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_PDF;
import java.util.UUID;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
/**
* @author Lucian Tuca

View File

@@ -74,7 +74,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_IMAGE_RAW_NEF;
import java.util.stream.Stream;
import org.alfresco.transform.base.AbstractMetadataExtractsIT;
import org.alfresco.transform.base.metadata.AbstractMetadataExtractsIT;
import org.alfresco.transform.base.clients.FileInfo;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;

View File

@@ -32,7 +32,7 @@ import static org.alfresco.transform.common.Mimetype.MIMETYPE_TEXT_PLAIN;
import java.util.UUID;
import org.alfresco.transform.client.model.TransformRequest;
import org.alfresco.transform.base.AbstractQueueIT;
import org.alfresco.transform.base.messaging.AbstractQueueIT;
/**
* @author Lucian Tuca