moved spaces to tabs for the xmpp package

This commit is contained in:
Josh Long
2010-08-24 22:07:37 +00:00
parent 0ec4e095d5
commit d2f74acbfb
27 changed files with 850 additions and 873 deletions

View File

@@ -19,11 +19,8 @@ package org.springframework.integration.xmpp.config;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.integration.Message;
import org.springframework.integration.MessageDeliveryException;
import org.springframework.integration.MessageHandlingException;
@@ -32,8 +29,6 @@ import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.core.MessageBuilder;
import org.springframework.integration.core.MessageHandler;
import org.springframework.integration.core.MessagingTemplate;
import org.springframework.integration.mapping.*;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -47,26 +42,26 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class XmppHeaderEnricherParserTests {
private static final Log logger = LogFactory.getLog(XmppHeaderEnricherParserTests.class);
private static final Log logger = LogFactory.getLog(XmppHeaderEnricherParserTests.class);
@Value("#{input}")
private DirectChannel input;
@Value("#{input}")
private DirectChannel input;
@Value("#{output}")
private DirectChannel output;
@Value("#{output}")
private DirectChannel output;
@Test
public void to() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
output.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
for (String h : message.getHeaders().keySet())
logger.debug(String.format("%s=%s (class: %s)", h, message.getHeaders().get(h), message.getHeaders().get(h).getClass().toString()));
}
});
messagingTemplate.send(input, MessageBuilder.withPayload("foo").build());
}
@Test
public void to() {
MessagingTemplate messagingTemplate = new MessagingTemplate();
output.subscribe(new MessageHandler() {
public void handleMessage(Message<?> message)
throws MessageRejectedException, MessageHandlingException,
MessageDeliveryException {
for (String h : message.getHeaders().keySet())
logger.debug(String.format("%s=%s (class: %s)", h, message.getHeaders().get(h), message.getHeaders().get(h).getClass().toString()));
}
});
messagingTemplate.send(input, MessageBuilder.withPayload("foo").build());
}
}

View File

@@ -24,15 +24,16 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author Mark Fisher
* @since 2.0
* @since 2.0
*/
@ContextConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
public class ConsoleChatTests {
@Test @Ignore
@Test
@Ignore
public void run() throws Exception {
Thread.sleep( 10 * 1000 );
Thread.sleep(10 * 1000);
}
}

View File

@@ -30,9 +30,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class InboundXmppEndpointTests {
@Test @Ignore
@Test
@Ignore
public void run() throws Exception {
Thread.sleep( 10 * 1000 );
Thread.sleep(10 * 1000);
}
}

View File

@@ -19,13 +19,12 @@ package org.springframework.integration.xmpp.messages;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Testing support for sending messages.
*
*
* @author Josh Long
* @since 2.0
*/
@@ -33,9 +32,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class OutboundXmppEndpointTests {
@Test @Ignore
@Test
@Ignore
public void run() throws Exception {
Thread.sleep(10 * 1000);
Thread.sleep(10 * 1000);
}
}

View File

@@ -17,7 +17,6 @@
package org.springframework.integration.xmpp.messages;
import org.jivesoftware.smack.packet.Message;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.stereotype.Component;
@@ -36,16 +35,14 @@ public class XmppMessageConsumer {
String text = null;
if (input instanceof Message) {
text = ((Message) input).getBody();
}
else if (input instanceof String) {
} else if (input instanceof String) {
text = (String) input;
}
else {
} else {
throw new IllegalArgumentException(
"expected either a Smack Message or a String, but received: " + input);
}
System.out.println("================================================================================");
System.out.println("message: " + text);
}
}
}

View File

