You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by an...@apache.org on 2016/07/02 13:39:59 UTC
camel git commit: ITest: dynamic port for activemq
Repository: camel
Updated Branches:
refs/heads/master 85b5e05f6 -> 8b6ff3f77
ITest: dynamic port for activemq
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/8b6ff3f7
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/8b6ff3f7
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/8b6ff3f7
Branch: refs/heads/master
Commit: 8b6ff3f773930055f87b25e8d08754a818a917a2
Parents: 85b5e05
Author: Arno Noordover <an...@users.noreply.github.com>
Authored: Sat Jul 2 15:39:46 2016 +0200
Committer: Arno Noordover <an...@users.noreply.github.com>
Committed: Sat Jul 2 15:39:46 2016 +0200
----------------------------------------------------------------------
tests/camel-itest/pom.xml | 3 +-
.../org/apache/camel/itest/ITestSupport.java | 63 ++++++++++++++++++++
...romJmsToJdbcIdempotentConsumerToJmsTest.java | 46 +++++++-------
...mJmsToJdbcIdempotentConsumerToJmsXaTest.java | 2 +
.../camel/itest/tx/Jms2RequiresNewTest.java | 2 +
.../camel-itest/src/test/resources/activemq.xml | 7 ++-
...FromJmsToJdbcIdempotentConsumerToJmsTest.xml | 22 +++----
...omJmsToJdbcIdempotentConsumerToJmsXaTest.xml | 8 ++-
.../itest/tx/Jms2RequiresNewTest-context.xml | 6 +-
9 files changed, 119 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/pom.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml
index d96394e..be5c947 100644
--- a/tests/camel-itest/pom.xml
+++ b/tests/camel-itest/pom.xml
@@ -409,7 +409,8 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- must for per test -->
- <forkMode>always</forkMode>
+ <forkCount>1</forkCount>
+ <reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>3000</forkedProcessTimeoutInSeconds>
<systemPropertyVariables>
<derby.stream.error.file>target/derby.log</derby.stream.error.file>
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/java/org/apache/camel/itest/ITestSupport.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/ITestSupport.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/ITestSupport.java
new file mode 100644
index 0000000..3cde0b5
--- /dev/null
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/ITestSupport.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.itest;
+
+import org.apache.camel.test.AvailablePortFinder;
+
+/**
+ * For test cases that use unique contexts, they can share the
+ * ports which will make things a bit faster as ports aren't opened
+ * and closed all the time.
+ */
+public final class ITestSupport {
+
+ static final int PORT1 = AvailablePortFinder.getNextAvailable();
+ static final int PORT2 = AvailablePortFinder.getNextAvailable();
+ static final int PORT3 = AvailablePortFinder.getNextAvailable(61616);
+ static final int PORT4 = AvailablePortFinder.getNextAvailable(61616);
+
+ static {
+ //set them as system properties so Spring can use the property placeholder
+ //things to set them into the URL's in the spring contexts
+ System.setProperty("ITestSupport.port1", Integer.toString(PORT1));
+ System.setProperty("ITestSupport.port2", Integer.toString(PORT2));
+ System.setProperty("ITestSupport.port3", Integer.toString(PORT3));
+ System.setProperty("ITestSupport.port4", Integer.toString(PORT4));
+ }
+
+ private ITestSupport() {
+ }
+
+ public static int getPort(String name) {
+ int port = AvailablePortFinder.getNextAvailable();
+ System.setProperty(name, Integer.toString(port));
+ return port;
+ }
+
+ public static int getPort1() {
+ return PORT1;
+ }
+
+ public static int getPort2() {
+ return PORT2;
+ }
+
+ public static int getPort3() {
+ return PORT3;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java
index a152ac0..f9e3141 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.java
@@ -25,6 +25,7 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.itest.ITestSupport;
import org.apache.camel.spi.IdempotentRepository;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Before;
@@ -44,6 +45,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
@Override
protected AbstractApplicationContext createApplicationContext() {
+ ITestSupport.getPort2();
return new ClassPathXmlApplicationContext("org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml");
}
@@ -76,7 +78,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
getMockEndpoint("mock:a").expectedMessageCount(1);
getMockEndpoint("mock:b").expectedMessageCount(1);
- template.sendBodyAndHeader("activemq:queue:inbox", "A", "uid", 123);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "A", "uid", 123);
// assert mock and wait for the message to be done
assertMockEndpointsSatisfied();
@@ -84,7 +86,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// check that there is a message in the database and JMS queue
assertEquals(new Integer(1), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- Object out = consumer.receiveBody("activemq:queue:outbox", 3000);
+ Object out = consumer.receiveBody("activemq2:queue:outbox", 3000);
assertEquals("DONE-A", out);
}
@@ -107,7 +109,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
});
getMockEndpoint("mock:b").expectedMessageCount(0);
- template.sendBodyAndHeader("activemq:queue:inbox", "A", "uid", 123);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "A", "uid", 123);
// assert mock and wait for the message to be done
assertMockEndpointsSatisfied();
@@ -115,10 +117,10 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// check that there is a message in the database and JMS queue
assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- assertNull(consumer.receiveBody("activemq:queue:outbox", 3000));
+ assertNull(consumer.receiveBody("activemq2:queue:outbox", 3000));
// the message should have been moved to the AMQ DLQ queue
- assertEquals("A", consumer.receiveBody("activemq:queue:ActiveMQ.DLQ", 3000));
+ assertEquals("A", consumer.receiveBody("activemq2:queue:ActiveMQ.DLQ", 3000));
}
@Ignore("see the TODO below")
@@ -140,7 +142,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
}
});
- template.sendBodyAndHeader("activemq:queue:inbox", "B", "uid", 456);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "B", "uid", 456);
// assert mock and wait for the message to be done
assertMockEndpointsSatisfied();
@@ -148,10 +150,10 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// check that there is a message in the database and JMS queue
assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- assertNull(consumer.receiveBody("activemq:queue:outbox", 3000));
+ assertNull(consumer.receiveBody("activemq2:queue:outbox", 3000));
// the message should have been moved to the AMQ DLQ queue
- assertEquals("B", consumer.receiveBody("activemq:queue:ActiveMQ.DLQ", 3000));
+ assertEquals("B", consumer.receiveBody("activemq2:queue:ActiveMQ.DLQ", 3000));
}
@Test
@@ -166,9 +168,9 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// there should be 1 duplicate
getMockEndpoint("mock:b").expectedMessageCount(2);
- template.sendBodyAndHeader("activemq:queue:inbox", "D", "uid", 111);
- template.sendBodyAndHeader("activemq:queue:inbox", "E", "uid", 222);
- template.sendBodyAndHeader("activemq:queue:inbox", "D", "uid", 111);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "E", "uid", 222);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111);
// assert mock and wait for the message to be done
assertMockEndpointsSatisfied();
@@ -176,8 +178,8 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// check that there is two messages in the database and JMS queue
assertEquals(new Integer(2), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- assertEquals("DONE-D", consumer.receiveBody("activemq:queue:outbox", 3000));
- assertEquals("DONE-E", consumer.receiveBody("activemq:queue:outbox", 3000));
+ assertEquals("DONE-D", consumer.receiveBody("activemq2:queue:outbox", 3000));
+ assertEquals("DONE-E", consumer.receiveBody("activemq2:queue:outbox", 3000));
}
@Test
@@ -202,9 +204,9 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
}
});
- template.sendBodyAndHeader("activemq:queue:inbox", "D", "uid", 111);
- template.sendBodyAndHeader("activemq:queue:inbox", "E", "uid", 222);
- template.sendBodyAndHeader("activemq:queue:inbox", "F", "uid", 333);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "D", "uid", 111);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "E", "uid", 222);
+ template.sendBodyAndHeader("activemq2:queue:inbox", "F", "uid", 333);
// assert mock and wait for the message to be done
assertMockEndpointsSatisfied();
@@ -212,15 +214,15 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
// check that there is two messages in the database and JMS queue
assertEquals(new Integer(3), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- assertEquals("DONE-D", consumer.receiveBody("activemq:queue:outbox", 3000));
- assertEquals("DONE-E", consumer.receiveBody("activemq:queue:outbox", 3000));
- assertEquals("DONE-F", consumer.receiveBody("activemq:queue:outbox", 3000));
+ assertEquals("DONE-D", consumer.receiveBody("activemq2:queue:outbox", 3000));
+ assertEquals("DONE-E", consumer.receiveBody("activemq2:queue:outbox", 3000));
+ assertEquals("DONE-F", consumer.receiveBody("activemq2:queue:outbox", 3000));
}
protected void checkInitialState() {
// check there are no messages in the database and JMS queue
assertEquals(new Integer(0), jdbcTemplate.queryForObject("select count(*) from CAMEL_MESSAGEPROCESSED", Integer.class));
- assertNull(consumer.receiveBody("activemq:queue:outbox", 2000));
+ assertNull(consumer.receiveBody("activemq2:queue:outbox", 2000));
}
@Override
@@ -230,13 +232,13 @@ public class FromJmsToJdbcIdempotentConsumerToJmsTest extends CamelSpringTestSup
public void configure() throws Exception {
IdempotentRepository<?> repository = context.getRegistry().lookupByNameAndType("messageIdRepository", IdempotentRepository.class);
- from("activemq:queue:inbox")
+ from("activemq2:queue:inbox")
.transacted("required")
.to("mock:a")
.idempotentConsumer(header("uid"), repository)
.to("mock:b")
.transform(simple("DONE-${body}"))
- .to("activemq:queue:outbox");
+ .to("activemq2:queue:outbox");
}
};
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.java
index 8b95467..53a54e4 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.java
@@ -19,6 +19,7 @@ package org.apache.camel.itest.sql;
import java.sql.DriverManager;
import java.sql.SQLException;
+import org.apache.camel.itest.ITestSupport;
import org.junit.After;
import org.junit.Before;
@@ -60,6 +61,7 @@ public class FromJmsToJdbcIdempotentConsumerToJmsXaTest extends FromJmsToJdbcIde
@Override
protected AbstractApplicationContext createApplicationContext() {
+ ITestSupport.getPort1();
return new ClassPathXmlApplicationContext("org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml");
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/Jms2RequiresNewTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/Jms2RequiresNewTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/Jms2RequiresNewTest.java
index 0e6a750..794505d 100644
--- a/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/Jms2RequiresNewTest.java
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/tx/Jms2RequiresNewTest.java
@@ -22,6 +22,7 @@ import org.apache.camel.ExchangePattern;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.itest.ITestSupport;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -42,6 +43,7 @@ import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class Jms2RequiresNewTest extends AbstractJUnit4SpringContextTests {
+ private static final int PORT3 = ITestSupport.getPort3();
@Autowired
private CamelContext camelContext;
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/resources/activemq.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/resources/activemq.xml b/tests/camel-itest/src/test/resources/activemq.xml
index e863304..ac94101 100644
--- a/tests/camel-itest/src/test/resources/activemq.xml
+++ b/tests/camel-itest/src/test/resources/activemq.xml
@@ -22,12 +22,15 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
- <broker:broker id="broker" useJmx="false" persistent="false" dataDirectory="target/activemq">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+ <broker:broker id="broker" useJmx="false" persistent="false" dataDirectory="target/activemq">
<broker:transportConnectors>
- <broker:transportConnector name="openwire" uri="tcp://localhost:61616"/>
+ <broker:transportConnector name="openwire" uri="tcp://localhost:${ITestSupport.port3}"/>
</broker:transportConnectors>
</broker:broker>
+
</beans>
<!-- END SNIPPET: example -->
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml b/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml
index 9091740..6476206 100644
--- a/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml
+++ b/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsTest.xml
@@ -26,6 +26,8 @@
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
<!-- jdbc idempotent repository, per default creates the table CAMEL_MESSAGEPROCESSED if not already existing -->
<bean id="messageIdRepository" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
<constructor-arg index="0" ref="myNonXADataSource"/>
@@ -34,35 +36,35 @@
<!-- use required TX -->
<bean id="requiredTemplate" class="org.springframework.transaction.support.TransactionTemplate">
- <property name="transactionManager" ref="jmsTransactionManager"/>
+ <property name="transactionManager" ref="jmsTransactionManager2"/>
</bean>
<bean id="required" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionTemplate" ref="requiredTemplate"/>
</bean>
<!-- this is the Spring JmsTransactionManager which under the hood uses Atomikos -->
- <bean id="jmsTransactionManager"
- class="org.springframework.jms.connection.JmsTransactionManager" depends-on="my-broker">
- <property name="connectionFactory" ref="jmsConnectionFactory"/>
+ <bean id="jmsTransactionManager2"
+ class="org.springframework.jms.connection.JmsTransactionManager" depends-on="my-broker2">
+ <property name="connectionFactory" ref="jmsConnectionFactory2"/>
</bean>
<!-- Is the ConnectionFactory to connect to the JMS broker -->
- <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="my-broker">
- <property name="brokerURL" value="tcp://localhost:61616"/>
+ <bean id="jmsConnectionFactory2" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="my-broker2">
+ <property name="brokerURL" value="tcp://localhost:${ITestSupport.port3}"/>
</bean>
<!-- define the activemq Camel component so we can integrate with the AMQ broker below -->
- <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" depends-on="my-broker">
+ <bean id="activemq2" class="org.apache.activemq.camel.component.ActiveMQComponent" depends-on="my-broker2">
<!-- must indicate that we use transacted acknowledge mode -->
<property name="transacted" value="true"/>
<!-- refer to the transaction manager -->
- <property name="transactionManager" ref="jmsTransactionManager"/>
+ <property name="transactionManager" ref="jmsTransactionManager2"/>
</bean>
<!-- setup a local JMS Broker for testing purpose -->
- <broker:broker id="my-broker" useJmx="false" persistent="false" brokerName="localhost">
+ <broker:broker id="my-broker2" useJmx="false" persistent="false" brokerName="localhost">
<broker:transportConnectors>
- <broker:transportConnector uri="tcp://localhost:61616"/>
+ <broker:transportConnector uri="tcp://localhost:${ITestSupport.port3}"/>
</broker:transportConnectors>
</broker:broker>
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml b/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml
index c7d556d..8458db8 100644
--- a/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml
+++ b/tests/camel-itest/src/test/resources/org/apache/camel/itest/sql/FromJmsToJdbcIdempotentConsumerToJmsXaTest.xml
@@ -26,6 +26,8 @@
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
<!-- jdbc idempotent repository, per default creates the table CAMEL_MESSAGEPROCESSED if not already existing -->
<bean id="messageIdRepository" class="org.apache.camel.processor.idempotent.jdbc.JdbcMessageIdRepository">
<constructor-arg index="0" ref="myXADataSource"/>
@@ -72,11 +74,11 @@
<!-- Is the ConnectionFactory to connect to the JMS broker -->
<!-- notice how we must use the XA connection factory -->
<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory" depends-on="my-broker">
- <property name="brokerURL" value="tcp://localhost:61616"/>
+ <property name="brokerURL" value="tcp://localhost:${ITestSupport.port3}"/>
</bean>
<!-- define the activemq Camel component so we can integrate with the AMQ broker below -->
- <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" depends-on="my-broker">
+ <bean id="activemq2" class="org.apache.activemq.camel.component.ActiveMQComponent" depends-on="my-broker">
<!-- must indicate that we use transacted acknowledge mode -->
<property name="transacted" value="true"/>
<!-- refer to the transaction manager -->
@@ -86,7 +88,7 @@
<!-- setup a local JMS Broker for testing purpose -->
<broker:broker id="my-broker" useJmx="false" persistent="false" brokerName="localhost">
<broker:transportConnectors>
- <broker:transportConnector uri="tcp://localhost:61616"/>
+ <broker:transportConnector uri="tcp://localhost:${ITestSupport.port3}"/>
</broker:transportConnectors>
</broker:broker>
http://git-wip-us.apache.org/repos/asf/camel/blob/8b6ff3f7/tests/camel-itest/src/test/resources/org/apache/camel/itest/tx/Jms2RequiresNewTest-context.xml
----------------------------------------------------------------------
diff --git a/tests/camel-itest/src/test/resources/org/apache/camel/itest/tx/Jms2RequiresNewTest-context.xml b/tests/camel-itest/src/test/resources/org/apache/camel/itest/tx/Jms2RequiresNewTest-context.xml
index 7baa7c1..1764934 100644
--- a/tests/camel-itest/src/test/resources/org/apache/camel/itest/tx/Jms2RequiresNewTest-context.xml
+++ b/tests/camel-itest/src/test/resources/org/apache/camel/itest/tx/Jms2RequiresNewTest-context.xml
@@ -23,6 +23,8 @@
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
<!-- use required TX -->
<bean id="PROPAGATION_REQUIRES_NEW" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="jtaTransactionManager"/>
@@ -55,7 +57,7 @@
<!-- Is the ConnectionFactory to connect to the JMS broker -->
<!-- notice how we must use the XA connection factory -->
<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory" depends-on="my-broker">
- <property name="brokerURL" value="tcp://localhost:61616"/>
+ <property name="brokerURL" value="tcp://localhost:${ITestSupport.port3}"/>
</bean>
<!-- define the activemq Camel component so we can integrate with the AMQ broker below -->
@@ -69,7 +71,7 @@
<!-- setup a local JMS Broker for testing purpose -->
<broker id="my-broker" useJmx="false" persistent="false" brokerName="localhost" xmlns="http://activemq.apache.org/schema/core">
<transportConnectors>
- <transportConnector uri="tcp://localhost:61616"/>
+ <transportConnector uri="tcp://localhost:${ITestSupport.port3}"/>
</transportConnectors>
</broker>