com.sun.labs.minion.test.regression
Class MPIndexTest

java.lang.Object
  extended by com.sun.labs.minion.test.regression.MPIndexTest

public class MPIndexTest
extends java.lang.Object

Multi-threaded index and test. Indexes a directory of documents, using a config file with multiple pipleines, then inverts the index into an output directory and compares against the original files.


Field Summary
protected static java.lang.String charEnc
          The character encoding
protected  java.lang.String cmFile
          The filename of the configuration file if provided on the command line args
protected  java.io.File documentDirectory
          The directory containing the documents to be indexed
protected  SearchEngineImpl engine
          A search engine
protected  java.lang.String indexDir
          The directory to contain the index
protected  java.util.logging.Logger logger
          The log onto which messages should be written
protected static java.lang.String logTag
          Tag for the log
protected  java.io.File outputDirectory
          The directory into which the de-indexed files should be written
 
Constructor Summary
MPIndexTest()
          Default contructor.
MPIndexTest(java.lang.String indexDir, java.lang.String cmFile, java.lang.String dDir, java.lang.String oDir)
          Create a new instance of the test class
 
Method Summary
protected  void createSearchEngine(java.lang.String cmFile, java.lang.String indexDir)
          Creates a new instance of a search engines and assigns it to the field
protected  void diff()
          Compares the files in the output directory to the document directory.
protected  boolean diff(java.lang.String filename)
          Compare one file with another and return a result indicating if they are the same.
protected  void invert()
          Takes the index and reproduces the documents that produced it.
The documents are reproduced into the output directory, with any files already there being deleted.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

charEnc

protected static java.lang.String charEnc
The character encoding


logTag

protected static java.lang.String logTag
Tag for the log


logger

protected java.util.logging.Logger logger
The log onto which messages should be written


documentDirectory

protected java.io.File documentDirectory
The directory containing the documents to be indexed


engine

protected SearchEngineImpl engine
A search engine


outputDirectory

protected java.io.File outputDirectory
The directory into which the de-indexed files should be written


indexDir

protected java.lang.String indexDir
The directory to contain the index


cmFile

protected java.lang.String cmFile
The filename of the configuration file if provided on the command line args

Constructor Detail

MPIndexTest

public MPIndexTest(java.lang.String indexDir,
                   java.lang.String cmFile,
                   java.lang.String dDir,
                   java.lang.String oDir)
            throws java.io.FileNotFoundException
Create a new instance of the test class

Parameters:
indexDir - the location of the index directory
cmFile - the file name for the configuration file
dDir - the name of the document directory
oDir - the name of the output directory
Throws:
java.io.FileNotFoundException

MPIndexTest

public MPIndexTest()
Default contructor. Sets up the index inverter

Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args -

invert

protected void invert()
               throws java.io.IOException
Takes the index and reproduces the documents that produced it.
The documents are reproduced into the output directory, with any files already there being deleted.

Throws:
java.io.IOException

diff

protected boolean diff(java.lang.String filename)
                throws java.io.IOException
Compare one file with another and return a result indicating if they are the same.

Parameters:
filename - the name of the file to compare
Returns:
a boolean, true if the files are equal
Throws:
java.io.IOException

diff

protected void diff()
             throws java.io.IOException
Compares the files in the output directory to the document directory.

Throws:
java.io.IOException

createSearchEngine

protected void createSearchEngine(java.lang.String cmFile,
                                  java.lang.String indexDir)
Creates a new instance of a search engines and assigns it to the field