mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-05-19 17:14:47 +00:00
Merge branch 'ATS-238' into 'master'
ATS-238 See merge request Repository/alfresco-docker-transformers!42
This commit is contained in:
commit
295a1e3e93
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Enterprise Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lucian Tuca
|
||||||
|
* created on 15/01/2019
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class AlfrescoPdfRendererQueueTransformServiceTest extends AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected TransformRequest buildRequest()
|
||||||
|
{
|
||||||
|
return TransformRequest.builder()
|
||||||
|
.withRequestId(UUID.randomUUID().toString())
|
||||||
|
.withSourceMediaType(MIMETYPE_OPENXML_WORDPROCESSING)
|
||||||
|
.withTargetMediaType(MIMETYPE_PDF)
|
||||||
|
.withTargetExtension("pdf")
|
||||||
|
.withSchema(1)
|
||||||
|
.withClientData("ACS")
|
||||||
|
.withSourceReference(UUID.randomUUID().toString())
|
||||||
|
.withSourceSize(32L).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Enterprise Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_JPEG;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_IMAGE_PNG;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lucian Tuca
|
||||||
|
* created on 15/01/2019
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class ImageMagickQueueTransformServiceTest extends AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected TransformRequest buildRequest()
|
||||||
|
{
|
||||||
|
return TransformRequest.builder()
|
||||||
|
.withRequestId(UUID.randomUUID().toString())
|
||||||
|
.withSourceMediaType(MIMETYPE_IMAGE_PNG)
|
||||||
|
.withTargetMediaType(MIMETYPE_IMAGE_JPEG)
|
||||||
|
.withTargetExtension("jpeg")
|
||||||
|
.withSchema(1)
|
||||||
|
.withClientData("ACS")
|
||||||
|
.withSourceReference(UUID.randomUUID().toString())
|
||||||
|
.withSourceSize(32L).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Enterprise Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lucian Tuca
|
||||||
|
* created on 15/01/2019
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class LibreOfficeQueueTransformServiceTest extends AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected TransformRequest buildRequest()
|
||||||
|
{
|
||||||
|
return TransformRequest.builder()
|
||||||
|
.withRequestId(UUID.randomUUID().toString())
|
||||||
|
.withSourceMediaType(MIMETYPE_OPENXML_WORDPROCESSING)
|
||||||
|
.withTargetMediaType(MIMETYPE_OPENXML_WORDPROCESSING)
|
||||||
|
.withTargetExtension("doc")
|
||||||
|
.withSchema(1)
|
||||||
|
.withClientData("ACS")
|
||||||
|
.withSourceReference(UUID.randomUUID().toString())
|
||||||
|
.withSourceSize(32L).build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Enterprise Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_TEXT_PLAIN;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lucian Tuca
|
||||||
|
* created on 15/01/2019
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
|
public class TikaQueueTransformServiceTest extends AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected TransformRequest buildRequest()
|
||||||
|
{
|
||||||
|
return TransformRequest.builder()
|
||||||
|
.withRequestId(UUID.randomUUID().toString())
|
||||||
|
.withSourceMediaType(MIMETYPE_OPENXML_WORDPROCESSING)
|
||||||
|
.withTargetMediaType(MIMETYPE_TEXT_PLAIN)
|
||||||
|
.withTargetExtension("txt")
|
||||||
|
.withSchema(1)
|
||||||
|
.withClientData("ACS")
|
||||||
|
.withSourceReference(UUID.randomUUID().toString())
|
||||||
|
.withSourceSize(32L).build();
|
||||||
|
}
|
||||||
|
}
|
@ -74,6 +74,22 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.activemq.tooling</groupId>
|
||||||
|
<artifactId>maven-activemq-plugin</artifactId>
|
||||||
|
<version>5.7.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<configuration>
|
||||||
|
<fork>true</fork>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>process-test-classes</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package org.alfresco.transformer.messaging;
|
package org.alfresco.transformer.messaging;
|
||||||
|
|
||||||
import javax.jms.ConnectionFactory;
|
import javax.jms.ConnectionFactory;
|
||||||
|
import javax.jms.Queue;
|
||||||
|
|
||||||
import org.alfresco.transform.client.model.TransformRequestValidator;
|
import org.alfresco.transform.client.model.TransformRequestValidator;
|
||||||
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.jms.annotation.JmsListenerConfigurer;
|
import org.springframework.jms.annotation.JmsListenerConfigurer;
|
||||||
@ -61,6 +64,12 @@ public class MessagingConfig implements JmsListenerConfigurer
|
|||||||
transactionManager.setConnectionFactory(connectionFactory);
|
transactionManager.setConnectionFactory(connectionFactory);
|
||||||
return transactionManager;
|
return transactionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue engineRequestQueue(@Value("${queue.engineRequestQueue}") String engineRequestQueueValue)
|
||||||
|
{
|
||||||
|
return new ActiveMQQueue(engineRequestQueueValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Enterprise Repository
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* License rights for this program may be obtained from Alfresco Software, Ltd.
|
||||||
|
* pursuant to a written agreement and any use of this program without such an
|
||||||
|
* agreement is prohibited.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.transformer;
|
||||||
|
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_OPENXML_WORDPROCESSING;
|
||||||
|
import static org.alfresco.transform.client.model.Mimetype.MIMETYPE_PDF;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.jms.Queue;
|
||||||
|
|
||||||
|
import org.alfresco.transform.client.model.TransformReply;
|
||||||
|
import org.alfresco.transform.client.model.TransformRequest;
|
||||||
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.jms.core.JmsTemplate;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lucian Tuca
|
||||||
|
* created on 15/01/2019
|
||||||
|
*/
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public abstract class AbstractQueueTransformServiceIT
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private Queue engineRequestQueue;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JmsTemplate jmsTemplate;
|
||||||
|
|
||||||
|
private final ActiveMQQueue testingQueue = new ActiveMQQueue("org.alfresco.transform.engine.IT");
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void queueTransformServiceIT() {
|
||||||
|
|
||||||
|
TransformRequest request = buildRequest();
|
||||||
|
|
||||||
|
jmsTemplate.convertAndSend(engineRequestQueue, request, m -> {
|
||||||
|
m.setJMSCorrelationID(request.getRequestId());
|
||||||
|
m.setJMSReplyTo(testingQueue);
|
||||||
|
return m;
|
||||||
|
});
|
||||||
|
|
||||||
|
this.jmsTemplate.setReceiveTimeout(1_000);
|
||||||
|
TransformReply reply = (TransformReply) this.jmsTemplate.receiveAndConvert(testingQueue);
|
||||||
|
assertEquals(request.getRequestId(), reply.getRequestId());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract TransformRequest buildRequest();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user