git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@822231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-10-06 11:57:04 +00:00
parent bfed2c0e00
commit 869401136e
3 changed files with 19 additions and 11 deletions

View File

@ -85,8 +85,9 @@ public class StompTest extends CombinationTestSupport {
+ "}}"; + "}}";
protected void setUp() throws Exception { protected void setUp() throws Exception {
// The order of the entries is different when using the ibm jdk. // The order of the entries is different when using ibm jdk 5.
if (System.getProperty("java.vendor").equals("IBM Corporation")) { if (System.getProperty("java.vendor").equals("IBM Corporation")
&& System.getProperty("java.version").startsWith("1.5")) {
xmlMap = "<map>\n" xmlMap = "<map>\n"
+ " <entry>\n" + " <entry>\n"
+ " <string>city</string>\n" + " <string>city</string>\n"

View File

@ -145,15 +145,13 @@
<dependency> <dependency>
<groupId>jivesoftware</groupId> <groupId>jivesoftware</groupId>
<artifactId>smack</artifactId> <artifactId>smack</artifactId>
<version>1.5.0</version> <version>3.1.0</version>
<!--<version>2.2.1</version>-->
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jivesoftware</groupId> <groupId>jivesoftware</groupId>
<artifactId>smackx</artifactId> <artifactId>smackx</artifactId>
<version>1.5.0</version> <version>3.1.0</version>
<!--<version>2.2.1</version>-->
</dependency> </dependency>
<dependency> <dependency>

View File

@ -19,8 +19,11 @@ package org.apache.activemq.transport.xmpp;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.textui.TestRunner; import junit.textui.TestRunner;
import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.MessageListener;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.Message;
/** /**
* @version $Revision$ * @version $Revision$
@ -37,21 +40,27 @@ public class XmppTest extends TestCase {
} }
public void testConnect() throws Exception { public void testConnect() throws Exception {
// ConnectionConfiguration config = new ConnectionConfiguration config = new
// ConnectionConfiguration("localhost", 61222); ConnectionConfiguration("localhost", 61222);
// config.setDebuggerEnabled(true); // config.setDebuggerEnabled(true);
try { try {
// SmackConfiguration.setPacketReplyTimeout(1000); // SmackConfiguration.setPacketReplyTimeout(1000);
// XMPPConnection con = new XMPPConnection(config); XMPPConnection con = new XMPPConnection(config);
XMPPConnection con = new XMPPConnection("localhost", 61222); con.connect();
con.login("amq-user", "amq-pwd"); con.login("amq-user", "amq-pwd");
Chat chat = con.createChat("test@localhost"); Chat chat = con.getChatManager().createChat("test@localhost",
new MessageListener() {
public void processMessage(Chat chat, Message message) {
//
}
});
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
System.out.println("Sending message: " + i); System.out.println("Sending message: " + i);
chat.sendMessage("Hello from Message: " + i); chat.sendMessage("Hello from Message: " + i);
} }
System.out.println("Sent all messages!"); System.out.println("Sent all messages!");
con.disconnect();
} catch (XMPPException e) { } catch (XMPPException e) {
if (block) { if (block) {
System.out.println("Caught: " + e); System.out.println("Caught: " + e);