Package pygmy.nntp

Examples of pygmy.nntp.GroupHandler


        NntpRequest request = new NntpRequest( null, new Properties(), new ByteArrayInputStream( buffer.toString().getBytes() ) );
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        NntpResponse response = new NntpResponse( baos );

        request.nextCommand();
        GroupHandler handler = new GroupHandler( forum );
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("215 list of newsgroups follows" + Http.CRLF + ".") >= 0 );

        forum.createNewsgroup("comp.lang.java");
        forum.createNewsgroup("comp.lang.ada").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        forum.createNewsgroup("rec.music.makers").addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("215 list of newsgroups follows") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("211 0 2147483647 0 comp.lang.java") >= 0 );

        baos.reset();
        request.nextCommand();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( baos.toString().indexOf("411 no such news group") >= 0 );
    }
View Full Code Here

TOP

Related Classes of pygmy.nntp.GroupHandler

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.