public class TestTools extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TestTools.TileLoopIteration
A single iteration of a tile for each loop.
|
Modifier and Type | Field and Description |
---|---|
static String |
baseConfigName |
static String |
DIVIDER |
private static org.slf4j.Logger |
LOGGER |
Constructor and Description |
---|
TestTools() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canFitInMemory(long bufferSize)
Returns true if a byte buffer of the given size will fit in memory.
|
static int |
forEachTile(TestTools.TileLoopIteration iteration,
int sizeX,
int sizeY,
int sizeZ,
int sizeC,
int sizeT,
int tileWidth,
int tileHeight)
Iterates over every tile in a given pixel buffer based on the over arching
dimensions and a requested maximum tile width and height.
|
static String |
getExternalConfigFile(String root,
ConfigurationTree config)
Retrieve an external configuration file given a root directory and test
configuration
|
static String |
getExternalSymlinkConfigFile(String root,
ConfigurationTree config)
Retrieve an external symlinkedconfiguration file given a root directory
and a test configuration
|
static void |
getFiles(String root,
List files,
ConfigurationTree config,
String toplevelConfig)
Recursively generate a list of files to test.
|
static void |
getFiles(String root,
List files,
ConfigurationTree config,
String toplevelConfig,
String[] subdirs)
Recursively generate a list of files to test.
|
static void |
getFiles(String root,
List files,
ConfigurationTree config,
String toplevelConfig,
String[] subdirs,
String configFileSuffix)
Recursively generate a list of files to test.
|
static long |
getUsedMemory()
Gets the quantity of used memory, in MB.
|
static boolean |
isConfigFile(Location file,
String configFileSuffix)
Recursively generate a list of files to test.
|
static boolean |
isIgnoredFile(String file,
ConfigurationTree config)
Determines if the given file should be ignored by the test suite.
|
static boolean |
isOutOfMemory(Throwable t)
Determine whether or not a Throwable was caused by an OutOfMemoryError.
|
static boolean |
mapFile(String id)
Map the given file into memory.
|
static String |
md5(byte[] b)
Calculate the MD5 of a byte array.
|
static String |
md5(byte[] b,
int offset,
int len)
Calculate the MD5 of a byte array.
|
static String |
md5(byte[] b,
int sizeX,
int sizeY,
int posX,
int posY,
int width,
int height,
int bpp)
Calculate the MD5 of a byte array.
|
static String |
sha1(byte[] b)
Calculate the SHA-1 of a byte array.
|
static String |
sha1(byte[] b,
int offset,
int len)
Calculate the SHA-1 of a byte array.
|
static String |
shortClassName(Object o)
Gets the class name sans package for the given object.
|
private static final org.slf4j.Logger LOGGER
public static final String DIVIDER
public static final String baseConfigName
public static String sha1(byte[] b, int offset, int len)
public static String sha1(byte[] b)
public static String md5(byte[] b, int sizeX, int sizeY, int posX, int posY, int width, int height, int bpp)
public static String md5(byte[] b, int offset, int len)
public static String md5(byte[] b)
public static boolean canFitInMemory(long bufferSize)
public static long getUsedMemory()
public static String shortClassName(Object o)
public static boolean isConfigFile(Location file, String configFileSuffix)
public static void getFiles(String root, List files, ConfigurationTree config, String toplevelConfig)
public static void getFiles(String root, List files, ConfigurationTree config, String toplevelConfig, String[] subdirs)
public static String getExternalConfigFile(String root, ConfigurationTree config)
public static String getExternalSymlinkConfigFile(String root, ConfigurationTree config)
public static void getFiles(String root, List files, ConfigurationTree config, String toplevelConfig, String[] subdirs, String configFileSuffix)
public static boolean isIgnoredFile(String file, ConfigurationTree config)
public static int forEachTile(TestTools.TileLoopIteration iteration, int sizeX, int sizeY, int sizeZ, int sizeC, int sizeT, int tileWidth, int tileHeight)
iteration
- Invoker to call for each tile.sizeX
- Width of the entire image.sizeY
- Height of the entire image.sizeZ
- Number of optical sections the image contains.sizeC
- Number of channels the image contains.sizeT
- Number of timepoints the image contains.tileWidth
- Maximum width of the tile requested. The tile
request itself will be smaller than the original tile width requested if
x + tileWidth > sizeX
.tileHeight
- Maximum height of the tile requested. The tile
request itself will be smaller if y + tileHeight > sizeY
.public static boolean mapFile(String id) throws IOException
IOException
public static boolean isOutOfMemory(Throwable t)
t
- Throwable object to checkt
is or was caused by an OutOfMemoryError, false otherwiseCopyright © 2016 Open Microscopy Environment