Device detection services for 51Degrees Pipeline

fiftyone.devicedetection.shared.testhelpers.FileUtils Class Reference

Static Public Member Functions

static String getHashFileName ()
 Helper to find the location of an Enterprise or Lite Hash file in the default search scope.
static File getHashFile ()
 Helper to find the location of an Enterprise or Lite Hash file in the default search scope.
static File getEvidenceFile ()
static File jarFileHelper (String file)
 Search the classpath for a resource.

Static Public Attributes

static final String ENTERPRISE_HASH_DATA_FILE_NAME = "Enterprise-HashV41.hash"
static final String TAC_HASH_DATA_FILE_NAME = "TAC-HashV41.hash"
static final String LITE_HASH_DATA_FILE_NAME = "51Degrees-LiteV4.1.hash"
static final String UA_FILE_NAME = "20000 User Agents.csv"
static final String EVIDENCE_FILE_NAME = "20000 Evidence Records.yml"
static final String LITE_HASH_DATA_FILE_PATH
static final String UA_FILE_PATH = "device-detection/" + UA_FILE_NAME
static final String EVIDENCE_FILE_PATH
static String TEMP_FILE_PREFIX = "DDTempFile"
 Prefix for temp files that are created by jarFileHelper(String).

Member Function Documentation

◆ getHashFile()

File fiftyone.devicedetection.shared.testhelpers.FileUtils.getHashFile ( )
static

Helper to find the location of an Enterprise or Lite Hash file in the default search scope.

Returns
a file or empty if not found

◆ getHashFileName()

String fiftyone.devicedetection.shared.testhelpers.FileUtils.getHashFileName ( )
static

Helper to find the location of an Enterprise or Lite Hash file in the default search scope.

Returns
a file or null if not found

◆ jarFileHelper()

File fiftyone.devicedetection.shared.testhelpers.FileUtils.jarFileHelper ( String file)
static

Search the classpath for a resource.

If it doesn't exist throw an exception. If the file is in a jar then copy it to a temp file, so it can be used as an actual file.

Callers might wish to delete the temp file created when one is created and can assess whether this is the case as the name of the filename created will start with TEMP_FILE_PREFIX which they can alter to suit their needs.

Files created here have the property deleteOnExit;

Parameters
filea filename
Returns
a File representing the resource

Member Data Documentation

◆ EVIDENCE_FILE_PATH

final String fiftyone.devicedetection.shared.testhelpers.FileUtils.EVIDENCE_FILE_PATH
static
Initial value:
=
"device-detection/" + EVIDENCE_FILE_NAME

◆ LITE_HASH_DATA_FILE_PATH

final String fiftyone.devicedetection.shared.testhelpers.FileUtils.LITE_HASH_DATA_FILE_PATH
static
Initial value:
=
"device-detection/" + LITE_HASH_DATA_FILE_NAME