// TODO: generalise to a comparison of all immutable parts of messages private boolean compareMessageData(AMQPMessage m1, AMQPMessage m2) throws IOException { ByteArrayOutputStream b1 = new ByteArrayOutputStream(); ByteArrayOutputStream b2 = new ByteArrayOutputStream(); m1.getData().get(0).writeContent(new DataOutputStream(b1)); m2.getData().get(0).writeContent(new DataOutputStream(b2)); return Arrays.equals(b1.toByteArray(), b2.toByteArray()); }
public void testRoutingInvalidRoutes() throws Exception { ConnectionFactory factory = new ConnectionFactory(); com.rabbitmq.client.Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare("transient", false, false, false, null); connection.close(); for (String dest : Arrays.asList("/exchange/missing", "/queue/transient", "/fruit/orange")) { routeInvalidSource(dest); routeInvalidTarget(dest); } }