Examples of nextCommand()


Examples of pygmy.nntp.NntpRequest.nextCommand()

        NntpRequest request = new NntpRequest( null, new Properties(), new ByteArrayInputStream( buffer.toString().getBytes() ) );
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        NntpResponse response = new NntpResponse( baos );
        forum.createNewsgroup("comp.lang.java.programmer");

        request.nextCommand();
        NewsHandler handler = new NewsHandler( forum );
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
//        System.out.println( baos.toString() );
        assertTrue( "Assert the response asked to send the article", baos.toString().startsWith("335 send article to be transferred.  End with <CR-LF>.<CR-LF>") );
        assertEquals( "Assert the forum size has increased by one.", 1, forum.getNewsgroup( "comp.lang.java.programmer" ).size() );
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

//        System.out.println( baos.toString() );
        assertTrue( "Assert the response asked to send the article", baos.toString().startsWith("335 send article to be transferred.  End with <CR-LF>.<CR-LF>") );
        assertEquals( "Assert the forum size has increased by one.", 1, forum.getNewsgroup( "comp.lang.java.programmer" ).size() );
        assertTrue( "Assert the response received the article.", baos.toString().indexOf( "235 article transferred ok" ) >= 0 );

        request.nextCommand();
        baos.reset();
        assertTrue( "Assert that the handler handled the request.", handler.handleNntp( request, response ) );
        assertTrue( "Assert the response denied the article", baos.toString().startsWith("435 article not wanted - do not send i") );

        forum.addArticle( NntpTestUtil.createArticle("test.eml"), "localhost" );
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        buffer.append("article <foo>");
        buffer.append( Http.CRLF );
        buffer.append("foo bar baz");
        buffer.append( Http.CRLF );
        NntpRequest request = createNntpRequest(buffer);
        request.nextCommand();
        assertEquals( "list", request.getCommand() );
        assertEquals( 0, request.parameterLength() );
        assertNull( request.getParameter(0) );

        request.nextCommand();
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        request.nextCommand();
        assertEquals( "list", request.getCommand() );
        assertEquals( 0, request.parameterLength() );
        assertNull( request.getParameter(0) );

        request.nextCommand();
        assertEquals( "article", request.getCommand() );
        assertEquals( 1, request.parameterLength() );
        assertEquals( "<foo>", request.getParameter(0) );

        request.nextCommand();
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        request.nextCommand();
        assertEquals( "article", request.getCommand() );
        assertEquals( 1, request.parameterLength() );
        assertEquals( "<foo>", request.getParameter(0) );

        request.nextCommand();
        assertEquals( "foo", request.getCommand() );
        assertEquals( 2, request.parameterLength() );
        assertEquals( "bar", request.getParameter(0) );
        assertEquals( "baz", request.getParameter(1) );
    }
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

    public void testIsDone() throws IOException {
        StringBuffer buffer = new StringBuffer();
        buffer.append("quit");
        buffer.append( Http.CRLF );
        NntpRequest request = createNntpRequest(buffer);
        request.nextCommand();
        assertEquals( "quit", request.getCommand() );
        assertTrue( request.isDone() );
    }

    public void testGetCurrentNewsgroup() throws IOException, NoCurrentNewsgroupException, NoCurrentArticleException {
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        buffer.append(Http.CRLF);
        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");
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        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();
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        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();
View Full Code Here

Examples of pygmy.nntp.NntpRequest.nextCommand()

        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 );
    }

    public static Test suite() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.