Fixed tests.

This commit is contained in:
U-BASIS\dgrove 2018-12-31 16:50:27 -05:00
parent cd8a044560
commit a43274134d
2 changed files with 15 additions and 5 deletions

View File

@ -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<String> 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();

View File

@ -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) {