INT-2033 added test for 'order' attribute in AMQP module

This commit is contained in:
Oleg Zhurakousky
2011-08-08 18:41:20 -04:00
parent d38a56922f
commit 37fcdbe4d7
3 changed files with 69 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amqp="http://www.springframework.org/schema/integration/amqp"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:rabbit="http://www.springframework.org/schema/rabbit"
xsi:schemaLocation="http://www.springframework.org/schema/integration/amqp http://www.springframework.org/schema/integration/amqp/spring-integration-amqp-2.1.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd
http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<amqp:outbound-gateway id="rabbitGateway" request-channel="toRabbit"
reply-channel="fromRabbit"
exchange-name="si.test.exchange"
routing-key="si.test.binding"
amqp-template="amqpTemplate"
order="5"/>
<rabbit:template id="amqpTemplate" connection-factory="connectionFactory"/>
<bean id="connectionFactory" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="org.springframework.amqp.rabbit.connection.ConnectionFactory"/>
</bean>
<int:channel id="toRabbit"/>
<int:channel id="fromRabbit"/>
</beans>

View File

@@ -0,0 +1,39 @@
/*
* Copyright 2002-2011 the original author or authors.
*
* Licensed 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.springframework.integration.amqp.config;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.integration.amqp.outbound.AmqpOutboundEndpoint;
import org.springframework.integration.test.util.TestUtils;
import static org.junit.Assert.assertEquals;
/**
* @author Oleg Zhurakousky
*
*/
public class AmqpOutboundGatewayParserTests {
@Test
public void testGatewayConfig(){
ApplicationContext context = new ClassPathXmlApplicationContext("AmqpOutboundGatewayParserTests-context.xml", this.getClass());
AmqpOutboundEndpoint gateway = context.getBean(AmqpOutboundEndpoint.class);
assertEquals(5, gateway.getOrder());
assertEquals(context.getBean("fromRabbit"), TestUtils.getPropertyValue(gateway, "outputChannel"));
}
}

View File

@@ -32,7 +32,8 @@
reply-channel="fromRabbit"
exchange-name="si.test.exchange"
routing-key="si.test.binding"
amqp-template="amqpTemplate"/>
amqp-template="amqpTemplate"
order="1"/>
<amqp:inbound-gateway request-channel="amqpIn"
connection-factory="connectionFactory"