renamed headers, and adjusted header-enricherc

This commit is contained in:
Mark Fisher
2010-11-13 12:29:04 -05:00
parent 956ec17356
commit 48d481467c
10 changed files with 69 additions and 50 deletions

View File

@@ -17,7 +17,7 @@
<channel id="output"/>
<xmpp:header-enricher input-channel="input" output-channel="output">
<xmpp:message-to value="test1@example.org"/>
<xmpp:chat-to value="test1@example.org"/>
</xmpp:header-enricher>
</beans:beans>

View File

@@ -61,7 +61,7 @@ public class XmppHeaderEnricherParserTests {
doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) throws Throwable {
Message message = (Message) invocation.getArguments()[0];
String chatToUser = (String) message.getHeaders().get(XmppHeaders.CHAT_TO_USER);
String chatToUser = (String) message.getHeaders().get(XmppHeaders.CHAT_TO);
assertNotNull(chatToUser);
assertEquals("test1@example.org", chatToUser);
return null;

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xmpp.config;
import static junit.framework.Assert.assertEquals;
@@ -79,7 +80,7 @@ public class XmppMessageOutboundEndpointParserTests {
Object pollingConsumer = context.getBean("outboundPollingAdapter");
assertTrue(pollingConsumer instanceof PollingConsumer);
MessageChannel channel = context.getBean("outboundEventChannel", MessageChannel.class);
Message<?> message = MessageBuilder.withPayload("hello").setHeader(XmppHeaders.CHAT_TO_USER, "oleg").build();
Message<?> message = MessageBuilder.withPayload("hello").setHeader(XmppHeaders.CHAT_TO, "oleg").build();
XMPPConnection connection = context.getBean("testConnection", XMPPConnection.class);
ChatManager chatManager = mock(ChatManager.class);

View File

@@ -55,7 +55,7 @@ public class XmppMessageProducer implements MessageSource<String> {
logger.info("sending message to recipient " + recipient);
return MessageBuilder.withPayload(msg).setHeader(XmppHeaders.CHAT_TO_USER, recipient).build();
return MessageBuilder.withPayload(msg).setHeader(XmppHeaders.CHAT_TO, recipient).build();
}
catch (InterruptedException e) {
logger.debug("exception thrown when trying to receive a message", e);

View File

@@ -1,6 +1,19 @@
/**
*
/*
* 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.xmpp.outbound;
import static junit.framework.Assert.assertNotNull;
@@ -44,7 +57,7 @@ public class XmppMessageSendingMessageHandlerTests {
ChatMessageSendingMessageHandler handler = new ChatMessageSendingMessageHandler(connection);
handler.afterPropertiesSet();
Message<?> message = MessageBuilder.withPayload("Test Message").
setHeader(XmppHeaders.CHAT_TO_USER, "kermit@frog.com").
setHeader(XmppHeaders.CHAT_TO, "kermit@frog.com").
build();
// first Message
handler.handleMessage(message);
@@ -54,7 +67,7 @@ public class XmppMessageSendingMessageHandlerTests {
// assuming we know thread ID although currently we do not provide this capability
message = MessageBuilder.withPayload("Hello Kitty").
setHeader(XmppHeaders.CHAT_TO_USER, "kermit@frog.com").
setHeader(XmppHeaders.CHAT_TO, "kermit@frog.com").
setHeader(XmppHeaders.CHAT_THREAD_ID, "123").
build();
reset(chat, chantManager);

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.xmpp.outbound;
import static junit.framework.Assert.assertNotNull;