Package org.apache.maven.index.reader
Class TestSupport
java.lang.Object
org.apache.maven.index.reader.TestSupport
- Direct Known Subclasses:
ChunkReaderTest
,IndexReaderTest
,IndexWriterTest
,TransformTest
Test support.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Closes all the registered resources handlers and deletes the temp directory.protected Map<Record.Type,
Integer> countRecordsByType
(ChunkReader chunkReader) ConsumesChunkReader
and creates a map "by type" with record type counts.protected File
Creates a temp directory withintempDir
.protected File
createTempFile
(String name) Creates a temp file withintempDir
with given name.protected WritableResourceHandler
Creates an emptyDirectoryResourceHandler
.protected Map<Record.Type,
List<Record>> loadRecordsByType
(ChunkReader chunkReader) ConsumesChunkReader
and creates a map "by type" with records.void
setup()
Creates the temp directory and list for resource handlers.protected ResourceHandler
testResourceHandler
(String name) Creates a "test"ResourceHandler
that contains predefined files, is mapped to test resources under given name.
-
Field Details
-
testName
public org.junit.rules.TestName testName
-
-
Constructor Details
-
TestSupport
public TestSupport()
-
-
Method Details
-
setup
Creates the temp directory and list for resource handlers.- Throws:
IOException
-
cleanup
Closes all the registered resources handlers and deletes the temp directory.- Throws:
IOException
-
createTempFile
Creates a temp file withintempDir
with given name.- Throws:
IOException
-
createTempDirectory
Creates a temp directory withintempDir
.- Throws:
IOException
-
createWritableResourceHandler
Creates an emptyDirectoryResourceHandler
.- Throws:
IOException
-
testResourceHandler
Creates a "test"ResourceHandler
that contains predefined files, is mapped to test resources under given name.- Throws:
IOException
-
loadRecordsByType
protected Map<Record.Type,List<Record>> loadRecordsByType(ChunkReader chunkReader) throws IOException ConsumesChunkReader
and creates a map "by type" with records.- Throws:
IOException
-
countRecordsByType
ConsumesChunkReader
and creates a map "by type" with record type counts.- Throws:
IOException
-