Tested automated testing changes with localhost

This commit is contained in:
U-BASIS\dsmyda 2020-11-15 22:26:30 -05:00
parent 9564ff9632
commit 038484ca38
4 changed files with 20 additions and 5 deletions

View File

@ -383,10 +383,10 @@ public class CentralRepoDbManager {
saveNewCentralRepo(); saveNewCentralRepo();
} }
public void setupDefaultPostgresDb() throws CentralRepoException { public void setupPostgresDb(CentralRepoDbChoice choice) throws CentralRepoException {
assert UserPreferences.getIsMultiUserModeEnabled(); assert UserPreferences.getIsMultiUserModeEnabled();
selectedDbChoice = CentralRepoDbChoice.POSTGRESQL_MULTIUSER; selectedDbChoice = choice;
DatabaseTestResult curStatus = testStatus(); DatabaseTestResult curStatus = testStatus();
if (curStatus == DatabaseTestResult.DB_DOES_NOT_EXIST) { if (curStatus == DatabaseTestResult.DB_DOES_NOT_EXIST) {
createDb(); createDb();

View File

@ -25,6 +25,7 @@ import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.openide.modules.ModuleInstall; import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
import org.sleuthkit.autopsy.core.RuntimeProperties; import org.sleuthkit.autopsy.core.RuntimeProperties;
@ -128,7 +129,8 @@ public class Installer extends ModuleInstall {
try { try {
CentralRepoDbManager manager = new CentralRepoDbManager(); CentralRepoDbManager manager = new CentralRepoDbManager();
if (UserPreferences.getIsMultiUserModeEnabled()) { if (UserPreferences.getIsMultiUserModeEnabled()) {
manager.setupDefaultPostgresDb(); // Set up using existing multi-user settings.
manager.setupPostgresDb(CentralRepoDbChoice.POSTGRESQL_MULTIUSER);
} else { } else {
manager.setupDefaultSqliteDb(); manager.setupDefaultSqliteDb();
} }

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2018 Basis Technology Corp. * Copyright 2011-2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -25,6 +25,9 @@ import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.netbeans.jemmy.Timeouts; import org.netbeans.jemmy.Timeouts;
import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbModuleSuite;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbChoice;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
/** /**
* This test expects the following system properties to be set: img_path: The * This test expects the following system properties to be set: img_path: The
@ -100,6 +103,16 @@ public class RegressionTest extends TestCase {
public void setUp() { public void setUp() {
logger.info("######## " + AutopsyTestCases.getEscapedPath(System.getProperty("img_path")) + " #######"); logger.info("######## " + AutopsyTestCases.getEscapedPath(System.getProperty("img_path")) + " #######");
Timeouts.setDefault("ComponentOperator.WaitComponentTimeout", 1000000); Timeouts.setDefault("ComponentOperator.WaitComponentTimeout", 1000000);
try {
CentralRepoDbManager manager = new CentralRepoDbManager();
manager.getDbSettingsPostgres().setHost("localhost");
manager.getDbSettingsPostgres().setUserName("postgres");
manager.getDbSettingsPostgres().setPassword("password");
manager.setupPostgresDb(CentralRepoDbChoice.POSTGRESQL_CUSTOM);
} catch (CentralRepoException ex) {
throw new RuntimeException(ex);
}
} }
/** /**

View File

@ -27,7 +27,7 @@ def make_os_path(platform, *dirs):
path += str(dir).replace('\\', '/') + '/' path += str(dir).replace('\\', '/') + '/'
return path_fix(path) return path_fix(path)
elif platform == "win32": elif platform == "win32":
return make_path(dirs) return make_path(*dirs)
else: else:
print("Couldn't make path, because we only support Windows and Cygwin at this time.") print("Couldn't make path, because we only support Windows and Cygwin at this time.")
sys.exit(1) sys.exit(1)