@@ -36,13 +36,13 @@ public class XmppMessageProducer implements MessageSource<String> {
private static final Log logger = LogFactory.getLog(XmppMessageProducer.class);
private volatile int counter;
private String recipient;
private String recipient;
public void setRecipient(final String recipient) {
this.recipient = recipient;
}
public void setRecipient(final String recipient) {
this.recipient = recipient;
}
public Message<String> receive() {
public Message<String> receive() {
try {
if (counter > 10) {
logger.debug("return null");
@@ -51,10 +51,10 @@ public class XmppMessageProducer implements MessageSource<String> {
counter += 1;
Thread.sleep(1000 * 2);
String msg = "the current time is " + new Date();
String msg = "the current time is " + new Date();
logger.info("sending message to recipient " + recipient);
return MessageBuilder.withPayload(msg).setHeader(XmppHeaders.CHAT_TO_USER, recipient).build();
}
catch (InterruptedException e) {

View File

@@ -25,7 +25,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* this class demonstrates that when I launch this and then manipulate the status of the
* user using Pidgin, the updated state is immediately delivered to the Spring Integration bus.
*
*
* @author Josh Long
* @since 2.0
*/
@@ -33,9 +33,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class InboundXmppRosterEventsEndpointTests {
@Test @Ignore
@Test
@Ignore
public void run() throws Exception {
Thread.sleep( 60 * 1000);
Thread.sleep(60 * 1000);
}
}

View File

@@ -23,10 +23,8 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
*
* Tests {@link XmppRosterEventMessageSendingHandler} to ensure that we are able to publish status.
*
*
* @author Josh Long
* @since 2.0
*/
@@ -34,8 +32,9 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class OutboundXmppRosterEventsEndpointTests {
@Test @Ignore
public void testOutbound() throws Throwable {
Thread.sleep( 60 * 1000);
}
@Test
@Ignore
public void testOutbound() throws Throwable {
Thread.sleep(60 * 1000);
}
}

View File

@@ -23,11 +23,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
*
* This class will demonstrate using both inbound adapter types in a 1-2 punch of:
* <UL>
* <LI> notifying the bus of a user's sudden online availability using &lt;xmpp:roster-event-inbound-channel-adapter&gt;</LI>
* <LI> sending that user a message using the &lt;xmpp:outbound-message-channel-adapter /&gt;</LI>
* <LI> notifying the bus of a user's sudden online availability using &lt;xmpp:roster-event-inbound-channel-adapter&gt;</LI>
* <LI> sending that user a message using the &lt;xmpp:outbound-message-channel-adapter /&gt;</LI>
* </UL>
*
* @author Josh Long
@@ -37,9 +36,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
public class PresenceMessageComboTests {
@Test @Ignore
public void run () throws Throwable {
Thread.sleep( 60 * 1000);
}
@Test
@Ignore
public void run() throws Throwable {
Thread.sleep(60 * 1000);
}
}

View File

@@ -25,7 +25,7 @@ import org.springframework.integration.xmpp.XmppHeaders;
/**
* This class reacts to changes in
* {@link org.jivesoftware.smack.packet.Presence} objects for a given account.
*
*
* @author Josh Long
* @since 2.0
*/

View File

@@ -17,20 +17,17 @@
package org.springframework.integration.xmpp.presence;
import org.apache.commons.lang.StringUtils;
import org.jivesoftware.smack.packet.Presence;
import org.springframework.integration.Message;
import org.springframework.integration.core.MessageBuilder;
import org.springframework.integration.core.MessageSource;
import org.springframework.integration.mapping.*;
import org.springframework.integration.xmpp.XmppHeaders;
/**
* This is used in
* {@link org.springframework.integration.xmpp.presence.OutboundXmppRosterEventsEndpointTests}
* to produce fake status / presence updates.
*
*
* @author Josh Long
* @since 2.0
*/
@@ -47,8 +44,8 @@ public class XmppRosterEventProducer implements MessageSource<String> {
XmppHeaders.PRESENCE_MODE, Presence.Mode.chat).setHeader(XmppHeaders.PRESENCE_TYPE,
Presence.Type.available).setHeader(XmppHeaders.PRESENCE_STATUS, "She Loves me").build()
: MessageBuilder.withPayload(StringUtils.EMPTY).setHeader(XmppHeaders.PRESENCE_MODE, Presence.Mode.dnd)
.setHeader(XmppHeaders.PRESENCE_TYPE, Presence.Type.available).setHeader(
XmppHeaders.PRESENCE_STATUS, "She Loves me not").build();
.setHeader(XmppHeaders.PRESENCE_TYPE, Presence.Type.available).setHeader(
XmppHeaders.PRESENCE_STATUS, "She Loves me not").build();
}
}