Package pygmy.nntp

Examples of pygmy.nntp.NewsGroup


        }
    }

    public void testCreateNewsgroup() throws Exception {
        String name = "comp.lang.java";
        NewsGroup group = forum.createNewsgroup(name);
        assertEquals( name, group.getName() );

        NewsGroup sameGroup = forum.getNewsgroup( group.getName() );
        assertEquals( group.getName(), sameGroup.getName() );
        assertEquals( group.getFirstIndex(), sameGroup.getFirstIndex() );
        assertEquals( group.getLastIndex(), sameGroup.getLastIndex() );
        assertEquals( group.size(), sameGroup.size() );
    }
View Full Code Here


        assertEquals( group.size(), sameGroup.size() );
    }

    public void testAddArticle() throws Exception {
        String name = "comp.lang.java.programmer";
        NewsGroup group = forum.createNewsgroup(name);
        Article article = NntpTestUtil.createArticle("test.eml");
        forum.addArticle( article, "foo");
        File repository = forum.getArticleRepository();

        File[] list = repository.listFiles();
        assertEquals( NntpUtil.base64Encode( article.getMessageId() ), list[0].getName() );
        assertEquals( 1, group.size() );
    }
View Full Code Here

    }

    public void testGetMessageSince() {
        String groups[] = createSomeNewsGroups();

        NewsGroup group = forum.getNewsgroup( groups[0] );
        group.getDirectory().setLastModified( 1L );

        List list = forum.getNewsgroups( new Date(0), null );
        assertEquals( "Assert we get all the groups", groups.length, list.size() );

        list = forum.getNewsgroups( new Date(2), null );
        assertEquals( "Assert we get all the groups but the first", groups.length - 1, list.size() );
        for (int it = 0; it < list.size(); it++) {
            NewsGroup newsgroup = (NewsGroup) list.get(it);
            assertNewsGroupContained(groups, newsgroup);
        }

        list = forum.getNewsgroups( new Date(2), new String[] { "comp." } );
        assertEquals( "Assert we get only comp.lang.ada", 1, list.size() );
View Full Code Here

        buffer.append("<table width=\"100%\" cellspacing=\"0\" cellpadding=\"3\" border=\"0\" >\n");
        addTableRow( "navigationbar" );
        addTableColumn( "<b><font class=\"title\">Forums</font></b>", null, "align=\"left\" colspan=\"2\"" );
        tableRowEnd();
        for( Iterator i = forum.newsgroupIterator(); i.hasNext(); ) {
            NewsGroup t = (NewsGroup) i.next();
            addTableRow( "tableheader" );
            buffer.append( "\n<td align=\"center\" valign=\"top\">" );
            buffer.append( createIcon( request.createUrl("/linkOpaque.gif"), 6, 11 ) );
            buffer.append( "</td>\n" );
            buffer.append( "\n<td nowrap align=\"left\"><p><small>");
//            createLink( t.getName(), getForumUrl( t.getUrl() ), null );
            buffer.append( "<br>&nbsp;&nbsp;created by ");
//            buffer.append( t.getCreator() );
            buffer.append( "<br>&nbsp;&nbsp;");
            buffer.append( t.size() );
            buffer.append( " Messages" );
            buffer.append( "<br>&nbsp;&nbsp;last modified (" );
            buffer.append( t.getLastModified() );
            buffer.append( ")" );
            buffer.append( "</small></p></td>\n" );
            tableRowEnd();
        }
        buffer.append("</table>\n");
View Full Code Here

            System.out.println("Directory was not deleted!: " + directory.getAbsolutePath() );
        }
    }

    public static NewsGroup createNewsGroup( String name ) {
        NewsGroup group = new NewsGroup( new File( System.getProperty("nntp.root"), name ), name );
        return group;
    }
View Full Code Here

TOP

Related Classes of pygmy.nntp.NewsGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.