Show
Ignore:
Timestamp:
01/12/09 08:49:32 (20 months ago)
Author:
jmoore
Message:

OmeroClustering : Minor Ring changes before moving to jdbc

(cherry picked from commit e149432bb345abc61f7be7c01fbca64848e553e2)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/components/blitz/test/ome/services/blitz/test/utests/RingTest.java

    r3243 r3264  
    77package ome.services.blitz.test.utests; 
    88 
    9 import junit.framework.TestCase; 
    109import ome.services.blitz.fire.Ring; 
    1110 
    1211import org.jgroups.blocks.ReplicatedTree; 
     12import org.jmock.Mock; 
     13import org.jmock.MockObjectTestCase; 
    1314import org.testng.annotations.AfterClass; 
    1415import org.testng.annotations.BeforeClass; 
     16import org.testng.annotations.BeforeTest; 
    1517import org.testng.annotations.Test; 
    1618 
     
    1921 * @since Beta4 
    2022 */ 
    21 public class RingTest extends TestCase { 
     23public class RingTest extends MockObjectTestCase { 
    2224 
    23     // Using tree directly since the ring hides it 
    2425    ReplicatedTree tree1, tree2; 
     26    Ice.Communicator ic; 
     27    Mock mockIc;  
    2528     
    2629    @BeforeClass 
     
    3033        tree1.start(); 
    3134        tree2.start(); 
     35    } 
     36     
     37    @BeforeTest 
     38    public void setupMethod() throws Exception { 
     39        mockIc = mock(Ice.Communicator.class); 
     40        ic = (Ice.Communicator) mockIc.proxy(); 
    3241    } 
    3342     
     
    4150    public void testMain() throws Exception { 
    4251        Ring.main(new String[]{}); 
     52    } 
     53     
     54    @Test 
     55    public void testFirstTakesOver() throws Exception { 
     56        Ring one = new Ring("takeover", "session_ring.xml"); 
     57        one.init(ic, "one"); 
     58        assertEquals("one", one.getRedirect()); 
     59        Ring two = new Ring("takeover", "session_ring.xml"); 
     60        two.init(ic, "two"); 
     61        assertEquals("one", two.getRedirect()); 
     62    } 
     63 
     64    @Test 
     65    public void testSeveralThreadsStartAndOnlyOneValueIsSet() throws Exception { 
     66        fail(); 
     67    } 
     68     
     69    @Test 
     70    public void testHandlesMissingServers() throws Exception { 
     71        fail(); 
     72    } 
     73     
     74    @Test 
     75    public void testRemovesUnreachable() throws Exception { 
     76        fail(); 
     77    } 
     78     
     79    @Test 
     80    public void testReaddsSelfIfTemporarilyUnreachable() throws Exception { 
     81        fail(); 
    4382    } 
    4483     
     
    64103        Ring ring = new Ring("test", "session_ring.xml"); 
    65104        ring.printTree("/SESSIONS"); 
     105        ring.destroy(); 
    66106    } 
    67107 

1.2.1-PRO © 2008-2009 agile42 all rights reserved (this page was served in: 0.86831 sec.)