Merge branch 'develop' of https://github.com/sleuthkit/autopsy into 3870-pure-callable

# Conflicts:
#	Core/src/org/sleuthkit/autopsy/commonfilesearch/AllInterCaseCommonAttributeSearcher.java
#	Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonAttributeSearchResults.java
#	Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java
#	Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/IntraCaseTestUtils.java
This commit is contained in:
Andrew Ziehl
2018-08-29 08:56:55 -07:00
129 changed files with 5038 additions and 2875 deletions
@@ -19,17 +19,21 @@
*/
package org.sleuthkit.autopsy.commonfilessearch;
import java.sql.SQLException;
import java.util.Map;
import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
import org.sleuthkit.autopsy.commonfilesearch.SingleInterCaseCommonAttributeSearcher;
import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Tests with case 3 as the current case.
@@ -62,9 +66,9 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
try {
this.utils.enableCentralRepo();
this.utils.createCases(this.utils.getIngestSettingsForHashAndFileType(), InterCaseTestUtils.CASE3);
} catch (Exception ex) {
} catch (TskCoreException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -82,7 +86,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
//note that the params false and false are presently meaningless because that feature is not supported yet
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(dataSources, false, false);
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(dataSources, false, false, 0);
CommonAttributeSearchResults metadata = builder.findFiles();
@@ -120,9 +124,9 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3, 1));
} catch (Exception ex) {
} catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -135,7 +139,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
int matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(CASE2);
AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, dataSources, false, false);
AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = builder.findFiles();
@@ -173,9 +177,61 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3, 1));
} catch (Exception ex) {
} catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
/**
* We should be able to observe that certain files o no longer returned
* in the result set since they do not appear frequently enough.
*/
public void testThree(){
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
//note that the params false and false are presently meaningless because that feature is not supported yet
AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(dataSources, false, false, 50);
CommonAttributeSearchResults metadata = builder.findFiles();
assertTrue("Results should not be empty", metadata.size() != 0);
//case 1 data set 1
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1, 1));
//case 1 data set 2
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1, 1));
//case 2 data set 1
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2, 0));
//case 2 data set 2
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2, 0));
//case 3 data set 1
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3, 1));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3, 0));
//case 3 data set 2
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3, 0));
assertTrue(verifyInstanceExistanceAndCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3, 0));
} catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -27,7 +27,7 @@ import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
@@ -82,7 +82,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
} catch (NoCurrentCaseException | TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -99,7 +99,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
@@ -128,7 +128,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -140,7 +140,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -169,7 +169,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -181,7 +181,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, true);
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, true, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -210,7 +210,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -223,7 +223,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long first = getDataSourceIdByName(SET1, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -252,7 +252,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -265,7 +265,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long first = getDataSourceIdByName(SET1, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, true, false);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, true, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -294,7 +294,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -307,7 +307,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long first = getDataSourceIdByName(SET1, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, true);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, true, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -336,7 +336,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -349,7 +349,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long second = getDataSourceIdByName(SET2, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(second, dataSources, false, false);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(second, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -378,7 +378,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -390,7 +390,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long last = getDataSourceIdByName(SET4, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(last, dataSources, false, false);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(last, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -419,7 +419,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -431,7 +431,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long third = getDataSourceIdByName(SET3, dataSources);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, false, false);
AbstractCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = mapFileInstancesToDataSources(metadata);
@@ -460,7 +460,7 @@ public class IngestedWithHashAndFileTypeIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -19,6 +19,7 @@
*/
package org.sleuthkit.autopsy.commonfilessearch;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -27,7 +28,7 @@ import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
@@ -82,7 +83,7 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
} catch (NoCurrentCaseException | TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -96,10 +97,11 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
* find nothing and no errors should arise.
*/
public void testOne() {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false);
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, true, false, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
@@ -108,9 +110,9 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
assertTrue(files.isEmpty());
} catch (Exception ex) {
} catch (TskCoreException | NoCurrentCaseException | SQLException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -123,7 +125,7 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long third = IntraCaseTestUtils.getDataSourceIdByName(IntraCaseTestUtils.SET3, dataSources);
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, true, false);
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(third, dataSources, true, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
@@ -134,7 +136,7 @@ public class IngestedWithNoFileTypesIntraCaseTests extends NbTestCase {
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -45,7 +45,7 @@ import org.sleuthkit.autopsy.modules.hashdatabase.HashLookupModuleFactory;
import org.sleuthkit.autopsy.testutils.CaseUtils;
import org.sleuthkit.autopsy.testutils.IngestUtils;
import org.sleuthkit.datamodel.TskCoreException;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
@@ -63,45 +63,30 @@ import org.sleuthkit.datamodel.AbstractFile;
/**
* Utilities for testing intercase correlation feature.
*
* This will be more useful when we add more flush out the intercase
* correlation features and need to add more tests. In particular,
* testing scenarios where we need different cases to be the current case
* will suggest that we create additional test classes, and we will want to
* import this utility in each new intercase test file.
*
* Description of Test Data:
(Note: files of the same name and extension are identical;
files of the same name and differing extension are not identical.)
Case 1
+Data Set 1
- Hash-0.dat [testFile of size 0]
- Hash-A.jpg
- Hash-A.pdf
+Data Set2
- Hash-0.dat [testFile of size 0]
- Hash-A.jpg
- Hash-A.pdf
Case 2
+Data Set 1
- Hash-B.jpg
- Hash-B.pdf
+Data Set 2
- Hash-A.jpg
- Hash-A.pdf
- Hash_D.doc
Case 3
+Data Set 1
- Hash-A.jpg
- Hash-A.pdf
- Hash-C.jpg
- Hash-C.pdf
- Hash-D.jpg
+Data Set 2
- Hash-C.jpg
- Hash-C.pdf
- Hash-D.doc
*
* This will be more useful when we add more flush out the intercase correlation
* features and need to add more tests. In particular, testing scenarios where
* we need different cases to be the current case will suggest that we create
* additional test classes, and we will want to import this utility in each new
* intercase test file.
*
* Description of Test Data: (Note: files of the same name and extension are
* identical; files of the same name and differing extension are not identical.)
*
* Case 1 +Data Set 1 - Hash-0.dat [testFile of size 0] - Hash-A.jpg -
* Hash-A.pdf +Data Set2 - Hash-0.dat [testFile of size 0] - Hash-A.jpg -
* Hash-A.pdf Case 2 +Data Set 1 - Hash-B.jpg - Hash-B.pdf +Data Set 2 -
* Hash-A.jpg - Hash-A.pdf - Hash_D.doc Case 3 +Data Set 1 - Hash-A.jpg -
* Hash-A.pdf - Hash-C.jpg - Hash-C.pdf - Hash-D.jpg +Data Set 2 - Hash-C.jpg -
* Hash-C.pdf - Hash-D.doc
*
* Frequency Breakdown (ratio of datasources a given file appears in to total
* number of datasources):
*
* Hash-0.dat - moot; these are always excluded Hash-A.jpg - 4/6 Hash-A.pdf -
* 4/6 Hash-B.jpg - 1/6 Hash-B.pdf - 1/6 Hash-C.jpg - 2/6 Hash-C.pdf - 2/6
* Hash_D.doc - 2/6 Hash-D.jpg - 1/6
*
*/
class InterCaseTestUtils {
@@ -174,21 +159,21 @@ class InterCaseTestUtils {
this.dataSourceLoader = new DataSourceLoader();
}
void clearTestDir(){
if(CASE_DIRECTORY_PATH.toFile().exists()){
try{
if(EamDb.isEnabled()) {
void clearTestDir() {
if (CASE_DIRECTORY_PATH.toFile().exists()) {
try {
if (EamDb.isEnabled()) {
EamDb.getInstance().shutdownConnections();
}
FileUtils.deleteDirectory(CASE_DIRECTORY_PATH.toFile());
} catch(IOException | EamDbException ex){
} catch (IOException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
CASE_DIRECTORY_PATH.toFile().exists();
}
Map<Long, String> getDataSourceMap() throws NoCurrentCaseException, TskCoreException, SQLException {
return this.dataSourceLoader.getDataSourceMap();
}
@@ -225,7 +210,7 @@ class InterCaseTestUtils {
if (!crSettings.dbDirectoryExists()) {
crSettings.createDbDirectory();
}
crSettings.initializeDatabaseSchema();
crSettings.insertDefaultDatabaseContent();
@@ -281,7 +266,7 @@ class InterCaseTestUtils {
}
if (currentCase == null) {
Assert.fail(new IllegalArgumentException("caseReferenceToStore should be one of: CASE1, CASE2, CASE3"));
Assert.fail(new IllegalArgumentException("caseReferenceToStore should be one of: CASE1, CASE2, CASE3").getMessage());
return null;
} else {
return currentCase;
@@ -304,71 +289,77 @@ class InterCaseTestUtils {
return null;
}
}
//TODO refactor
static boolean verifyInstanceExistanceAndCount(CommonAttributeSearchResults searchDomain, String fileName, String dataSource, String crCase, int instanceCount){
int tally = 0;
for(Map.Entry<Integer, CommonAttributeValueList> entry : searchDomain.getMetadata().entrySet()){
entry.getValue().displayDelayedMetadata();
for(CommonAttributeValue value : entry.getValue().getMetadataList()) {
for(AbstractCommonAttributeInstance commonAttribute : value.getInstances()){
if(commonAttribute instanceof CentralRepoCommonAttributeInstance){
CentralRepoCommonAttributeInstance results = (CentralRepoCommonAttributeInstance) commonAttribute;
for (DisplayableItemNode din : results.generateNodes()){
if(din instanceof CentralRepoCommonAttributeInstanceNode){
CentralRepoCommonAttributeInstanceNode node = (CentralRepoCommonAttributeInstanceNode) din;
CorrelationAttributeInstance instance = node.getCorrelationAttributeInstance();
final String fullPath = instance.getFilePath();
final File testFile = new File(fullPath);
final String testCaseName = instance.getCorrelationCase().getDisplayName();
static boolean verifyInstanceExistanceAndCount(CommonAttributeSearchResults searchDomain, String fileName, String dataSource, String crCase, int instanceCount) {
final String testFileName = testFile.getName();
try {
int tally = 0;
final String testDataSource = instance.getCorrelationDataSource().getName();
for (Map.Entry<Integer, CommonAttributeValueList> entry : searchDomain.getMetadata().entrySet()) {
entry.getValue().displayDelayedMetadata();
for (CommonAttributeValue value : entry.getValue().getMetadataList()) {
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase);
for (AbstractCommonAttributeInstance commonAttribute : value.getInstances()) {
if( sameFileName && sameDataSource && sameCrCase){
tally++;
}
}
if(din instanceof CaseDBCommonAttributeInstanceNode){
CaseDBCommonAttributeInstanceNode node = (CaseDBCommonAttributeInstanceNode) din;
AbstractFile file = node.getContent();
final String testFileName = file.getName();
final String testCaseName = node.getCase();
final String testDataSource = node.getDataSource();
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
if(sameFileName && sameDataSource && sameCaseName){
tally++;
if (commonAttribute instanceof CentralRepoCommonAttributeInstance) {
CentralRepoCommonAttributeInstance results = (CentralRepoCommonAttributeInstance) commonAttribute;
for (DisplayableItemNode din : results.generateNodes()) {
if (din instanceof CentralRepoCommonAttributeInstanceNode) {
CentralRepoCommonAttributeInstanceNode node = (CentralRepoCommonAttributeInstanceNode) din;
CorrelationAttributeInstance instance = node.getCorrelationAttributeInstance();
final String fullPath = instance.getFilePath();
final File testFile = new File(fullPath);
final String testCaseName = instance.getCorrelationCase().getDisplayName();
final String testFileName = testFile.getName();
final String testDataSource = instance.getCorrelationDataSource().getName();
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase);
if (sameFileName && sameDataSource && sameCrCase) {
tally++;
}
}
if (din instanceof CaseDBCommonAttributeInstanceNode) {
CaseDBCommonAttributeInstanceNode node = (CaseDBCommonAttributeInstanceNode) din;
AbstractFile file = node.getContent();
final String testFileName = file.getName();
final String testCaseName = node.getCase();
final String testDataSource = node.getDataSource();
boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
if (sameFileName && sameDataSource && sameCaseName) {
tally++;
}
}
}
} else {
Assert.fail("Unable to cast AbstractCommonAttributeInstanceNode to InterCaseCommonAttributeSearchResults.");
}
} else {
Assert.fail("Unable to cast AbstractCommonAttributeInstanceNode to InterCaseCommonAttributeSearchResults.");
}
}
}
}
return tally == instanceCount;
} catch (EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
return false;
}
return tally == instanceCount;
}
/**
@@ -376,18 +367,18 @@ class InterCaseTestUtils {
* central repo db.
*/
void tearDown() {
CaseUtils.closeCurrentCase(false);
String[] cases = new String[]{CASE1,CASE2,CASE3};
String[] cases = new String[]{CASE1, CASE2, CASE3};
try {
for(String caze : cases){
for (String caze : cases) {
CaseUtils.deleteCaseDir(new File(caze));
}
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -29,10 +29,11 @@ import java.util.Map;
import java.util.Set;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeInstance;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
import org.sleuthkit.autopsy.commonfilesearch.DataSourceLoader;
@@ -50,24 +51,14 @@ import org.sleuthkit.datamodel.TskCoreException;
*
* Data set definitions:
*
* set 1
* + file1
* - IMG_6175.jpg
* + file2
* - IMG_6175.jpg
* + file3
* - BasicStyleGuide.doc
* set 1 + file1 - IMG_6175.jpg + file2 - IMG_6175.jpg + file3 -
* BasicStyleGuide.doc
*
* set 2
* - adsf.pdf
* - IMG_6175.jpg
* set 2 - adsf.pdf - IMG_6175.jpg
*
* set 3
* - BasicStyleGuide.doc
* - IMG_6175.jpg
* set 3 - BasicStyleGuide.doc - IMG_6175.jpg
*
* set 4
* - file.dat (empty file)
* set 4 - file.dat (empty file)
*/
class IntraCaseTestUtils {
@@ -92,13 +83,13 @@ class IntraCaseTestUtils {
private final DataSourceLoader dataSourceLoader;
private final String caseName;
IntraCaseTestUtils(NbTestCase nbTestCase, String caseName){
IntraCaseTestUtils(NbTestCase nbTestCase, String caseName) {
this.imagePath1 = Paths.get(nbTestCase.getDataDir().toString(), SET1);
this.imagePath2 = Paths.get(nbTestCase.getDataDir().toString(), SET2);
this.imagePath3 = Paths.get(nbTestCase.getDataDir().toString(), SET3);
this.imagePath4 = Paths.get(nbTestCase.getDataDir().toString(), SET4);
this.dataSourceLoader = new DataSourceLoader();
this.caseName = caseName;
@@ -173,7 +164,7 @@ class IntraCaseTestUtils {
String dataSourceName = objectIdToDataSourceMap.get(objectId);
if (name.equals(name) && dataSourceName.equals(dataSource)) {
if (name.equalsIgnoreCase(fileName) && dataSourceName.equalsIgnoreCase(dataSource)) {
tally++;
}
}
@@ -197,28 +188,33 @@ class IntraCaseTestUtils {
}
/**
* Create a convenience lookup table mapping file instance object ids to
* the data source they appear in.
*
* @param metadata object returned by the code under test
* Create a convenience lookup table mapping file instance object ids to the
* data source they appear in.
*
* @param metadata object returned by the code under test
* @return mapping of objectId to data source name
*/
static Map<Long, String> mapFileInstancesToDataSources(CommonAttributeSearchResults metadata) {
Map<Long, String> instanceIdToDataSource = new HashMap<>();
for (Map.Entry<Integer, CommonAttributeValueList> entry : metadata.getMetadata().entrySet()) {
entry.getValue().displayDelayedMetadata();
for (CommonAttributeValue md : entry.getValue().getMetadataList()) {
for (AbstractCommonAttributeInstance fim : md.getInstances()) {
instanceIdToDataSource.put(fim.getAbstractFileObjectId(), fim.getDataSource());
try {
for (Map.Entry<Integer, CommonAttributeValueList> entry : metadata.getMetadata().entrySet()) {
entry.getValue().displayDelayedMetadata();
for (CommonAttributeValue md : entry.getValue().getMetadataList()) {
for (AbstractCommonAttributeInstance fim : md.getInstances()) {
instanceIdToDataSource.put(fim.getAbstractFileObjectId(), fim.getDataSource());
}
}
}
}
return instanceIdToDataSource;
return instanceIdToDataSource;
} catch (EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
return instanceIdToDataSource;
}
}
static List<AbstractFile> getFiles(Set<Long> objectIds) {
List<AbstractFile> files = new ArrayList<>(objectIds.size());
@@ -228,7 +224,7 @@ class IntraCaseTestUtils {
files.add(file);
} catch (NoCurrentCaseException | TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -27,7 +27,7 @@ import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
@@ -92,7 +92,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
IngestUtils.runIngestJob(Case.getCurrentCaseThrows().getDataSources(), ingestJobSettings);
} catch (NoCurrentCaseException | TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -105,7 +105,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
AbstractCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
Map<Long, String> objectIdToDataSource = IntraCaseTestUtils.mapFileInstancesToDataSources(metadata);
@@ -123,7 +123,7 @@ public class MatchesInAtLeastTwoSourcesIntraCaseTests extends NbTestCase {
} catch (NoCurrentCaseException | TskCoreException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -19,19 +19,22 @@
*/
package org.sleuthkit.autopsy.commonfilessearch;
import java.sql.SQLException;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.commonfilesearch.AllIntraCaseCommonAttributeSearcher;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults;
import org.sleuthkit.autopsy.commonfilesearch.IntraCaseCommonAttributeSearcher;
import org.sleuthkit.autopsy.commonfilesearch.SingleIntraCaseCommonAttributeSearcher;
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.SET1;
import static org.sleuthkit.autopsy.commonfilessearch.IntraCaseTestUtils.getDataSourceIdByName;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Test that cases which are created but have not run any ingest modules turn up
@@ -77,15 +80,15 @@ public class UningestedCasesIntraCaseTests extends NbTestCase {
try {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false);
IntraCaseCommonAttributeSearcher allSourcesBuilder = new AllIntraCaseCommonAttributeSearcher(dataSources, false, false, 0);
CommonAttributeSearchResults metadata = allSourcesBuilder.findFiles();
int resultCount = metadata.size();
assertEquals(resultCount, 0);
} catch (Exception ex) {
} catch (TskCoreException | NoCurrentCaseException | SQLException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -97,15 +100,15 @@ public class UningestedCasesIntraCaseTests extends NbTestCase {
Map<Long, String> dataSources = this.utils.getDataSourceMap();
Long first = getDataSourceIdByName(SET1, dataSources);
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false);
IntraCaseCommonAttributeSearcher singleSourceBuilder = new SingleIntraCaseCommonAttributeSearcher(first, dataSources, false, false, 0);
CommonAttributeSearchResults metadata = singleSourceBuilder.findFiles();
int resultCount = metadata.size();
assertEquals(resultCount, 0);
} catch (Exception ex) {
} catch (TskCoreException | NoCurrentCaseException | SQLException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
}
@@ -28,7 +28,7 @@ import junit.framework.Test;
import org.netbeans.junit.NbModuleSuite;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.ingest.IngestJobSettings.IngestType;
@@ -47,7 +47,7 @@ import org.sleuthkit.datamodel.TskCoreException;
public class EmbeddedFileTest extends NbTestCase {
private static final String CASE_NAME = "EmbeddedFileTest";
private final Path IMAGE_PATH = Paths.get(this.getDataDir().toString(), "EmbeddedIM_img2_v1.vhd");
private final Path IMAGE_PATH = Paths.get(this.getDataDir().toString(), "EmbeddedIM_img1_v2.vhd");
public static final String HASH_VALUE = "098f6bcd4621d373cade4e832627b4f6";
private static final int DEEP_FOLDER_COUNT = 25;
private Case openCase;
@@ -85,7 +85,7 @@ public class EmbeddedFileTest extends NbTestCase {
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -96,46 +96,48 @@ public class EmbeddedFileTest extends NbTestCase {
public void testEncryptionAndZipBomb() {
try {
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("name LIKE '%%'");
String protectedName1 = "password_protected.zip";
String protectedName2 = "level1_protected.zip";
String protectedName3 = "42.zip";
String depthZipBomb = "DepthTriggerZipBomb.zip";
String ratioZipBomb = "RatioTriggerZipBomb.zip";
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("name LIKE '%%'");
final String zipBombSetName = "Possible Zip Bomb";
final String protectedName1 = "password_protected.zip";
final String protectedName2 = "level1_protected.zip";
final String protectedName3 = "42.zip";
final String depthZipBomb = "DepthTriggerZipBomb.zip";
final String ratioZipBomb = "RatioTriggerZipBomb.zip";
int zipBombs = 0;
assertEquals(2221, results.size());
assertEquals("The number of files in the test image has changed", 2221, results.size());
int passwdProtectedZips = 0;
for (AbstractFile file : results) {
//.zip file has artifact TSK_ENCRYPTION_DETECTED
if (file.getName().equalsIgnoreCase(protectedName1) || file.getName().equalsIgnoreCase(protectedName2) || file.getName().equalsIgnoreCase(protectedName3)){
ArrayList<BlackboardArtifact> artifacts = file.getAllArtifacts();
assertEquals(1, artifacts.size());
assertEquals("Password protected zip file " + file.getName() + " has incorrect number of artifacts", 1, artifacts.size());
for (BlackboardArtifact artifact : artifacts) {
assertEquals(artifact.getArtifactTypeID(), BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID());
assertEquals("Artifact for password protected zip file " + file.getName() + " has incorrect type ID", artifact.getArtifactTypeID(), BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID());
passwdProtectedZips++;
}
} else if (file.getName().equalsIgnoreCase(depthZipBomb) || file.getName().equalsIgnoreCase(ratioZipBomb)){
ArrayList<BlackboardArtifact> artifacts = file.getAllArtifacts();
assertEquals(1, artifacts.size());
assertEquals("Zip bomb " + file.getName() + " has incorrect number of artifacts", 1, artifacts.size());
for (BlackboardArtifact artifact : artifacts) {
assertEquals(artifact.getArtifactTypeID(), BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID());
assertEquals("Artifact for Zip bomb " + file.getName() + " has incorrect type ID", artifact.getArtifactTypeID(), BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT.getTypeID());
BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME));
assertNotNull("Possible Zip Bomb", attribute);
assertNotNull("No attribute found for artifact on zip bomb " + file.getName(), attribute);
assertEquals("Interesting artifact on file, " + file.getName() + ", does not reflect it being a zip bomb", zipBombSetName, attribute.getDisplayString());
zipBombs++;
}
} else {//No other files have artifact defined
assertEquals(0, file.getAllArtifacts().size());
assertEquals("Unexpected file, " + file.getName() + ", has artifacts", 0, file.getAllArtifacts().size());
}
}
//Make sure 3 password protected zip files have been tested: password_protected.zip, level1_protected.zip and 42.zip that we download for bomb testing.
assertEquals(3, passwdProtectedZips);
assertEquals("Unexpected number of artifacts reflecting password protected zip files found", 3, passwdProtectedZips);
//Make sure 2 zip bomb files have been tested: DepthTriggerZipBomb.zip and RatioTriggerZipBomb.zip.
assertEquals(2, zipBombs);
assertEquals("Unexpected number of artifacts reflecting zip bombs found", 2, zipBombs);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -162,7 +164,7 @@ public class EmbeddedFileTest extends NbTestCase {
assertEquals(numOfFilesToTest, numOfFilesTested);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -185,7 +187,7 @@ public class EmbeddedFileTest extends NbTestCase {
assertTrue(fileReached.get(0).endsWith(dirReached.toString() + "file.txt"));
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -211,7 +213,7 @@ public class EmbeddedFileTest extends NbTestCase {
assertTrue(checkFileInEmbeddedFolder(results.get(0)));
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -237,7 +239,7 @@ public class EmbeddedFileTest extends NbTestCase {
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -251,7 +253,7 @@ public class EmbeddedFileTest extends NbTestCase {
assertEquals("file.txt wasn't extracted from the file: zipFileWithTxtExtension.txt", "file.txt", results.get(0).getName());
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -270,7 +272,7 @@ public class EmbeddedFileTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
} else if (file.isFile() && !file.getName().endsWith("slack")) {
assertEquals(errMsg, "file.txt", file.getName());
@@ -289,7 +291,7 @@ public class EmbeddedFileTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
} else {
assertTrue(file.getNameExtension().equalsIgnoreCase("txt"));
@@ -28,7 +28,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import junit.framework.Test;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.casemodule.LocalFilesDSProcessor;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
@@ -117,7 +117,7 @@ public class IngestFileFiltersTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -153,7 +153,7 @@ public class IngestFileFiltersTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -198,7 +198,7 @@ public class IngestFileFiltersTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -234,7 +234,7 @@ public class IngestFileFiltersTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -283,7 +283,7 @@ public class IngestFileFiltersTest extends NbTestCase {
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -313,11 +313,11 @@ public class IngestFileFiltersTest extends NbTestCase {
assertEquals("PhotoRec Carver", errs.get(0).getModuleDisplayName());
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -364,7 +364,7 @@ public class IngestFileFiltersTest extends NbTestCase {
assertEquals(11, numTypeJpgFiles);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -27,7 +27,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import junit.framework.Test;
import org.netbeans.junit.NbTestCase;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.casemodule.services.FileManager;
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
@@ -151,7 +151,7 @@ public class EncryptionDetectionTest extends NbTestCase {
assertEquals(errorMessage, true, vol2Found);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -238,7 +238,7 @@ public class EncryptionDetectionTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -293,7 +293,7 @@ public class EncryptionDetectionTest extends NbTestCase {
assertEquals("Encrypted Container file should have one encyption suspected artifact", 1, numberOfEncryptedContainers);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
@@ -358,7 +358,7 @@ public class EncryptionDetectionTest extends NbTestCase {
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -26,7 +26,7 @@ import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import org.apache.commons.io.FileUtils;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CaseActionException;
import org.sleuthkit.autopsy.casemodule.CaseDetails;
@@ -54,7 +54,7 @@ public final class CaseUtils {
deleteCaseDir(caseDir);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
assertFalse("Unable to delete existing test directory", caseDir.exists());
// Create the test directory
@@ -66,7 +66,7 @@ public final class CaseUtils {
currentCase = Case.getCurrentCaseThrows();
} catch (CaseActionException | NoCurrentCaseException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
assertTrue(caseDir.exists());
@@ -100,7 +100,7 @@ public final class CaseUtils {
}
} catch (CaseActionException | IOException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -22,7 +22,7 @@ import java.nio.file.Path;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import org.openide.util.Exceptions;
import org.python.icu.impl.Assert;
import junit.framework.Assert;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
@@ -69,7 +69,7 @@ public final class IngestUtils {
}
} catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | InterruptedException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}
@@ -91,7 +91,7 @@ public final class IngestUtils {
assertEquals(joinedErrors.toString(), 0, errs.size());
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex);
Assert.fail(ex.getMessage());
}
}