From a43274134d91fba32a9d3ded70bc8b07c5672e6d Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dgrove" Date: Mon, 31 Dec 2018 16:50:27 -0500 Subject: [PATCH] Fixed tests. --- ...ngestedWithHashAndFileTypeInterCaseTests.java | 16 +++++++++++++--- .../commonfilessearch/InterCaseTestUtils.java | 4 ++-- 2 files changed, 15 insertions(+), 5 deletions(-) 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 1993b6a0f6..478c165eaa 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 @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.commonfilessearch; import java.nio.file.Path; import java.sql.SQLException; +import java.util.Set; import junit.framework.Test; import org.netbeans.junit.NbModuleSuite; import org.netbeans.junit.NbTestCase; @@ -96,7 +97,7 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { */ public void testOne() { try { - AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, this.utils.FILE_TYPE, 0); + AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, this.utils.FILE_TYPE, 100); CommonAttributeCountSearchResults metadata = builder.findMatchesByCount(); assertTrue("Results should not be empty", metadata.size() != 0); @@ -143,9 +144,18 @@ public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { */ public void testTwo() { try { - int matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(CASE2); + int matchesMustAlsoBeFoundInThisCase = 0; + + // Filter out the time stamp to get the correct case name. + Set caseNames = this.utils.getCaseMap().keySet(); + for (String caseName : caseNames) { + if (caseName.substring(0, caseName.length() - 20).equalsIgnoreCase(CASE2)) { + // Case match found. Get the number of matches. + matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(caseName); + } + } CorrelationAttributeInstance.Type fileType = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(0); - AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, false, false, fileType, 0); + AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, false, false, fileType, 100); CommonAttributeCountSearchResults metadata = builder.findMatchesByCount(); 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 01cf1f7bcc..917a34fc7c 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 @@ -426,7 +426,7 @@ class InterCaseTestUtils { boolean sameFileName = testFileName.equalsIgnoreCase(fileName); boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource); - boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase); + boolean sameCrCase = testCaseName.substring(0, testCaseName.length() - 20).equalsIgnoreCase(crCase); if (sameFileName && sameDataSource && sameCrCase) { tally++; @@ -443,7 +443,7 @@ class InterCaseTestUtils { final String testDataSource = node.getDataSource(); boolean sameFileName = testFileName.equalsIgnoreCase(fileName); - boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase); + boolean sameCaseName = testCaseName.substring(0, testCaseName.length() - 20).equalsIgnoreCase(crCase); boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource); if (sameFileName && sameDataSource && sameCaseName) {