Autopsy  4.19.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
Classes | Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer Class Reference

Classes

class  StringObjMap
 

Public Member Functions

EnvConfig getEnvConfig (File envConfigFile) throws IOException, IllegalStateException
 
EnvConfig getEnvConfigFromSysProps () throws IOException, IllegalStateException
 
IntegrationTestConfig getIntegrationTestConfig () throws IOException, IllegalStateException
 
List< TestSuiteConfiggetTestSuiteConfig (File rootDirectory, File configFile)
 
List< TestSuiteConfiggetTestSuiteConfigs (File fileOrDirectory)
 

Private Member Functions

Map< String, Object > getOrCreate (Map< String, Object > parent, String key)
 
Map< String, Object > getSysPropsMap ()
 
EnvConfig validate (File envConfigFile, EnvConfig config) throws IllegalStateException
 
List< TestSuiteConfigvalidate (File rootDirectory, File file, List< TestSuiteConfig > testSuites)
 
TestSuiteConfig validate (File rootDirectory, File file, int index, TestSuiteConfig config)
 

Static Private Attributes

static final String CONFIG_FILE_KEY = "configFile"
 
static final String INTEGRATION_TEST_NAMESPACE = "integration-test"
 
static final String JSON_EXT = "json"
 
static final Logger logger = Logger.getLogger(ConfigDeserializer.class.getName())
 
static final ObjectMapper mapper = new ObjectMapper()
 

Detailed Description

Handles deserializing configuration items.

Definition at line 48 of file ConfigDeserializer.java.

Member Function Documentation

EnvConfig org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfig ( File  envConfigFile) throws IOException, IllegalStateException

Deserializes the specified json file into an EnvConfig object.

Parameters
envConfigFileThe file location for the environmental config.
Returns
The deserialized file.
Exceptions
IOException
IllegalStateExceptionIf the file cannot be validated.

Definition at line 198 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps().

EnvConfig org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps ( ) throws IOException, IllegalStateException

Deserializes the specified json file into an EnvConfig object using System.Property specified values. This is affected by build.xml test-init target and values specified in this file.

Returns
The deserialized file.
Exceptions
IOException
IllegalStateExceptionIf the env config file cannot be found but the property has been specified or the env config object cannot be validated.

Definition at line 72 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfig(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getOrCreate(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getSysPropsMap(), and org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getIntegrationTestConfig().

IntegrationTestConfig org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getIntegrationTestConfig ( ) throws IOException, IllegalStateException

Deserializes the json config specified at the given path into the java equivalent IntegrationTestConfig object. This uses information in env config to determine test suite locations.

Returns
The java object.
Exceptions
IOExceptionIf there is an error loading the config.
IllegalStateExceptionIf the config cannot be validated.

Definition at line 180 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.PathUtil.getAbsolutePath(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps(), org.sleuthkit.autopsy.integrationtesting.config.EnvConfig.getRootTestSuitesPath(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfigs(), and org.sleuthkit.autopsy.integrationtesting.config.EnvConfig.getWorkingDirectory().

Referenced by org.sleuthkit.autopsy.integrationtesting.IntegrationTestService.runIntegrationTests().

Map<String, Object> org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getOrCreate ( Map< String, Object >  parent,
String  key 
)
private

Retrieves the Map<String, Object> that will be found at parent.get(key) or create a new Map at that key and return that.

Parameters
parentThe parent map.
keyThe key to fetch.
Returns
The child map.

Definition at line 145 of file ConfigDeserializer.java.

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps(), and org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getSysPropsMap().

Map<String, Object> org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getSysPropsMap ( )
private

Creates a Map<String, Object> representing the values in System Properties. Properties will be stored in nested maps for property keys separated by periods. For instance, the property 'keyA.childA.childB' will be located in returnObj.get("keyA").get("childA").get("childB").

Returns
The generated map.

Definition at line 102 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getOrCreate().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps().

List<TestSuiteConfig> org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfig ( File  rootDirectory,
File  configFile 
)

Derives a list of test suite config's specified in the configFile. The root directory is the same or an ancestor directory of this configFile used for the relative output path.

Parameters
rootDirectoryThe ancestor directory of configFile.
configFileThe configFile to read.
Returns
The list of test suite configs found after invalid configs are filtered.

Definition at line 238 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfigs().

List<TestSuiteConfig> org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfigs ( File  fileOrDirectory)

Finds all test suite config json files within this directory and sub directories or if a file is specified, just that file is loaded.

Parameters
fileOrDirectoryThe parent directory of test suite configurations or the configuration file itself.
Returns
The list of determined test suite configurations found.

Definition at line 270 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfig().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getIntegrationTestConfig().

EnvConfig org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate ( File  envConfigFile,
EnvConfig  config 
) throws IllegalStateException
private

Validates the environment configuration file.

Parameters
envConfigFileThe file location of the config (used for setting working directory if not specified).
configThe environmental config that was deserialized.
Returns
The updated config.
Exceptions
IllegalStateExceptionIf could not be validated.

Definition at line 212 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.EnvConfig.setWorkingDirectory().

Referenced by org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfig(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getEnvConfigFromSysProps(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.getTestSuiteConfig(), and org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate().

List<TestSuiteConfig> org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate ( File  rootDirectory,
File  file,
List< TestSuiteConfig testSuites 
)
private

Validates the list of test suite configurations.

Parameters
rootDirectoryThe root directory for configurations (relativeOutputPath is set by determining relative path from root directory to file).
fileThe file containing the configuration.
testSuitesThe list of test suite objects discovered.
Returns
The test suites with invalid items filtered and relative output path set.

Definition at line 295 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate().

TestSuiteConfig org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.validate ( File  rootDirectory,
File  file,
int  index,
TestSuiteConfig  config 
)
private

Validates a single test suite by returning it or null if invalid. The relative output path is also determined based on the relative path from rootDirectory to file.

Parameters
rootDirectoryThe root directory for configurations (relativeOutputPath is set by determining relative path from root directory to file).
fileThe file containing the configuration.
indexThe index within a list of test suites which this item exists.
configThe test suite confi.
Returns
The test suite with relative output path set or null if invalid.

Definition at line 316 of file ConfigDeserializer.java.

References org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.getCaseTypes(), org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.getDataSources(), org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.getIntegrationTests(), org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.getName(), org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.getRelativeOutputPath(), org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.JSON_EXT, and org.sleuthkit.autopsy.integrationtesting.config.TestSuiteConfig.setRelativeOutputPath().

Member Data Documentation

final String org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.CONFIG_FILE_KEY = "configFile"
staticprivate

Definition at line 57 of file ConfigDeserializer.java.

final String org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.INTEGRATION_TEST_NAMESPACE = "integration-test"
staticprivate

Definition at line 59 of file ConfigDeserializer.java.

final String org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.JSON_EXT = "json"
staticprivate
final Logger org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.logger = Logger.getLogger(ConfigDeserializer.class.getName())
staticprivate

Definition at line 51 of file ConfigDeserializer.java.

final ObjectMapper org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer.mapper = new ObjectMapper()
staticprivate

Definition at line 52 of file ConfigDeserializer.java.


The documentation for this class was generated from the following file:

Copyright © 2012-2021 Basis Technology. Generated on: Fri Aug 6 2021
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.