Code Search for Developers
 
 
  

TimingParserTest.java from Tea Stats at Krugle


Show TimingParserTest.java syntax highlighted

/*
 * This file is distributed under the GPL v2 as part of teastats site statistics package
 * http://teastats.sourceforge.net
 */
package net.time4tea.webstats.parser;

import org.jmock.Mock;
import org.jmock.MockObjectTestCase;

/**
 * $$Header$
 * Initially by: james on 30-Jul-2006
 */
public class TimingParserTest extends MockObjectTestCase {
    public Mock mockParser;
    public TimingParser timingParser;

    public void testCallsUnderlyingParser() throws Exception {
        mockParser.expects(once()).method("parseLine");
        timingParser.parseLine("foo");
    }

    public void testCanCountLinesParsed() throws Exception {
        mockParser.expects(once()).method("parseLine");
        mockParser.expects(once()).method("parseLine");

        assertEquals(0, timingParser.getCount());
        assertEquals(0, timingParser.getTotalTime());

        timingParser.parseLine("foo");

        assertEquals(1, timingParser.getCount());
        long totalTime = timingParser.getTotalTime();

        assertTrue(totalTime > 0);

        timingParser.parseLine("foo");
        assertEquals(2, timingParser.getCount());
        assertTrue(timingParser.getTotalTime() > totalTime);

    }


    protected void setUp() throws Exception {
        super.setUp();
        mockParser = mock(LogParser.class);
        timingParser = new TimingParser((LogParser) mockParser.proxy());
    }
}




See more files for this project here

Tea Stats

Web log analyzer... Written in OO Perl, provides the usual host / page analysis. Can also do site graphing using graphviz, browser, os, worm and search engine identification, and country and session tracking.

Project homepage: http://sourceforge.net/projects/teastats
Programming language(s): Java
License: other

  CommonLogParser.java
  LogParser.java
  ParseException.java
  RegexCommonLogParser.java
  TimingParser.java
  TimingParserTest.java