INT-1069: Add namespace support for persistent queues
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<channel id="output">
|
||||
<queue capacity="5" message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<channel id="input" />
|
||||
|
||||
<service-activator id="activator" ref="bean" input-channel="input" output-channel="output"/>
|
||||
|
||||
<beans:bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore" />
|
||||
|
||||
<beans:bean id="bean" class="org.springframework.integration.config.TestHandler">
|
||||
<beans:property name="replyMessageText" value="hello"/>
|
||||
</beans:bean>
|
||||
|
||||
</beans:beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<channel id="output">
|
||||
<queue capacity="5" message-store="messageStore" />
|
||||
</channel>
|
||||
|
||||
<channel id="input" />
|
||||
|
||||
<service-activator id="activator" ref="bean" input-channel="input" output-channel="output"/>
|
||||
|
||||
<beans:bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore" />
|
||||
|
||||
<beans:bean id="bean" class="org.springframework.integration.config.TestHandler">
|
||||
<beans:property name="replyMessageText" value="hello"/>
|
||||
</beans:bean>
|
||||
|
||||
</beans:beans>
|
||||
|
||||
@@ -56,16 +56,17 @@ public class ChannelWithMessageStoreParserTests {
|
||||
|
||||
@Test
|
||||
@DirtiesContext
|
||||
public void testAggregation() throws Exception {
|
||||
public void testActivatorSendsToPersistentQueue() throws Exception {
|
||||
|
||||
input.send(createMessage("123", "id1", 3, 1, null));
|
||||
assertEquals(1, messageGroupStore.getMessageGroup("id1").size());
|
||||
handler.getLatch().await(100, TimeUnit.MILLISECONDS);
|
||||
assertEquals("The message payload is not correct", "123", handler.getMessageString());
|
||||
assertEquals(0, messageGroupStore.getMessageGroup("id1").size());
|
||||
// The group id for buffered messages is the channel name
|
||||
assertEquals(1, messageGroupStore.getMessageGroup("output").size());
|
||||
|
||||
Message<?> result = output.receive(100);
|
||||
assertEquals("hello", result.getPayload());
|
||||
assertEquals(0, messageGroupStore.getMessageGroup("output").size());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:beans="http://www.springframework.org/schema/beans"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/integration
|
||||
http://www.springframework.org/schema/integration/spring-integration.xsd">
|
||||
|
||||
<channel id="output">
|
||||
<queue message-store="messageStore" ref="queue" />
|
||||
</channel>
|
||||
|
||||
<beans:bean id="messageStore" class="org.springframework.integration.store.SimpleMessageStore" />
|
||||
|
||||
</beans:beans>
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2002-2010 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.config;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Matchers;
|
||||
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class InvalidChannelWithMessageStoreParserTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testRefAndStoreIllegal() throws Exception {
|
||||
exception.expect(BeanDefinitionParsingException.class);
|
||||
exception.expectMessage(Matchers.contains("'message-store' attribute is not allowed"));
|
||||
new ClassPathXmlApplicationContext(getClass().getSimpleName() + "-context.xml", getClass());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class TestHandler {
|
||||
public String handle(Message<?> message) {
|
||||
this.messageString = message.getPayload().toString();
|
||||
this.latch.countDown();
|
||||
return (this.replyMessageText != null) ? this.replyMessageText : null;
|
||||
return this.replyMessageText;
|
||||
}
|
||||
|
||||
public String getMessageString() {
|
||||
|
||||
Reference in New Issue
Block a user