mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
dummy hash values replaced with things which will actually pass normalization, exception handling revised to reflect presence of correlationattributenormalizationexception
This commit is contained in:
parent
0517b4654c
commit
d77ff585b9
@ -286,20 +286,16 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to update artifact with two CorrelationAttributeInstance instances
|
// Try to update artifact with two CorrelationAttributeInstance instances
|
||||||
// This appears to no longer be a valid test, already moved fail to the catch since it no longe fails.
|
|
||||||
try {
|
try {
|
||||||
CorrelationAttributeInstance attr1 = new CorrelationAttributeInstance("badHash", fileType, case1, dataSource1fromCase1, "badPath",
|
CorrelationAttributeInstance attr1 = new CorrelationAttributeInstance(randomHash(), fileType, case1, dataSource1fromCase1, "badPath",
|
||||||
"", TskData.FileKnown.KNOWN);
|
"", TskData.FileKnown.KNOWN);
|
||||||
CorrelationAttributeInstance attr2 = new CorrelationAttributeInstance("badHash", fileType, case1, dataSource1fromCase2, "badPath",
|
CorrelationAttributeInstance attr2 = new CorrelationAttributeInstance(randomHash(), fileType, case1, dataSource1fromCase2, "badPath",
|
||||||
"", TskData.FileKnown.KNOWN);
|
"", TskData.FileKnown.KNOWN);
|
||||||
|
|
||||||
EamDb.getInstance().setAttributeInstanceKnownStatus(attr1, TskData.FileKnown.BAD);
|
EamDb.getInstance().setAttributeInstanceKnownStatus(attr1, TskData.FileKnown.BAD);
|
||||||
EamDb.getInstance().setAttributeInstanceKnownStatus(attr2, TskData.FileKnown.BAD);
|
EamDb.getInstance().setAttributeInstanceKnownStatus(attr2, TskData.FileKnown.BAD);
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException | CorrelationAttributeNormalizationException ex) {
|
||||||
Assert.fail("setArtifactInstanceKnownStatus threw an exception for sequential Correlation Attribute Instances updates");
|
Assert.fail("setArtifactInstanceKnownStatus threw an exception for sequential Correlation Attribute Instances updates");
|
||||||
} catch (CorrelationAttributeNormalizationException ex) {
|
|
||||||
Exceptions.printStackTrace(ex);
|
|
||||||
fail(ex.getMessage());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to update null artifact
|
// Try to update null artifact
|
||||||
@ -312,7 +308,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
|
|
||||||
// Try to update artifact with null known status
|
// Try to update artifact with null known status
|
||||||
try {
|
try {
|
||||||
CorrelationAttributeInstance attr = new CorrelationAttributeInstance("badHash", fileType, case1, dataSource1fromCase1, "badPath",
|
CorrelationAttributeInstance attr = new CorrelationAttributeInstance(randomHash(), fileType, case1, dataSource1fromCase1, "badPath",
|
||||||
"", TskData.FileKnown.KNOWN);
|
"", TskData.FileKnown.KNOWN);
|
||||||
|
|
||||||
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, null);
|
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, null);
|
||||||
@ -326,7 +322,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
|
|
||||||
// Try to update artifact with null case
|
// Try to update artifact with null case
|
||||||
try {
|
try {
|
||||||
CorrelationAttributeInstance attr = new CorrelationAttributeInstance("badHash", fileType, null, dataSource1fromCase1, "badPath",
|
CorrelationAttributeInstance attr = new CorrelationAttributeInstance(randomHash(), fileType, null, dataSource1fromCase1, "badPath",
|
||||||
"", TskData.FileKnown.KNOWN);
|
"", TskData.FileKnown.KNOWN);
|
||||||
|
|
||||||
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, TskData.FileKnown.BAD);
|
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, TskData.FileKnown.BAD);
|
||||||
@ -340,7 +336,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
|
|
||||||
// Try to update artifact with null data source
|
// Try to update artifact with null data source
|
||||||
try {
|
try {
|
||||||
CorrelationAttributeInstance attr = new CorrelationAttributeInstance("badHash", fileType, case1, null, "badPath",
|
CorrelationAttributeInstance attr = new CorrelationAttributeInstance(randomHash(), fileType, case1, null, "badPath",
|
||||||
"", TskData.FileKnown.KNOWN);
|
"", TskData.FileKnown.KNOWN);
|
||||||
|
|
||||||
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, TskData.FileKnown.BAD);
|
EamDb.getInstance().setAttributeInstanceKnownStatus(attr, TskData.FileKnown.BAD);
|
||||||
@ -798,15 +794,15 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
EamDb.getInstance().addArtifactInstance(failAttrInst);
|
EamDb.getInstance().addArtifactInstance(failAttrInst);
|
||||||
fail("addArtifact failed to throw exception for null case");
|
fail("addArtifact failed to throw exception for null case");
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
// This is the expected behavior
|
fail("was expecting to get CorrelationAttributeNormalizationException");
|
||||||
} catch (CorrelationAttributeNormalizationException ex) {
|
} catch (CorrelationAttributeNormalizationException ex) {
|
||||||
fail("was expecting to get EamDbException");
|
// This is the expected behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test adding instance with invalid case ID
|
// Test adding instance with invalid case ID
|
||||||
try {
|
try {
|
||||||
CorrelationCase badCase = new CorrelationCase("badCaseUuid", "badCaseName");
|
CorrelationCase badCase = new CorrelationCase("badCaseUuid", "badCaseName");
|
||||||
CorrelationAttributeInstance failAttrInst2 = new CorrelationAttributeInstance("badInstances", fileType, badCase, dataSource1fromCase2, "badPath");
|
CorrelationAttributeInstance failAttrInst2 = new CorrelationAttributeInstance(randomHash(), fileType, badCase, dataSource1fromCase2, "badPath");
|
||||||
EamDb.getInstance().addArtifactInstance(failAttrInst2);
|
EamDb.getInstance().addArtifactInstance(failAttrInst2);
|
||||||
fail("addArtifact failed to throw exception for invalid case");
|
fail("addArtifact failed to throw exception for invalid case");
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
@ -817,7 +813,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
|
|
||||||
// Test adding instance with null data source
|
// Test adding instance with null data source
|
||||||
try {
|
try {
|
||||||
CorrelationAttributeInstance failAttrInst3 = new CorrelationAttributeInstance("badInstances", fileType, case1, null, "badPath");
|
CorrelationAttributeInstance failAttrInst3 = new CorrelationAttributeInstance(randomHash(), fileType, case1, null, "badPath");
|
||||||
EamDb.getInstance().addArtifactInstance(failAttrInst3);
|
EamDb.getInstance().addArtifactInstance(failAttrInst3);
|
||||||
fail("addArtifact failed to throw exception for null data source");
|
fail("addArtifact failed to throw exception for null data source");
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
@ -829,7 +825,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
// Test adding instance with invalid data source ID
|
// Test adding instance with invalid data source ID
|
||||||
try {
|
try {
|
||||||
CorrelationDataSource badDS = new CorrelationDataSource(case1, "badDSUuid", "badDSName");
|
CorrelationDataSource badDS = new CorrelationDataSource(case1, "badDSUuid", "badDSName");
|
||||||
CorrelationAttributeInstance failAttrInst4 = new CorrelationAttributeInstance("badInstances", fileType, case1, badDS, "badPath");
|
CorrelationAttributeInstance failAttrInst4 = new CorrelationAttributeInstance(randomHash(), fileType, case1, badDS, "badPath");
|
||||||
EamDb.getInstance().addArtifactInstance(failAttrInst4);
|
EamDb.getInstance().addArtifactInstance(failAttrInst4);
|
||||||
fail("addArtifact failed to throw exception for invalid data source");
|
fail("addArtifact failed to throw exception for invalid data source");
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
@ -841,7 +837,7 @@ public class CentralRepoDatamodelTest extends TestCase {
|
|||||||
// Test adding instance with null path
|
// Test adding instance with null path
|
||||||
// This will fail in the CorrelationAttributeInstance constructor
|
// This will fail in the CorrelationAttributeInstance constructor
|
||||||
try {
|
try {
|
||||||
new CorrelationAttributeInstance("badInstances", fileType, case1, dataSource1fromCase1, null);
|
new CorrelationAttributeInstance(randomHash(), fileType, case1, dataSource1fromCase1, null);
|
||||||
fail("CorrelationAttributeInstance failed to throw exception for null path");
|
fail("CorrelationAttributeInstance failed to throw exception for null path");
|
||||||
} catch (EamDbException ex) {
|
} catch (EamDbException ex) {
|
||||||
// This is the expected behavior
|
// This is the expected behavior
|
||||||
|
Loading…
x
Reference in New Issue
Block a user