Show
Ignore:
Timestamp:
08/10/08 10:29:34 AM (5 months ago)
Author:
octorian
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/LogicMail-1.0/LogicMailTests/src/org/logicprobe/LogicMail/mail/imap/ImapProtocolTest.java

    r247 r268  
    182182    } 
    183183     
    184     public void testExecuteList() { 
     184    public void testExecuteList1() { 
    185185        try { 
    186186            // Test top-level inbox 
     
    199199            assertEquals(".", result1.delim); 
    200200            assertEquals("INBOX", result1.name); 
    201              
     201        } catch (Throwable t) { 
     202            fail("Exception thrown during test: "+t.toString()); 
     203            t.printStackTrace(); 
     204        } 
     205    } 
     206     
     207    public void testExecuteList2() { 
     208        try { 
    202209            // Test subfolders of inbox 
    203210            instance.addExecuteExpectation( 
     
    208215                    }); 
    209216         
    210             result = instance.executeList("INBOX.", "%"); 
     217            Vector result = instance.executeList("INBOX.", "%"); 
    211218            assertNotNull(result); 
    212219            assertEquals(2, result.size()); 
    213220            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    214221            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    215             result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
     222            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    216223            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
    217224 
     
    227234            assertEquals(".", result2.delim); 
    228235            assertEquals("INBOX.Sent", result2.name); 
    229  
     236        } catch (Throwable t) { 
     237            fail("Exception thrown during test: "+t.toString()); 
     238            t.printStackTrace(); 
     239        } 
     240    } 
     241     
     242    public void testExecuteList3() { 
     243        try { 
    230244            // Test inbox with a NIL delimiter 
    231245            instance.addExecuteExpectation( 
     
    235249                        "* LIST (\\HasNoChildren) \"/\" Sent" 
    236250                    }); 
    237             result = instance.executeList("", "%"); 
     251            Vector result = instance.executeList("", "%"); 
    238252            assertNotNull(result); 
    239253            assertEquals(2, result.size()); 
    240254            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    241255            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    242             result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    243             result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     256            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
     257            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
    244258 
    245259            assertTrue(!result1.hasChildren); 
     
    254268            assertEquals("/", result2.delim); 
    255269            assertEquals("Sent", result2.name); 
    256              
     270        } catch (Throwable t) { 
     271            fail("Exception thrown during test: "+t.toString()); 
     272            t.printStackTrace(); 
     273        } 
     274    } 
     275     
     276    public void testExecuteList4() { 
     277        try { 
    257278            // Test parameter in response 
    258279            instance.addExecuteExpectation( 
     
    264285                    }); 
    265286             
    266             result = instance.executeList("INBOX.", "%"); 
     287            Vector result = instance.executeList("INBOX.", "%"); 
    267288            assertNotNull(result); 
    268289            assertEquals(2, result.size()); 
    269290            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    270291            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    271             result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    272             result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     292            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
     293            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
    273294 
    274295            assertTrue(!result1.hasChildren); 
     
    283304            assertEquals(".", result2.delim); 
    284305            assertEquals("INBOX.Sent", result2.name); 
    285  
     306        } catch (Throwable t) { 
     307            fail("Exception thrown during test: "+t.toString()); 
     308            t.printStackTrace(); 
     309        } 
     310    } 
     311     
     312    public void testExecuteList5() { 
     313        try { 
    286314            // Test escaped delimiter 
    287315            instance.addExecuteExpectation( 
    288                     "LIST", "\"INBOX\\\" \"%\"", 
     316                    "LIST", "\"INBOX\\\\\" \"%\"", 
    289317                    new String[] { 
    290318                        "* LIST (\\HasNoChildren) \"\\\\\" \"INBOX\\Saved\\Stuff\"", 
     
    292320                    }); 
    293321             
    294             result = instance.executeList("INBOX\\", "%"); 
     322            Vector result = instance.executeList("INBOX\\", "%"); 
    295323            assertNotNull(result); 
    296324            assertEquals(2, result.size()); 
    297325            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    298326            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    299             result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    300             result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     327            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
     328            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
    301329 
    302330            assertTrue(!result1.hasChildren); 
     
    311339            assertEquals("\\", result2.delim); 
    312340            assertEquals("INBOX\\Sent", result2.name); 
    313              
     341        } catch (Throwable t) { 
     342            fail("Exception thrown during test: "+t.toString()); 
     343            t.printStackTrace(); 
     344        } 
     345    } 
     346     
     347    public void testExecuteList6() { 
     348        try { 
    314349            // Test specified-length encoding for path name 
    315350            instance.addExecuteExpectation( 
    316                     "LIST", "\"2007\\\" \"%\"", 
     351                    "LIST", "\"2007\\\\\" \"%\"", 
    317352                    new String[] { 
    318353                        "* LIST (\\HasNoChildren) \"\\\\\" {12}", 
     
    322357                    }); 
    323358 
    324             result = instance.executeList("2007\\", "%"); 
     359            Vector result = instance.executeList("2007\\", "%"); 
    325360            assertNotNull(result); 
    326361            assertEquals(2, result.size()); 
    327362            assertTrue(result.elementAt(0) instanceof ImapProtocol.ListResponse); 
    328363            assertTrue(result.elementAt(1) instanceof ImapProtocol.ListResponse); 
    329             result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
    330             result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
     364            ImapProtocol.ListResponse result1 = (ImapProtocol.ListResponse)result.elementAt(0); 
     365            ImapProtocol.ListResponse result2 = (ImapProtocol.ListResponse)result.elementAt(1); 
    331366 
    332367            assertTrue(!result1.hasChildren); 
     
    341376            assertEquals("\\", result2.delim); 
    342377            assertEquals("2007\\Q4-2007", result2.name); 
    343              
    344378        } catch (Throwable t) { 
    345379            fail("Exception thrown during test: "+t.toString()); 
     
    550584        suite.addTest(new ImapProtocolTest("executeNamespace", new TestMethod() 
    551585        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteNamespace(); } })); 
    552         suite.addTest(new ImapProtocolTest("executeList", new TestMethod() 
    553         { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList(); } })); 
     586        suite.addTest(new ImapProtocolTest("executeList1", new TestMethod() 
     587        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList1(); } })); 
     588        suite.addTest(new ImapProtocolTest("executeList2", new TestMethod() 
     589        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList2(); } })); 
     590        suite.addTest(new ImapProtocolTest("executeList3", new TestMethod() 
     591        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList3(); } })); 
     592        suite.addTest(new ImapProtocolTest("executeList4", new TestMethod() 
     593        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList4(); } })); 
     594        suite.addTest(new ImapProtocolTest("executeList5", new TestMethod() 
     595        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList5(); } })); 
     596        suite.addTest(new ImapProtocolTest("executeList6", new TestMethod() 
     597        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteList6(); } })); 
    554598        suite.addTest(new ImapProtocolTest("executeFetchEnvelope1", new TestMethod() 
    555599        { public void run(TestCase tc) {((ImapProtocolTest)tc).testExecuteFetchEnvelope1(); } }));