Add an option to allow test cases to easily change the transformer

instance used by the AmqpProtocolConverter.
This commit is contained in:
Timothy Bish 2014-05-14 13:02:28 -04:00
parent 38a86b470f
commit 8f3e08c7b6
1 changed files with 12 additions and 4 deletions

View File

@ -124,22 +124,26 @@ public class AmqpTestSupport {
TransportConnector connector = null; TransportConnector connector = null;
if (isUseTcpConnector()) { if (isUseTcpConnector()) {
connector = brokerService.addConnector("amqp://0.0.0.0:" + port); connector = brokerService.addConnector(
"amqp://0.0.0.0:" + port + "?transport.transformer=" + getAmqpTransformer());
port = connector.getConnectUri().getPort(); port = connector.getConnectUri().getPort();
LOG.debug("Using amqp port " + port); LOG.debug("Using amqp port " + port);
} }
if (isUseSslConnector()) { if (isUseSslConnector()) {
connector = brokerService.addConnector("amqp+ssl://0.0.0.0:" + sslPort); connector = brokerService.addConnector(
"amqp+ssl://0.0.0.0:" + sslPort + "?transport.transformer=" + getAmqpTransformer());
sslPort = connector.getConnectUri().getPort(); sslPort = connector.getConnectUri().getPort();
LOG.debug("Using amqp+ssl port " + sslPort); LOG.debug("Using amqp+ssl port " + sslPort);
} }
if (isUseNioConnector()) { if (isUseNioConnector()) {
connector = brokerService.addConnector("amqp+nio://0.0.0.0:" + nioPort); connector = brokerService.addConnector(
"amqp+nio://0.0.0.0:" + nioPort + "?transport.transformer=" + getAmqpTransformer());
nioPort = connector.getConnectUri().getPort(); nioPort = connector.getConnectUri().getPort();
LOG.debug("Using amqp+nio port " + nioPort); LOG.debug("Using amqp+nio port " + nioPort);
} }
if (isUseNioPlusSslConnector()) { if (isUseNioPlusSslConnector()) {
connector = brokerService.addConnector("amqp+nio+ssl://0.0.0.0:" + nioPlusSslPort); connector = brokerService.addConnector(
"amqp+nio+ssl://0.0.0.0:" + nioPlusSslPort + "?transport.transformer=" + getAmqpTransformer());
nioPlusSslPort = connector.getConnectUri().getPort(); nioPlusSslPort = connector.getConnectUri().getPort();
LOG.debug("Using amqp+nio+ssl port " + nioPlusSslPort); LOG.debug("Using amqp+nio+ssl port " + nioPlusSslPort);
} }
@ -161,6 +165,10 @@ public class AmqpTestSupport {
return false; return false;
} }
protected String getAmqpTransformer() {
return "jms";
}
public void startBroker() throws Exception { public void startBroker() throws Exception {
if (brokerService != null) { if (brokerService != null) {
throw new IllegalStateException("Broker is already created."); throw new IllegalStateException("Broker is already created.");