package tigase.muc;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.junit.Before;

import tigase.test.junit.JUnitXMLIO;
import tigase.test.junit.XMPPTestCase;
import tigase.xml.Element;
import tigase.xmpp.PacketErrorTypeException;

public class RoomTest extends XMPPTestCase {

	@Before
	public void init() {
		muc = new MUCComponent();
		Map<String, Object> props = new HashMap<String, Object>();
		props.put("admin", new String[] { "alice@localhost" });
		props.put("pubsub-repo-class", "tigase.db.xml.XMLRepository");
		props.put("pubsub-repo-url", "user-repository.xml");
		props.put("max-queue-size", new Integer(1000));

		muc.setProperties(props);
	}

	private MUCComponent muc;

	@org.junit.Test
	public void test_pings() {
		JUnitXMLIO xmlio = new JUnitXMLIO() {

			@Override
			public void write(Element data) throws IOException {
				try {
					send(muc.process(data));
				} catch (PacketErrorTypeException e) {
					throw new RuntimeException("", e);
				}
			}

			@Override
			public void close() {
				// TODO Auto-generated method stub

			}
		};
		test("src/test/scripts/ping.cor", xmlio);
	}

}

@@ -312,16 +312,44 @@
 Case %7B%0A%0A
+%09private JUnitXMLIO xmlio;%0A%0A
 %09@Before
@@ -349,16 +349,16 @@
 @Before%0A
-
 %09public 
@@ -695,124 +695,8 @@
 %0A%0A%09%09
-muc.setProperties(props);%0A%09%7D%0A%0A%09private MUCComponent muc;%0A%0A%09@org.junit.Test%0A%09public void test_pings() %7B%0A%09%09JUnitXMLIO 
 xmli
@@ -1010,12 +1010,118 @@
 %09%09%7D%0A
-
 %09%09%7D;
+%0A%0A%09%09muc.setProperties(props);%0A%09%7D%0A%0A%09private MUCComponent muc;%0A%0A%09@org.junit.Test%0A%09public void test_pings() %7B
 %0A%09%09t

fix minor bug in test