Save This Page
Home » dom4j-1.6.1 » org.dom4j » [javadoc | source]
org.dom4j
public class: ThreadingTest [javadoc | source]
java.lang.Object
   junit.framework.TestCase
      org.dom4j.AbstractTestCase
         org.dom4j.ThreadingTest
A test harness to test the dom4j package in a threaded environment
Fields inherited from org.dom4j.AbstractTestCase:
document
Constructor:
 public ThreadingTest(String name) 
Method from org.dom4j.ThreadingTest Summary:
fetchValue,   main,   makeRepeatedLoadTest,   suite,   testCombo,   testQNameCache
Methods from org.dom4j.AbstractTestCase:
assertDocumentsEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqual,   assertNodesEqualContent,   getDocument,   getDocument,   getDocument,   getFile,   getRootElement,   log,   setUp
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.dom4j.ThreadingTest Detail:
 public String fetchValue(QName qn) 
    This method creates a value that can be expected during a test
 public static  void main(String[] args) 
 protected static Test makeRepeatedLoadTest(int users,
    int iterations,
    String testMethod) 
    JUnit method to exercise test via threads and loops
 public static Test suite() 
    Assembles and returns a test suite.
 public  void testCombo() 
    This test combines many different types of operations on DOM4J in a threaded environment. If a problem occurs with threading, the tests will fail. This was used to help isolate an internal threading issue. Unfortunately it may not always create the condition necessary to break un-thread-safe code. This is due to the nature of the machine, JVM, and application and if the conditions are right. Typically the problems of multithreading occur due to an unprotected HashMap or ArrayList in a class being used by more than one thread. Also, most developers think that their class or object instance will only be used by one thread. But if a factory or singleton caches a class or instance, it can quickly become an unsafe environment. Hence this test to assist in locating threading issues.
 public  void testQNameCache() 
    This test isolates QNameCache in a multithreaded environment.