mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3ebeac2eb4 | ||
|
d91a552925 | ||
|
8c91145b39 | ||
|
86fcf67016 |
@@ -177,6 +177,11 @@ jobs:
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=AllDBTestsTestSuite -Ddb.driver=org.postgresql.Driver -Ddb.name=alfresco -Ddb.url=jdbc:postgresql://localhost:5433/alfresco -Ddb.username=alfresco -Ddb.password=alfresco
|
||||
|
||||
- name: "Repository - Messaging tests"
|
||||
before_script:
|
||||
- docker run -d -p 61616:61616 -p 5672:5672 alfresco/alfresco-activemq:5.16.1
|
||||
script: travis_wait 20 mvn -B test -pl repository -Dtest=CamelRoutesTest,CamelComponentsTest
|
||||
|
||||
- name: "Remote-api - AppContext01TestSuite"
|
||||
before_script:
|
||||
- docker run -d -p 5433:5432 -e POSTGRES_PASSWORD=alfresco -e POSTGRES_USER=alfresco -e POSTGRES_DB=alfresco postgres:13.1 postgres -c 'max_connections=300'
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -9,6 +9,6 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
</project>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<profiles>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-tests</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<developers>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo-packaging</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
4
pom.xml
4
pom.xml
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>Alfresco Community Repo Parent</name>
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/alfresco-community-repo</url>
|
||||
<tag>9.2</tag>
|
||||
<tag>9.3</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>org.alfresco</groupId>
|
||||
<artifactId>alfresco-community-repo</artifactId>
|
||||
<version>9.2</version>
|
||||
<version>9.3</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@@ -32,7 +32,6 @@ import java.util.Deque;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.alfresco.repo.event.v1.model.EventType;
|
||||
import org.alfresco.repo.event.v1.model.RepoEvent;
|
||||
@@ -96,7 +95,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
private PersonService personService;
|
||||
protected NodeResourceHelper nodeResourceHelper;
|
||||
|
||||
private Executor threadPoolExecutor;
|
||||
private NodeTypeFilter nodeTypeFilter;
|
||||
private ChildAssociationTypeFilter childAssociationTypeFilter;
|
||||
private EventUserFilter userFilter;
|
||||
@@ -115,7 +113,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
PropertyCheck.mandatory(this, "transactionService", transactionService);
|
||||
PropertyCheck.mandatory(this, "personService", personService);
|
||||
PropertyCheck.mandatory(this, "nodeResourceHelper", nodeResourceHelper);
|
||||
PropertyCheck.mandatory(this, "threadPoolExecutor", threadPoolExecutor);
|
||||
|
||||
this.nodeTypeFilter = eventFilterRegistry.getNodeTypeFilter();
|
||||
this.childAssociationTypeFilter = eventFilterRegistry.getChildAssociationTypeFilter();
|
||||
@@ -201,11 +198,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
this.nodeResourceHelper = nodeResourceHelper;
|
||||
}
|
||||
|
||||
public void setThreadPoolExecutor(Executor threadPoolExecutor)
|
||||
{
|
||||
this.threadPoolExecutor = threadPoolExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||
{
|
||||
@@ -435,11 +427,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
}
|
||||
|
||||
protected void sendEvent(NodeRef nodeRef, EventConsolidator consolidator)
|
||||
{
|
||||
threadPoolExecutor.execute(()-> sendEventNow(nodeRef, consolidator));
|
||||
}
|
||||
|
||||
private void sendEventNow(NodeRef nodeRef, EventConsolidator consolidator)
|
||||
{
|
||||
if (consolidator.isTemporaryNode())
|
||||
{
|
||||
@@ -481,12 +468,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
}
|
||||
|
||||
protected void sendEvent(ChildAssociationRef childAssociationRef, ChildAssociationEventConsolidator consolidator)
|
||||
{
|
||||
threadPoolExecutor.execute(()-> sendEventNow(childAssociationRef, consolidator));
|
||||
}
|
||||
|
||||
private void sendEventNow(ChildAssociationRef childAssociationRef,
|
||||
ChildAssociationEventConsolidator consolidator)
|
||||
{
|
||||
if (consolidator.isTemporaryChildAssociation())
|
||||
{
|
||||
@@ -527,11 +508,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
}
|
||||
|
||||
protected void sendEvent(AssociationRef peerAssociationRef, PeerAssociationEventConsolidator consolidator)
|
||||
{
|
||||
threadPoolExecutor.execute(()-> sendEventNow(peerAssociationRef, consolidator));
|
||||
}
|
||||
|
||||
private void sendEventNow(AssociationRef peerAssociationRef, PeerAssociationEventConsolidator consolidator)
|
||||
{
|
||||
if (consolidator.isTemporaryPeerAssociation())
|
||||
{
|
||||
@@ -557,7 +533,6 @@ public class EventGenerator extends AbstractLifecycleBean implements Initializin
|
||||
LOGGER.trace("List of Events:" + listOfEvents);
|
||||
LOGGER.trace("Sending event:" + event);
|
||||
}
|
||||
|
||||
// Need to execute this in another read txn because Camel expects it
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction((RetryingTransactionCallback<Void>) () -> {
|
||||
event2MessageProducer.send(event);
|
||||
|
@@ -56,23 +56,5 @@
|
||||
|
||||
<bean id="eventGeneratorV2" class="org.alfresco.repo.event2.EventGenerator" parent="baseEventGeneratorV2">
|
||||
<property name="nodeResourceHelper" ref="nodeResourceHelper"/>
|
||||
<property name="threadPoolExecutor">
|
||||
<ref bean="eventAsyncThreadPool"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="eventAsyncThreadPool" class="org.alfresco.util.ThreadPoolExecutorFactoryBean">
|
||||
<property name="poolName">
|
||||
<value>eventAsyncThreadPool</value>
|
||||
</property>
|
||||
<property name="corePoolSize">
|
||||
<value>${repo.event2.threadPool.coreSize}</value>
|
||||
</property>
|
||||
<property name="maximumPoolSize">
|
||||
<value>${repo.event2.threadPool.maximumSize}</value>
|
||||
</property>
|
||||
<property name="threadPriority">
|
||||
<value>${repo.event2.threadPool.priority}</value>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
|
@@ -1209,10 +1209,6 @@ repo.event2.filter.childAssocTypes=rn:rendition
|
||||
repo.event2.filter.users=System, null
|
||||
# Topic name
|
||||
repo.event2.topic.endpoint=amqp:topic:alfresco.repo.event2
|
||||
# Thread pool for async delivery
|
||||
repo.event2.threadPool.priority=1
|
||||
repo.event2.threadPool.coreSize=8
|
||||
repo.event2.threadPool.maximumSize=10
|
||||
|
||||
# MNT-21083
|
||||
# --DELETE_NOT_EXISTS - default settings
|
||||
|
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.messaging.camel;
|
||||
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.Produce;
|
||||
import org.apache.camel.ProducerTemplate;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Tests Camel components defined in the application's Spring context
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "/test-messaging-context.xml")
|
||||
public class CamelComponentsTest {
|
||||
@Autowired
|
||||
protected CamelContext camelContext;
|
||||
|
||||
@Produce("activemq:queue:alfresco.test")
|
||||
protected ProducerTemplate activemqTemplate;
|
||||
|
||||
@Produce("amqp:queue:alfresco.test")
|
||||
protected ProducerTemplate amqpTemplate;
|
||||
|
||||
@Produce("jms:queue:alfresco.test")
|
||||
protected ProducerTemplate jmsTemplate;
|
||||
|
||||
|
||||
@Test
|
||||
public void testActivemqComponent()
|
||||
{
|
||||
final String msg = "ping <activemq>";
|
||||
|
||||
activemqTemplate.sendBody(msg);
|
||||
|
||||
final Object reply = camelContext
|
||||
.createConsumerTemplate()
|
||||
.receiveBody("activemq:queue:alfresco.test", 2000);
|
||||
|
||||
assertEquals(msg, reply);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAmqpComponent()
|
||||
{
|
||||
final String msg = "ping <amqp>";
|
||||
|
||||
amqpTemplate.sendBody(msg);
|
||||
|
||||
final Object reply = camelContext
|
||||
.createConsumerTemplate()
|
||||
.receiveBody("amqp:queue:alfresco.test", 2000);
|
||||
|
||||
assertEquals(msg, reply);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJmsComponent()
|
||||
{
|
||||
final String msg = "ping <jms>";
|
||||
|
||||
jmsTemplate.sendBody(msg);
|
||||
|
||||
final Object reply = camelContext
|
||||
.createConsumerTemplate()
|
||||
.receiveBody("jms:queue:alfresco.test", 2000);
|
||||
|
||||
assertEquals(msg, reply);
|
||||
}
|
||||
}
|
@@ -61,76 +61,76 @@ public class CamelRoutesTest
|
||||
|
||||
@Produce("direct-vm:alfresco.test.1")
|
||||
protected ProducerTemplate template1;
|
||||
|
||||
|
||||
@Produce("direct-vm:alfresco.test.2")
|
||||
protected ProducerTemplate template2;
|
||||
|
||||
|
||||
@Produce("direct-vm:alfresco.default")
|
||||
protected ProducerTemplate template3;
|
||||
|
||||
|
||||
@Produce("direct-vm:alfresco.test.transacted")
|
||||
protected ProducerTemplate template4;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected MockExceptionProcessor messagingExceptionProcessor;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected MockConsumer mockConsumer;
|
||||
|
||||
|
||||
@Autowired
|
||||
protected MockExceptionThrowingConsumer mockExceptionThrowingConsumer;
|
||||
|
||||
@Test
|
||||
public void testMessageRouteXmlDefined() throws Exception {
|
||||
String expectedBody = "<matched.>";
|
||||
|
||||
|
||||
resultEndpoint1.expectedBodiesReceived(expectedBody);
|
||||
|
||||
|
||||
template1.sendBody(expectedBody);
|
||||
|
||||
|
||||
resultEndpoint1.assertIsSatisfied();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMessageRoutePackageDefined() throws Exception {
|
||||
String expectedBody = "<matched.>";
|
||||
|
||||
|
||||
resultEndpoint2.expectedBodiesReceived(expectedBody);
|
||||
|
||||
|
||||
template2.sendBody(expectedBody);
|
||||
|
||||
|
||||
resultEndpoint2.assertIsSatisfied();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testMessageRouteXmlOverride() throws Exception {
|
||||
String expectedBody = "<matched.>";
|
||||
|
||||
|
||||
dlqEndpoint.expectedBodiesReceived(expectedBody);
|
||||
|
||||
|
||||
template3.sendBody(expectedBody);
|
||||
|
||||
|
||||
dlqEndpoint.assertIsSatisfied();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTransactedRoute() throws Exception {
|
||||
String expectedBody = "<matched.>";
|
||||
|
||||
|
||||
template4.sendBody(expectedBody);
|
||||
|
||||
|
||||
// Wait for Camel and ActiveMQ to process
|
||||
Thread.sleep(2000);
|
||||
|
||||
|
||||
// Test that our exception processor received the error
|
||||
assertNotNull(messagingExceptionProcessor.getLastError());
|
||||
assertTrue(messagingExceptionProcessor.getLastError().getClass().equals(
|
||||
IllegalArgumentException.class));
|
||||
|
||||
|
||||
// Check that an error was thrown the first time
|
||||
assertTrue(mockExceptionThrowingConsumer.isErrorThrown());
|
||||
assertNull(mockExceptionThrowingConsumer.getLastMessage());
|
||||
|
||||
|
||||
// Check that the message was re-delivered to a second consumer
|
||||
assertEquals(expectedBody, mockConsumer.getLastMessage());
|
||||
}
|
||||
|
@@ -31,7 +31,6 @@ import static org.awaitility.Awaitility.await;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
|
||||
@@ -105,10 +104,6 @@ public abstract class AbstractContextAwareRepoEvent extends BaseSpringTest
|
||||
@Autowired
|
||||
protected ObjectMapper event2ObjectMapper;
|
||||
|
||||
@Autowired @Qualifier("eventGeneratorV2")
|
||||
protected EventGenerator eventGenerator;
|
||||
|
||||
|
||||
protected NodeRef rootNodeRef;
|
||||
|
||||
@BeforeClass
|
||||
@@ -148,18 +143,6 @@ public abstract class AbstractContextAwareRepoEvent extends BaseSpringTest
|
||||
});
|
||||
}
|
||||
|
||||
@Before
|
||||
public void forceEventGeneratorToBeSynchronous() {
|
||||
eventGenerator.setThreadPoolExecutor(new Executor()
|
||||
{
|
||||
@Override
|
||||
public void execute(Runnable command)
|
||||
{
|
||||
command.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown()
|
||||
{
|
||||
|
@@ -9,13 +9,13 @@
|
||||
</bean>
|
||||
|
||||
<import resource="classpath:/alfresco/subsystems/Messaging/default/messaging-context.xml" />
|
||||
|
||||
|
||||
<bean id="messagingExceptionProcessor"
|
||||
class="org.alfresco.messaging.camel.MockExceptionProcessor" />
|
||||
|
||||
<bean id="mockConsumer"
|
||||
class="org.alfresco.messaging.camel.MockConsumer" />
|
||||
|
||||
|
||||
<bean id="mockExceptionThrowingConsumer"
|
||||
class="org.alfresco.messaging.camel.MockExceptionThrowingConsumer" />
|
||||
|
||||
@@ -25,4 +25,19 @@
|
||||
<property name="routeContextId" value="customRoutes" />
|
||||
</bean>
|
||||
|
||||
<bean id="transactionAwareEventProducer" class="org.mockito.Mockito" factory-method="mock">
|
||||
<constructor-arg value="org.alfresco.repo.rawevents.TransactionAwareEventProducer" />
|
||||
</bean>
|
||||
|
||||
<bean id="policyComponent" class="org.mockito.Mockito" factory-method="mock">
|
||||
<constructor-arg value="org.alfresco.repo.policy.PolicyComponentImpl"/>
|
||||
</bean>
|
||||
|
||||
<bean id="renditionEventProcessor" class="org.mockito.Mockito" factory-method="mock">
|
||||
<constructor-arg value="org.alfresco.repo.rendition2.RenditionEventProcessor"/>
|
||||
</bean>
|
||||
|
||||
<bean id="transformRequestProcessor" class="org.mockito.Mockito" factory-method="mock">
|
||||
<constructor-arg value="org.alfresco.repo.rendition2.TransformRequestProcessor" />
|
||||
</bean>
|
||||
</beans>
|
@@ -1,6 +1,9 @@
|
||||
messaging.broker.url=vm://localhost?broker.persistent=false
|
||||
messaging.broker.url=nio://localhost:61616
|
||||
messaging.broker.ssl=false
|
||||
messaging.broker.connections.max=8
|
||||
messaging.transacted=true
|
||||
messaging.broker.username=
|
||||
messaging.broker.password=
|
||||
messaging.broker.password=
|
||||
|
||||
acs.repo.rendition.events.endpoint=jms:acs-repo-rendition-events-test?jmsMessageType=Text
|
||||
acs.repo.transform.request.endpoint=jms:acs-repo-transform-request-test?jmsMessageType=Text
|
Reference in New Issue
Block a user