mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-06 21:00:22 +00:00
working through multiuser; need to integrate solr and activemq
This commit is contained in:
parent
306a7f71f6
commit
ba289ae59c
@ -10,6 +10,16 @@
|
||||
|
||||
|
||||
<property name="thirdparty.dir" value="${basedir}/../thirdparty" />
|
||||
|
||||
<!-- import ant-contrib tools -->
|
||||
<property name="ant-contrib.dir" value="${thirdparty.dir}/ant-contrib/1.0b3" />
|
||||
<property name="ant.contrib.jar" value="${ant-contrib.dir}/ant-contrib.jar" />
|
||||
<taskdef resource="net/sf/antcontrib/antlib.xml">
|
||||
<classpath>
|
||||
<pathelement location="${ant.contrib.jar}"/>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<property name="modules.dir" value="${basedir}/release/modules/" />
|
||||
<property name="ext.dir" value="${modules.dir}/ext" />
|
||||
<property name="test-input" location="test/qa-functional/data"/>
|
||||
@ -213,44 +223,33 @@
|
||||
|
||||
<!--map from integration-test variables to test-qa-functional-sys-prop so they will be used as system properties-->
|
||||
<target name="setup-integration-props" depends="init">
|
||||
<propertyselector
|
||||
property="integration-test-sys-props"
|
||||
match="^integration-test\.(.*)"
|
||||
select="\1"
|
||||
delimiter=","
|
||||
casesensitive="true"
|
||||
distinct="true"
|
||||
/>
|
||||
|
||||
<for list="${integration-test-sys-props}" param="integration-test-sys-prop">
|
||||
<sequential>
|
||||
<condition property="test-qa-functional-sys-prop.rootTestOutputPath" value="${integration-test.rootTestOutputPath}">
|
||||
<isset property="integration-test.rootTestOutputPath" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.diffOutputPath" value="${integration-test.diffOutputPath}">
|
||||
<isset property="integration-test.diffOutputPath" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.rootGoldPath" value="${integration-test.rootGoldPath}">
|
||||
<isset property="integration-test.rootGoldPath" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.workingDirectory" value="${integration-test.workingDirectory}">
|
||||
<isset property="integration-test.workingDirectory" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.rootTestSuitesPath" value="${integration-test.rootTestSuitesPath}">
|
||||
<isset property="integration-test.rootTestSuitesPath" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.rootCaseOutputPath" value="${integration-test.rootCaseOutputPath}">
|
||||
<isset property="integration-test.rootCaseOutputPath" />
|
||||
</condition>
|
||||
|
||||
<condition property="test-qa-functional-sys-prop.configFile" value="${integration-test.configFile}">
|
||||
<isset property="integration-test.configFile" />
|
||||
</condition>
|
||||
<property
|
||||
name="test-qa-functional-sys-prop.@{integration-test-sys-prop}"
|
||||
value="${integration-test.@{integration-test-sys-prop}}"
|
||||
/>
|
||||
</sequential>
|
||||
</for>
|
||||
</target>
|
||||
|
||||
|
||||
<!--
|
||||
The paths specified in 'module.run.classpath' are incorporated into the manifest of a jar and then the path to the
|
||||
jar is used as part of the classpath for '-do-junit' instead of 'module.run.classpath'. This was done to prevent
|
||||
classpath length issues on windows. More information on this technique can be found here:
|
||||
https://stackoverflow.com/a/201969.
|
||||
-->
|
||||
<target name="integration-pathing-jar" depends="projectized-common.test-init" if="testing-pathing-jar.should-create">
|
||||
<target name="integration-pathing-jar" depends="projectized-common.test-init">
|
||||
<sequential>
|
||||
<!--set up pathing jar based on module.run.classpath as classpath-->
|
||||
<path id="test.qa-functional.pathing-jar.module-cp.classpath" path="${module.run.classpath}"/>
|
||||
@ -287,7 +286,6 @@
|
||||
<target name="integration-test">
|
||||
<!--We want only integration testing to run from this-->
|
||||
<sequential>
|
||||
<property name="testing-pathing-jar.should-create" value="true"/>
|
||||
<property name="test.includes" value="**/org/sleuthkit/autopsy/integrationtesting/TestRunner.class"/>
|
||||
<antcall target="projectized-common.test-qa-functional" />
|
||||
</sequential>
|
||||
|
@ -35,6 +35,7 @@ import java.util.stream.Stream;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.openide.util.Exceptions;
|
||||
import org.openide.util.Lookup;
|
||||
import org.openide.util.Pair;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ -42,6 +43,9 @@ import org.sleuthkit.autopsy.casemodule.Case.CaseType;
|
||||
import org.sleuthkit.autopsy.casemodule.CaseActionException;
|
||||
import org.sleuthkit.autopsy.casemodule.CaseDetails;
|
||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.PostgresConnectionSettings;
|
||||
import org.sleuthkit.autopsy.core.UserPreferences;
|
||||
import org.sleuthkit.autopsy.core.UserPreferencesException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.autopsy.coreutils.TimeStampUtils;
|
||||
import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
|
||||
@ -50,11 +54,15 @@ import org.sleuthkit.autopsy.datasourceprocessors.DataSourceProcessorUtility;
|
||||
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
|
||||
import org.sleuthkit.autopsy.integrationtesting.DiffService.DiffServiceException;
|
||||
import org.sleuthkit.autopsy.integrationtesting.config.ConfigDeserializer;
|
||||
import org.sleuthkit.autopsy.integrationtesting.config.ConnectionConfig;
|
||||
import org.sleuthkit.autopsy.integrationtesting.config.EnvConfig;
|
||||
import org.sleuthkit.autopsy.integrationtesting.config.TestingConfig;
|
||||
import org.sleuthkit.autopsy.testutils.IngestUtils;
|
||||
import org.sleuthkit.autopsy.testutils.TestUtilsException;
|
||||
import org.sleuthkit.datamodel.CaseDbConnectionInfo;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.TskData.DbType;
|
||||
|
||||
/**
|
||||
* Main entry point for running integration tests. Handles processing
|
||||
@ -127,7 +135,14 @@ public class IntegrationTestService {
|
||||
}
|
||||
|
||||
EnvConfig envConfig = config.getEnvConfig();
|
||||
CaseDbConnectionInfo oldSettings = null;
|
||||
try {
|
||||
oldSettings = pushNewMultiUserSettings(envConfig.getConnectionInfo());
|
||||
} catch (UserPreferencesException ex) {
|
||||
logger.log(Level.SEVERE, "There was an error while trying to set up multi user connection information.", ex);
|
||||
}
|
||||
|
||||
try {
|
||||
// iterate through test suites if any exist
|
||||
if (CollectionUtils.isEmpty(config.getTestSuites())) {
|
||||
logger.log(Level.WARNING, "No test suites discovered. No tests will be run.");
|
||||
@ -158,6 +173,44 @@ public class IntegrationTestService {
|
||||
throw new IntegrationTestServiceException("There was an error while trying to diff output with gold data.", ex);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (oldSettings != null) {
|
||||
try {
|
||||
UserPreferences.setDatabaseConnectionInfo(oldSettings);
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.WARNING, "There was an error reverting database settings", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If multi user settings are present in current configuration, then set
|
||||
* multi user settings to those settings. Provide the old
|
||||
* CaseDbConnectionInfo object with the old values to revert when finished.
|
||||
*
|
||||
* @param connectionInfo The connection info to use for new values.
|
||||
* @return The old connection info if present and the connection info was
|
||||
* changed.
|
||||
*/
|
||||
private CaseDbConnectionInfo pushNewMultiUserSettings(ConnectionConfig connectionInfo) throws UserPreferencesException {
|
||||
if (connectionInfo == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String username = connectionInfo.getUserName();
|
||||
String host = connectionInfo.getHostName();
|
||||
String password = connectionInfo.getPassword();
|
||||
int port = connectionInfo.getPort() == null ? PostgresConnectionSettings.DEFAULT_PORT : connectionInfo.getPort();
|
||||
|
||||
if (StringUtils.isBlank(username) || StringUtils.isBlank(password) || StringUtils.isBlank(host)) {
|
||||
logger.log(Level.WARNING, "Username, password, or host are not present. Not setting multi user connection info.");
|
||||
return null;
|
||||
}
|
||||
|
||||
CaseDbConnectionInfo oldInfo = UserPreferences.getDatabaseConnectionInfo();
|
||||
UserPreferences.setDatabaseConnectionInfo(new CaseDbConnectionInfo(host, Integer.toString(port), username, password, DbType.POSTGRESQL));
|
||||
return oldInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,22 +285,11 @@ public class IntegrationTestService {
|
||||
caseOutputFolderFile.mkdirs();
|
||||
}
|
||||
|
||||
// create a spe
|
||||
switch (caseType) {
|
||||
case SINGLE_USER_CASE: {
|
||||
Case.createAsCurrentCase(
|
||||
Case.CaseType.SINGLE_USER_CASE,
|
||||
caseType,
|
||||
caseOutputFolder,
|
||||
new CaseDetails(uniqueCaseName));
|
||||
openCase = Case.getCurrentCaseThrows();
|
||||
}
|
||||
break;
|
||||
|
||||
case MULTI_USER_CASE:
|
||||
throw new IllegalArgumentException("Multiuser cases are not currently supported for integration tests");
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown case type: " + caseType);
|
||||
}
|
||||
|
||||
addDataSourcesToCase(PathUtil.getAbsolutePaths(workingDirectory, dataSourcePaths), caseName);
|
||||
return openCase;
|
||||
|
@ -63,13 +63,13 @@ public class ConfigDeserializer {
|
||||
// where the integration tests will output yml data
|
||||
private static final String ROOT_TEST_OUTPUT_PATH_KEY = "rootTestOutputPath";
|
||||
// the postgres connection host name
|
||||
private static final String CONNECTION_HOST_NAME_KEY = "connectionHostName";
|
||||
private static final String CONNECTION_HOST_NAME_KEY = "connectionInfo.hostName";
|
||||
// the postgres connection port
|
||||
private static final String CONNECTION_PORT_KEY = "connectionPort";
|
||||
private static final String CONNECTION_PORT_KEY = "connectionInfo.port";
|
||||
// the postgres connection user name
|
||||
private static final String CONNECTION_USER_NAME_KEY = "connectionUserName";
|
||||
private static final String CONNECTION_USER_NAME_KEY = "connectionInfo.userName";
|
||||
// the postgres connection password
|
||||
private static final String CONNECTION_PASSWORD_KEY = "connectionPassword";
|
||||
private static final String CONNECTION_PASSWORD_KEY = "connectionInfo.password";
|
||||
// the working directory. Paths that are relative are relative to this path.
|
||||
private static final String WORKING_DIRECTORY_KEY = "workingDirectory";
|
||||
// whether or not the output path should have the same directory structure as
|
||||
|
Loading…
x
Reference in New Issue
Block a user