Class TestSupport

java.lang.Object
org.apache.maven.index.reader.TestSupport
Direct Known Subclasses:
ChunkReaderTest, IndexReaderTest, IndexWriterTest, TransformTest

public class TestSupport extends Object
Test support.
  • Field Details

    • testName

      public org.junit.rules.TestName testName
  • Constructor Details

    • TestSupport

      public TestSupport()
  • Method Details

    • setup

      public void setup() throws IOException
      Creates the temp directory and list for resource handlers.
      Throws:
      IOException
    • cleanup

      public void cleanup() throws IOException
      Closes all the registered resources handlers and deletes the temp directory.
      Throws:
      IOException
    • createTempFile

      protected File createTempFile(String name) throws IOException
      Creates a temp file within tempDir with given name.
      Throws:
      IOException
    • createTempDirectory

      protected File createTempDirectory() throws IOException
      Creates a temp directory within tempDir.
      Throws:
      IOException
    • createWritableResourceHandler

      protected org.apache.maven.index.reader.WritableResourceHandler createWritableResourceHandler() throws IOException
      Creates an empty DirectoryResourceHandler.
      Throws:
      IOException
    • testResourceHandler

      protected DirectoryResourceHandler testResourceHandler(String name) throws IOException
      Creates a "test" ResourceHandler that contains predefined files, is mapped to test resources under given name.
      Throws:
      IOException
    • loadRecordsByType

      protected Map<org.apache.maven.index.reader.Record.Type,List<org.apache.maven.index.reader.Record>> loadRecordsByType(org.apache.maven.index.reader.ChunkReader chunkReader) throws IOException
      Consumes ChunkReader and creates a map "by type" with records.
      Throws:
      IOException
    • countRecordsByType

      protected Map<org.apache.maven.index.reader.Record.Type,Integer> countRecordsByType(org.apache.maven.index.reader.ChunkReader chunkReader) throws IOException
      Consumes ChunkReader and creates a map "by type" with record type counts.
      Throws:
      IOException