diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/AllInterCaseCommonAttributeSearcher.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/AllInterCaseCommonAttributeSearcher.java index 74e3aabb2a..d86a4b9878 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/AllInterCaseCommonAttributeSearcher.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/AllInterCaseCommonAttributeSearcher.java @@ -33,6 +33,14 @@ import org.sleuthkit.datamodel.TskCoreException; */ public class AllInterCaseCommonAttributeSearcher extends InterCaseCommonAttributeSearcher { + /** + * + * @param filterByMediaMimeType match only on files whose mime types can be + * broadly categorized as media types + * @param filterByDocMimeType match only on files whose mime types can be + * broadly categorized as document types + * @throws EamDbException + */ public AllInterCaseCommonAttributeSearcher(boolean filterByMediaMimeType, boolean filterByDocMimeType) throws EamDbException { super(filterByMediaMimeType, filterByDocMimeType); } diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java index 5f82571576..3e7f2776a8 100755 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/centralrepository/datamodel/CentralRepoDatamodelTest.java @@ -853,6 +853,51 @@ public class CentralRepoDatamodelTest extends TestCase { Assert.fail(ex); } +<<<<<<< HEAD +======= +// // Test getting common instances with expected results +// try { +// List instances = EamDb.getInstance().getArtifactInstancesByCaseValues(Arrays.asList(inAllDataSourcesHash, inDataSource1twiceHash)); +// assertTrue("getArtifactInstancesByCaseValues returned " + instances.size() + " results - expected 5", instances.size() == 5); +// +// // This test works because all the instances of this hash were set to the same path +// for (CentralRepositoryFile inst : instances) { +// if(inst.getValue().equals(inAllDataSourcesHash)) { +// assertTrue("getArtifactInstancesByCaseValues returned instance with unexpected path " + inst.getFilePath(), +// inAllDataSourcesPath.equalsIgnoreCase(inst.getFilePath())); +// } +// else if(inst.getValue().equals(inDataSource1twiceHash)) { +// assertTrue("getArtifactInstancesByCaseValues returned instance with unexpected path " + inst.getFilePath(), +// inDataSource1twicePath1.equalsIgnoreCase(inst.getFilePath()) || inDataSource1twicePath2.equalsIgnoreCase(inst.getFilePath())); +// } +// } +// } catch (EamDbException ex) { +// Exceptions.printStackTrace(ex); +// Assert.fail(ex); +// } +// +// // Test getting instances expecting no results because they are not in the case +// try { +// CorrelationCase badCase = new CorrelationCase("badCaseUuid", "badCaseName"); +// List instances = EamDb.getInstance().getArtifactInstancesByCaseValues(badCase, Arrays.asList(inAllDataSourcesHash, inDataSource1twiceHash), 0); +// +// assertTrue("getArtifactInstancesByTypeValue returned " + instances.size() + " results - expected 0", instances.isEmpty()); +// } catch (EamDbException ex) { +// Exceptions.printStackTrace(ex); +// Assert.fail(ex); +// } +// +// +// // Test getting instances expecting no results because of bad hashes +// try { +// List instances = EamDb.getInstance().getArtifactInstancesByCaseValues(Arrays.asList("xyz", "123")); +// +// assertTrue("getArtifactInstancesByTypeValue returned " + instances.size() + " results - expected 0", instances.isEmpty()); +// } catch (EamDbException ex) { +// Exceptions.printStackTrace(ex); +// Assert.fail(ex); +// } +>>>>>>> 0468b6bd597a63c424d81b8569bb3df3bf8f7530 @@ -883,6 +928,20 @@ public class CentralRepoDatamodelTest extends TestCase { Exceptions.printStackTrace(ex); Assert.fail(ex); } +<<<<<<< HEAD +======= + +// // Test getting instances with null value +// // Should just return nothing +// try { +// List instances = EamDb.getInstance().getArtifactInstancesByCaseValues(null); +// +// assertTrue("getArtifactInstancesByTypeValue returned non-empty list for null value", instances.isEmpty()); +// } catch (EamDbException ex) { +// Exceptions.printStackTrace(ex); +// Assert.fail(ex); +// } +>>>>>>> 0468b6bd597a63c424d81b8569bb3df3bf8f7530 // Test getting instances with path that should produce results try { diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/IngestedWithHashAndFileTypeInterCaseTests.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/IngestedWithHashAndFileTypeInterCaseTests.java index 42d7a2052e..a6475e3124 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/IngestedWithHashAndFileTypeInterCaseTests.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/IngestedWithHashAndFileTypeInterCaseTests.java @@ -28,6 +28,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher; import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher; import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeSearchResults; +import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*; /** * If I use the search all cases option: One node for Hash A (1_1_A.jpg, @@ -72,7 +73,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { } /** - * Search All + * Search All cases * * One node for Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg) */ @@ -85,7 +86,36 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { assertTrue("Results should not be empty", metadata.size() != 0); - //assertTrue("") + //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, 1)); + + //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, 1)); } catch (Exception ex) { diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java index 805f227cf3..68388a646d 100644 --- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java +++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/commonfilessearch/InterCaseTestUtils.java @@ -73,13 +73,13 @@ import org.sleuthkit.datamodel.AbstractFile; - Hash-A.jpg - Hash-A.pdf +Data Set2 - - Hash-0.dat [testFile of size -0] + - Hash-0.dat [testFile of size 0] - Hash-A.jpg - Hash-A.pdf Case 2 +Data Set 1 - - Hash-A.jpg - - Hash-A.pdf + - Hash-B.jpg + - Hash-B.pdf +Data Set 2 - Hash-A.jpg - Hash-A.pdf @@ -94,7 +94,7 @@ import org.sleuthkit.datamodel.AbstractFile; +Data Set 2 - Hash-C.jpg [we should never find these!] - Hash-C.pdf - - Hash.D-doc + - Hash-D.doc */ class InterCaseTestUtils {