1 7 package org.jboss.cache.tests.lock; 8 9 import junit.framework.TestCase; 10 import org.jboss.cache.lock.LockMap; 11 12 15 public class LockMapTest extends TestCase 16 { 17 private LockMap map_; 18 19 24 public LockMapTest(String arg0) 25 { 26 super(arg0); 27 } 28 29 public static void main(String [] args) 30 { 31 junit.textui.TestRunner.run(LockMapTest.class); 32 } 33 34 37 protected void setUp() throws Exception 38 { 39 super.setUp(); 40 map_ = new LockMap(); 41 } 42 43 46 protected void tearDown() throws Exception 47 { 48 super.tearDown(); 49 map_.removeAll(); 50 } 51 52 final public void testIsOwner() 53 { 54 map_.addReader(this); 55 assertTrue(map_.isOwner(this, LockMap.OWNER_READ)); 56 map_.addWriter(this); 57 assertTrue(map_.isOwner(this, LockMap.OWNER_WRITE)); 58 assertTrue(map_.isOwner(this, LockMap.OWNER_ANY)); 59 map_.removeAll(); 60 } 61 62 final public void testAddReader() 63 { 64 map_.addReader(this); 65 assertTrue(map_.readerOwners().contains(this)); 66 map_.removeReader(this); 67 } 68 69 final public void testAddWriter() 70 { 71 map_.addWriter(this); 72 assertTrue(map_.writerOwner().equals(this)); 73 map_.removeWriter(this); 74 } 75 76 } 77 | Popular Tags |