Fix loop to not skip the composite split code.
This commit is contained in:
Timothy Bish 2016-04-13 18:53:28 -04:00
parent aaecdff8b4
commit 15dc6cc765
2 changed files with 49 additions and 4 deletions

View File

@ -214,16 +214,15 @@ public class LegacyFrameTranslator implements FrameTranslator {
ActiveMQDestination fallback = ActiveMQDestination.getUnresolvableDestinationTransformer().transform(fallbackName);
if (fallback != null) {
destinationBuilder.append(fallback.getQualifiedName());
continue;
}
} catch (JMSException e) {
throw new ProtocolException("Illegal destination name: [" + fallbackName + "] -- ActiveMQ STOMP destinations "
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/", false, e);
}
} else {
throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
}
throw new ProtocolException("Illegal destination name: [" + originalName + "] -- ActiveMQ STOMP destinations "
+ "must begin with one of: /queue/ /topic/ /temp-queue/ /temp-topic/");
}
if (i < destinations.length - 1) {

View File

@ -28,6 +28,7 @@ import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.management.ObjectName;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.broker.jmx.BrokerViewMBean;
@ -233,6 +234,51 @@ public class StompCompositeDestinationTest extends StompTestSupport {
stompConnection.disconnect();
}
@Test(timeout = 60000)
public void testSendMessageToCompositeQueueNoPrefixes() throws Exception {
stompConnect();
String destinationA = "StompA.Queue";
String destinationB = "StompB.Queue";
String frame = "CONNECT\n" +
"login:system\n" +
"passcode:manager\n\n" + Stomp.NULL;
stompConnection.sendFrame(frame);
frame = stompConnection.receiveFrame();
assertTrue(frame.startsWith("CONNECTED"));
frame = "SEND\n" +
"destination:" + destinationA + "," + destinationB +
"\n\n" + "Hello World" + Stomp.NULL;
stompConnection.sendFrame(frame);
final BrokerViewMBean brokerView = getProxyToBroker();
assertTrue("Should be two destinations for the dispatch", Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
for(ObjectName queueName : brokerView.getQueues()) {
LOG.info("Broker Has Queue: {}", queueName);
}
return brokerView.getQueues().length == 2;
}
}, TimeUnit.SECONDS.toMillis(30), TimeUnit.MILLISECONDS.toMillis(150)));
QueueViewMBean viewOfA = getProxyToQueue(destinationA);
QueueViewMBean viewOfB = getProxyToQueue(destinationB);
assertNotNull(viewOfA);
assertNotNull(viewOfB);
assertEquals(1, viewOfA.getQueueSize());
assertEquals(1, viewOfB.getQueueSize());
stompConnection.disconnect();
}
@Test(timeout = 60000)
public void testSendMessageToCompositeTopic() throws Exception {
stompConnect();