INT-1435 adding tests, one @Ignore-d for now
This commit is contained in:
@@ -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:int="http://www.springframework.org/schema/integration"
|
||||
xmlns:int-jms="http://www.springframework.org/schema/integration/jms"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
|
||||
http://www.springframework.org/schema/integration/jms http://www.springframework.org/schema/integration/jms/spring-integration-jms-2.0.xsd">
|
||||
|
||||
<int-jms:outbound-channel-adapter id="outbound" destination-name="queue.test.priority" priority="3" explicit-qos-enabled="true"/>
|
||||
|
||||
<int-jms:message-driven-channel-adapter channel="results" destination-name="queue.test.priority" extract-payload="false"/>
|
||||
|
||||
<int:channel id="results">
|
||||
<int:queue capacity="2"/>
|
||||
</int:channel>
|
||||
|
||||
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
|
||||
<property name="targetConnectionFactory">
|
||||
<bean class="org.apache.activemq.ActiveMQConnectionFactory">
|
||||
<property name="brokerURL" value="vm://localhost"/>
|
||||
</bean>
|
||||
</property>
|
||||
<property name="sessionCacheSize" value="10"/>
|
||||
<property name="cacheProducers" value="false"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.jms.config;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.integration.Message;
|
||||
import org.springframework.integration.MessageChannel;
|
||||
import org.springframework.integration.core.PollableChannel;
|
||||
import org.springframework.integration.support.MessageBuilder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
/**
|
||||
* @author Mark Fisher
|
||||
* @since 2.0.2
|
||||
*/
|
||||
@ContextConfiguration
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
public class JmsPriorityTests {
|
||||
|
||||
@Autowired
|
||||
private MessageChannel outbound;
|
||||
|
||||
@Autowired
|
||||
private PollableChannel results;
|
||||
|
||||
@Before
|
||||
public void prepareActiveMq() {
|
||||
ActiveMqTestUtils.prepare();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyPrioritySettingOnAdapterUsedAsJmsPriorityIfNoHeader() throws Exception {
|
||||
Message<?> message = MessageBuilder.withPayload("test").build();
|
||||
outbound.send(message);
|
||||
Message<?> result = results.receive(5000);
|
||||
assertNotNull(result);
|
||||
assertTrue(result.getPayload() instanceof javax.jms.Message);
|
||||
javax.jms.Message jmsMessage = (javax.jms.Message) result.getPayload();
|
||||
assertEquals(3, jmsMessage.getJMSPriority());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void verifyPriorityHeaderUsedAsJmsPriority() throws Exception {
|
||||
Message<?> message = MessageBuilder.withPayload("test").setPriority(7).build();
|
||||
outbound.send(message);
|
||||
Message<?> result = results.receive(5000);
|
||||
assertNotNull(result);
|
||||
assertTrue(result.getPayload() instanceof javax.jms.Message);
|
||||
javax.jms.Message jmsMessage = (javax.jms.Message) result.getPayload();
|
||||
assertEquals(7, jmsMessage.getJMSPriority());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user