/** 
 * 
 * Copyright 2005 Protique Ltd
 * 
 * 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.activemq.transport.jabber;

import junit.framework.TestCase;
import org.activemq.broker.BrokerContainer;
import org.activemq.broker.impl.BrokerContainerImpl;
import org.jivesoftware.smack.Chat;
import org.jivesoftware.smack.XMPPConnection;

/**
 * @version $Revision: 1.1 $
 */
public class JabberTransportTest extends TestCase {
    private XMPPConnection xmppConnection;
    private BrokerContainer brokerContainer;

    public void testSendJabberQueueMessage() throws Exception {
        Chat chat = xmppConnection.createChat("jdoe@jabber.org");
        chat.sendMessage("Hey, how's it going?");
    }

    protected void setUp() throws Exception {
        brokerContainer = new BrokerContainerImpl();
        brokerContainer.addConnector("jabber://localhost:61606");
        //brokerContainer.addConnector("tcp://localhost:61616");
        brokerContainer.start();

        xmppConnection = new XMPPConnection("localhost", 61606);
        xmppConnection.login("jsmith", "mypass");
    }

    protected void tearDown() throws Exception {
        xmppConnection.close();
        brokerContainer.stop();
    }

}
