Commit 76dcf0ce authored by Bill Lynch's avatar Bill Lynch Committed by bill

Initial checkin


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@70 b35dd754-fafc-0310-a699-88a17e54d16e
parent 4d43f1ec
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
package org.jivesoftware.util;
import junit.framework.TestCase;
import java.util.BitSet;
/**
* Test the standard with an emphasis on making it work with our scheduler.
*
* @author Iain Shigeoka
*/
public class BitSetTest extends TestCase {
/**
* Create a test case with a given name.
*
* @param name The name of the test
*/
public BitSetTest (String name){
super(name);
}
/**
* Test storage and retrieval of a bit set
*/
public void testStorage(){
BitSet bits = new BitSet();
}
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
package org.jivesoftware.util;
import junit.framework.TestCase;
/**
* Test the CircularLinkedList with an emphasis on making it work with RoundRobinDispatcher.
*
* @author Iain Shigeoka
*/
public class CircularLinkedListTest extends TestCase {
/**
* Create a test case with a given name.
*
* @param name The name of the test
*/
public CircularLinkedListTest (String name){
super(name);
}
CircularLinkedList list;
Character A = new Character('A');
Character B = new Character('B');
Character C = new Character('C');
protected void setUp() throws Exception {
list = new CircularLinkedList(new Character('A'));
list.add(new Character('B'));
list.next(); // Must setup list of A, B, C. Without this call, it would be A, C, B.
list.add(new Character('C'));
list.next(); // set the counter to A again
}
/**
* Test iteration through a list
*/
public void testNext(){
assertEquals(A,list.next());
assertEquals(B,list.next());
assertEquals(C,list.next());
assertEquals(A,list.next());
}
/**
* <p>Test behavior of the pass count and iteration: what is next() after passcount increments (same or next)?</li>
*/
public void testPassNext(){
while (!list.next().equals(C)){
// wind the list to A
}
list.mark(); // mark list with the next being A
while (list.getPassCount() < 1){
list.next();
}
// One spin around the list should make A the next again
assertEquals(A,list.next());
}
/**
* Tests the ability of the circular list to maintain pass counts
*/
public void testPassCount(){
list.mark();
for (int i = 0; i < 3; i ++){
assertEquals(0,list.getPassCount());
list.next();
}
assertEquals(1,list.getPassCount());
list.mark();
for (int i = 0; i < 10; i ++){
list.next();
}
assertEquals(3,list.getPassCount());
}
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
package org.jivesoftware.util;
import junit.framework.TestCase;
/**
* Simple test of the int enum class.
*
* @author Iain Shigeoka
*/
public class IntEnumTest extends TestCase {
/**
* Create a test case with a given name.
*
* @param name The name of the test
*/
public IntEnumTest (String name){
super(name);
}
static public class TestIntEnum extends IntEnum{
public TestIntEnum(String name, int value){
super(name,value);
register(this);
}
public static TestIntEnum getTypeFromInt(int value){
return (TestIntEnum) getEnumFromInt(TestIntEnum.class,value);
}
}
/**
* Tests the IntEnum's enforcement of unique int values for each enum type
*/
public void testStaticEnumUniqueEnforcement(){
IntEnum e = new IntEnum("plain",1);
IntEnum.register(e);
new TestIntEnum("test",1); // auto registers the same value - does it clash with super class?
assertEquals("plain",IntEnum.getEnumFromInt(IntEnum.class,1).getName());
assertEquals("test",TestIntEnum.getTypeFromInt(1).getName());
}
}
\ No newline at end of file
/**
* $RCSfile$
* $Revision$
* $Date$
*
* Copyright (C) 1999-2003 CoolServlets, Inc. All rights reserved.
*
* This software is the proprietary information of CoolServlets, Inc.
* Use is subject to license terms.
*/
package org.jivesoftware.util;
import junit.framework.TestCase;
import org.dom4j.Document;
import java.io.FileReader;
import java.io.FileWriter;
/**
* <p>Test the writing of dom4j documents using the XPP serializer.</p>
*
* @author Iain Shigeoka
*/
public class XPPWriterTest extends TestCase {
/**
* <p>Create a new test with the given name.</p>
*
* @param name The name of the test
*/
public XPPWriterTest(String name){
super(name);
}
/**
* <p>Run a standard config document through a round trip and compare.</p>
*/
public void testRoundtrip(){
try {
Document doc = XPPReader.parseDocument(new FileReader("../config/jive-messenger.xml"),this.getClass());
XPPWriter.write(doc, new FileWriter("../config/xmpp_writer_test_copy.xml"));
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment