https://issues.apache.org/jira/browse/AMQ-4606 - remove mysql in favour of derby and defer start in replicated-leveldb b/c spring auto start hides the expected timeout when no zk

This commit is contained in:
gtully 2013-10-02 00:28:32 +01:00
parent 5ec5c525dd
commit 0530aacff7
3 changed files with 19 additions and 6 deletions

View File

@ -58,7 +58,8 @@
See more database locker options at http://activemq.apache.org/pluggable-storage-lockers.html
-->
<persistenceAdapter>
<jdbcPersistenceAdapter dataDirectory="${activemq.data}" dataSource="#mysql-ds" cleanupPeriod="0" />
<!-- for mysql-ds below, add attribute: dataSource="#mysql-ds" -->
<jdbcPersistenceAdapter dataDirectory="${activemq.data}" cleanupPeriod="0" />
</persistenceAdapter>
<transportConnectors>

View File

@ -32,7 +32,7 @@
<!--
The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="replicating-broker" dataDirectory="${activemq.data}">
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="replicating-broker" dataDirectory="${activemq.data}" start="false" >
<!--
For better performances use VM cursor and small memory limit.

View File

@ -25,6 +25,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.jms.Connection;
@ -51,11 +52,12 @@ public class BrokerXmlConfigStartTest {
Properties secProps;
private String configUrl;
private String shortName;
@Parameterized.Parameters
@Parameterized.Parameters(name = "{1}")
public static Collection<String[]> getTestParameters() {
List<String[]> configUrls = new ArrayList<String[]>();
configUrls.add(new String[]{"xbean:src/release/conf/activemq.xml"});
configUrls.add(new String[]{"xbean:src/release/conf/activemq.xml", "activemq.xml"});
File sampleConfDir = new File("target/conf");
for (File xmlFile : sampleConfDir.listFiles(new FileFilter() {
@ -65,15 +67,16 @@ public class BrokerXmlConfigStartTest {
pathname.getName().endsWith("xml");
}})) {
configUrls.add(new String[]{"xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName()});
configUrls.add(new String[]{"xbean:" + sampleConfDir.getAbsolutePath() + "/" + xmlFile.getName(), xmlFile.getName()});
}
return configUrls;
}
public BrokerXmlConfigStartTest(String config) {
public BrokerXmlConfigStartTest(String config, String configFileShortName) {
this.configUrl = config;
this.shortName = configFileShortName;
}
@Test
@ -82,6 +85,15 @@ public class BrokerXmlConfigStartTest {
LOG.info("Broker config: " + configUrl);
System.err.println("Broker config: " + configUrl);
broker = BrokerFactory.createBroker(configUrl);
if ("activemq-leveldb-replicating.xml".equals(shortName)) {
try {
broker.start();
} catch (TimeoutException expectedWithNoZk) {
return;
}
} else {
broker.start();
}
// alive, now try connect to connect
try {
for (TransportConnector transport : broker.getTransportConnectors()) {