mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
GP-2185 - removed JMockit usage from some tests (part 5)
This commit is contained in:
parent
0e3fe30c67
commit
0f633960fa
14 changed files with 835 additions and 248 deletions
|
@ -15,15 +15,13 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.feature.vt.api.markupitem;
|
package ghidra.feature.vt.api.markupitem;
|
||||||
|
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.createProgramCorrelator;
|
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.createRandomMarkupItemStub;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import ghidra.feature.vt.api.db.AssociationDatabaseManager;
|
|
||||||
import ghidra.feature.vt.api.main.*;
|
import ghidra.feature.vt.api.main.*;
|
||||||
import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
||||||
import ghidra.feature.vt.api.util.VersionTrackingApplyException;
|
import ghidra.feature.vt.api.util.VersionTrackingApplyException;
|
||||||
|
@ -31,18 +29,15 @@ import ghidra.feature.vt.db.VTBaseTestCase;
|
||||||
import ghidra.feature.vt.db.VTTestUtils;
|
import ghidra.feature.vt.db.VTTestUtils;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
import ghidra.util.task.TaskMonitorAdapter;
|
|
||||||
|
|
||||||
public class VTMarkupItemResetTest extends VTBaseTestCase {
|
public class VTMarkupItemResetTest extends VTBaseTestCase {
|
||||||
|
|
||||||
private int testTransactionID;
|
private int testTransactionID;
|
||||||
private AssociationDatabaseManager associationDBM;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
associationDBM = db.getAssociationManagerDBM();
|
|
||||||
testTransactionID = db.startTransaction("Test Match Set Setup");
|
testTransactionID = db.startTransaction("Test Match Set Setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +212,7 @@ public class VTMarkupItemResetTest extends VTBaseTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testDBMarkupItemStorageResetDoesntHappen_ClearDestinationAddress() {
|
public void testDBMarkupItemStorageResetDoesntHappen_ClearDestinationAddress() {
|
||||||
//
|
//
|
||||||
// Test that the markup item storage is not removed when the destination address is
|
// Test that the markup item storage is not removed when the destination address is
|
||||||
// cleared, but the considered status was set.
|
// cleared, but the considered status was set.
|
||||||
//
|
//
|
||||||
VTMatchSet matchSet = db.createMatchSet(
|
VTMatchSet matchSet = db.createMatchSet(
|
||||||
|
@ -246,14 +241,14 @@ public class VTMarkupItemResetTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
// Private Methods
|
// Private Methods
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private Collection<VTMarkupItem> getStoredMarkupItems(VTAssociation association) {
|
private Collection<VTMarkupItem> getStoredMarkupItems(VTAssociation association) {
|
||||||
Object markupItemManager = getInstanceField("markupManager", association);
|
Object markupItemManager = getInstanceField("markupManager", association);
|
||||||
return (Collection<VTMarkupItem>) invokeInstanceMethod("getStoredMarkupItems",
|
return (Collection<VTMarkupItem>) invokeInstanceMethod("getStoredMarkupItems",
|
||||||
markupItemManager, new Class[] { TaskMonitor.class },
|
markupItemManager, new Class[] { TaskMonitor.class },
|
||||||
new Object[] { TaskMonitorAdapter.DUMMY_MONITOR });
|
new Object[] { TaskMonitor.DUMMY });
|
||||||
}
|
}
|
||||||
|
|
||||||
private VTMarkupItemApplyActionType createRandomApplyAction(VTMarkupItem item) {
|
private VTMarkupItemApplyActionType createRandomApplyAction(VTMarkupItem item) {
|
||||||
|
|
|
@ -15,10 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.feature.vt.db;
|
package ghidra.feature.vt.db;
|
||||||
|
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.createProgramCorrelator;
|
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.createRandomMarkupItemStub;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
@ -38,10 +36,6 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
private int testTransactionID;
|
private int testTransactionID;
|
||||||
|
|
||||||
public UnappliedMarkupItemStorageDBTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -67,8 +61,8 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
MarkupItemStorageImpl storageImpl =
|
MarkupItemStorageImpl storageImpl =
|
||||||
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(100));
|
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(100));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setting the address with anything other than a user-defined address should not
|
// Setting the address with anything other than a user-defined address should not
|
||||||
// create a storage object
|
// create a storage object
|
||||||
//
|
//
|
||||||
String addressSource = "Test Source";
|
String addressSource = "Test Source";
|
||||||
|
@ -92,8 +86,8 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
MarkupItemStorageImpl storageImpl =
|
MarkupItemStorageImpl storageImpl =
|
||||||
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(100));
|
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(100));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setting the address with anything other than a user-defined address should not
|
// Setting the address with anything other than a user-defined address should not
|
||||||
// create a storage object
|
// create a storage object
|
||||||
//
|
//
|
||||||
String addressSource = "Test Source";
|
String addressSource = "Test Source";
|
||||||
|
@ -122,7 +116,7 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test that setting ignored to true creates a DB storage
|
// Test that setting ignored to true creates a DB storage
|
||||||
//
|
//
|
||||||
MarkupItemStorage newStorage = storageImpl.setStatus(VTMarkupItemStatus.DONT_CARE);
|
MarkupItemStorage newStorage = storageImpl.setStatus(VTMarkupItemStatus.DONT_CARE);
|
||||||
assertTrue("A database entry was not created when setting the storage to ignored",
|
assertTrue("A database entry was not created when setting the storage to ignored",
|
||||||
(newStorage instanceof MarkupItemStorageDB));
|
(newStorage instanceof MarkupItemStorageDB));
|
||||||
|
@ -134,7 +128,7 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test that any set destination address is retained when setting ignored to true and false
|
// Test that any set destination address is retained when setting ignored to true and false
|
||||||
//
|
//
|
||||||
|
|
||||||
storageImpl =
|
storageImpl =
|
||||||
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(200));
|
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(200));
|
||||||
|
@ -188,7 +182,7 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Test that any set destination address is retained when setting apply failed to true and false
|
// Test that any set destination address is retained when setting apply failed to true and false
|
||||||
//
|
//
|
||||||
storageImpl =
|
storageImpl =
|
||||||
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(200));
|
new MarkupItemStorageImpl(association, MarkupTypeTestStub.INSTANCE, addr(200));
|
||||||
|
|
||||||
|
@ -227,10 +221,10 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testLoadingUnappliedMarkupItemFindsExistingStorageRecord()
|
public void testLoadingUnappliedMarkupItemFindsExistingStorageRecord()
|
||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
//
|
//
|
||||||
// Test that if we create a DB object, that a new 'equivalent' markup item will find and
|
// Test that if we create a DB object, that a new 'equivalent' markup item will find and
|
||||||
// use the matching DB record.
|
// use the matching DB record.
|
||||||
//
|
//
|
||||||
VTMatch match = createMatchSetWithOneMatch();
|
VTMatch match = createMatchSetWithOneMatch();
|
||||||
|
|
||||||
VTMarkupItem markupItem = createRandomMarkupItemStub(match);
|
VTMarkupItem markupItem = createRandomMarkupItemStub(match);
|
||||||
|
@ -254,10 +248,10 @@ public class UnappliedMarkupItemStorageDBTest extends VTBaseTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testLoadingUnappliedMarkupItemWithNoExistingStorageRecord()
|
public void testLoadingUnappliedMarkupItemWithNoExistingStorageRecord()
|
||||||
throws CancelledException {
|
throws CancelledException {
|
||||||
//
|
//
|
||||||
// Test that if we create a DB object, that a new 'equivalent' markup item will find and
|
// Test that if we create a DB object, that a new 'equivalent' markup item will find and
|
||||||
// use the matching DB record.
|
// use the matching DB record.
|
||||||
//
|
//
|
||||||
VTMatch match = createMatchSetWithOneMatch();
|
VTMatch match = createMatchSetWithOneMatch();
|
||||||
|
|
||||||
VTMarkupItem markupItem = createRandomMarkupItemStub(match);
|
VTMarkupItem markupItem = createRandomMarkupItemStub(match);
|
||||||
|
|
|
@ -16,8 +16,7 @@
|
||||||
package ghidra.feature.vt.db;
|
package ghidra.feature.vt.db;
|
||||||
|
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.*;
|
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -33,18 +32,11 @@ import ghidra.feature.vt.api.util.VersionTrackingApplyException;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.util.exception.CancelledException;
|
import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
import ghidra.util.task.TaskMonitorAdapter;
|
|
||||||
import mockit.Mocked;
|
|
||||||
import mockit.Verifications;
|
|
||||||
|
|
||||||
public class VTAssociationDBTest extends VTBaseTestCase {
|
public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
private int testTransactionID;
|
private int testTransactionID;
|
||||||
|
|
||||||
public VTAssociationDBTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -57,7 +49,6 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
db.endTransaction(testTransactionID, false);
|
db.endTransaction(testTransactionID, false);
|
||||||
db.release(VTTestUtils.class);
|
db.release(VTTestUtils.class);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -94,15 +85,15 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//
|
//
|
||||||
// now test remove
|
// now test remove
|
||||||
//
|
//
|
||||||
|
|
||||||
// just doing an unapply will not remove the DB, since we have put in a custom,
|
// just doing an unapply will not remove the DB, since we have put in a custom,
|
||||||
// USER_DEFINED address above...
|
// USER_DEFINED address above...
|
||||||
markupItemFromDB.unapply();
|
markupItemFromDB.unapply();
|
||||||
markupItems = getStoredMarkupItems(association);
|
markupItems = getStoredMarkupItems(association);
|
||||||
assertEquals(1, markupItems.size());
|
assertEquals(1, markupItems.size());
|
||||||
|
|
||||||
// ...now that we have unapplied, check that clearing the address will trigger a
|
// ...now that we have unapplied, check that clearing the address will trigger a
|
||||||
// DB removal
|
// DB removal
|
||||||
markupItem.setDestinationAddress(null);
|
markupItem.setDestinationAddress(null);
|
||||||
markupItems = getStoredMarkupItems(association);
|
markupItems = getStoredMarkupItems(association);
|
||||||
|
@ -143,7 +134,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
Object markupItemManager = getInstanceField("markupManager", association);
|
Object markupItemManager = getInstanceField("markupManager", association);
|
||||||
return (Collection<VTMarkupItem>) invokeInstanceMethod("getStoredMarkupItems",
|
return (Collection<VTMarkupItem>) invokeInstanceMethod("getStoredMarkupItems",
|
||||||
markupItemManager, new Class[] { TaskMonitor.class },
|
markupItemManager, new Class[] { TaskMonitor.class },
|
||||||
new Object[] { TaskMonitorAdapter.DUMMY_MONITOR });
|
new Object[] { TaskMonitor.DUMMY });
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -152,7 +143,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
createProgramCorrelator(null, db.getSourceProgram(), db.getDestinationProgram()));
|
createProgramCorrelator(null, db.getSourceProgram(), db.getDestinationProgram()));
|
||||||
|
|
||||||
//
|
//
|
||||||
// To create our locking scenario we will create associations that are related and
|
// To create our locking scenario we will create associations that are related and
|
||||||
// unrelated. This allows us to test that competing associations will get locked-out
|
// unrelated. This allows us to test that competing associations will get locked-out
|
||||||
// when any related associations are applied. Also, unrelated associations should not
|
// when any related associations are applied. Also, unrelated associations should not
|
||||||
// be locked-out.
|
// be locked-out.
|
||||||
|
@ -184,7 +175,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
//
|
//
|
||||||
// test no locked associations when no committed markup items
|
// test no locked associations when no committed markup items
|
||||||
//
|
//
|
||||||
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
||||||
assertEquals(VTAssociationStatus.AVAILABLE, relatedAssociation.getStatus());
|
assertEquals(VTAssociationStatus.AVAILABLE, relatedAssociation.getStatus());
|
||||||
assertEquals(VTAssociationStatus.AVAILABLE, unrelatedAssociation.getStatus());
|
assertEquals(VTAssociationStatus.AVAILABLE, unrelatedAssociation.getStatus());
|
||||||
|
@ -193,10 +184,10 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
|
|
||||||
Address destinationAddress = addr();
|
Address destinationAddress = addr();
|
||||||
|
|
||||||
//
|
//
|
||||||
// commit an item and make sure the association is locked and competing associations are
|
// commit an item and make sure the association is locked and competing associations are
|
||||||
// locked-out
|
// locked-out
|
||||||
//
|
//
|
||||||
mainMarkupItem.setDestinationAddress(destinationAddress);
|
mainMarkupItem.setDestinationAddress(destinationAddress);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -211,9 +202,9 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
assertEquals(VTAssociationStatus.BLOCKED, conflict1Association.getStatus());
|
assertEquals(VTAssociationStatus.BLOCKED, conflict1Association.getStatus());
|
||||||
assertEquals(VTAssociationStatus.BLOCKED, conflict2Association.getStatus());
|
assertEquals(VTAssociationStatus.BLOCKED, conflict2Association.getStatus());
|
||||||
|
|
||||||
//
|
//
|
||||||
// verify we cannot commit from a competing association (others are locked-out)
|
// verify we cannot commit from a competing association (others are locked-out)
|
||||||
//
|
//
|
||||||
VTMarkupItem unappliedConflictItem = conflict1MarkupItem;
|
VTMarkupItem unappliedConflictItem = conflict1MarkupItem;
|
||||||
try {
|
try {
|
||||||
unappliedConflictItem.setDestinationAddress(destinationAddress);
|
unappliedConflictItem.setDestinationAddress(destinationAddress);
|
||||||
|
@ -597,8 +588,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
createRandomMarkupItemStub(match, addr());// second item
|
createRandomMarkupItemStub(match, addr());// second item
|
||||||
|
|
||||||
VTAssociation association = match.getAssociation();
|
VTAssociation association = match.getAssociation();
|
||||||
Collection<VTMarkupItem> items =
|
Collection<VTMarkupItem> items = association.getMarkupItems(TaskMonitor.DUMMY);
|
||||||
association.getMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);
|
|
||||||
assertEquals("Did not find multiple markup items as expected", 2, items.size());
|
assertEquals("Did not find multiple markup items as expected", 2, items.size());
|
||||||
VTMarkupItemApplyActionType applyAction = createRandomSuccessfulApplyAction(markupItem);
|
VTMarkupItemApplyActionType applyAction = createRandomSuccessfulApplyAction(markupItem);
|
||||||
|
|
||||||
|
@ -637,8 +627,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
VTMarkupItem secondAppliedItem = createRandomMarkupItemStub(match, addr());// second item
|
VTMarkupItem secondAppliedItem = createRandomMarkupItemStub(match, addr());// second item
|
||||||
|
|
||||||
VTAssociation association = match.getAssociation();
|
VTAssociation association = match.getAssociation();
|
||||||
Collection<VTMarkupItem> items =
|
Collection<VTMarkupItem> items = association.getMarkupItems(TaskMonitor.DUMMY);
|
||||||
association.getMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);
|
|
||||||
assertEquals("Did not find multiple markup items as expected", 2, items.size());
|
assertEquals("Did not find multiple markup items as expected", 2, items.size());
|
||||||
VTMarkupItemApplyActionType applyAction = createRandomSuccessfulApplyAction(markupItem);
|
VTMarkupItemApplyActionType applyAction = createRandomSuccessfulApplyAction(markupItem);
|
||||||
|
|
||||||
|
@ -706,23 +695,20 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAssociationHook(@Mocked final AssociationHook mockHook) throws Exception {
|
public void testAssociationHook() throws Exception {
|
||||||
|
|
||||||
VTMatchSet matchSet = db.createMatchSet(
|
VTMatchSet matchSet = db.createMatchSet(
|
||||||
createProgramCorrelator(null, db.getSourceProgram(), db.getDestinationProgram()));
|
createProgramCorrelator(null, db.getSourceProgram(), db.getDestinationProgram()));
|
||||||
VTMatchInfo mainMatchInfo = createRandomMatch(db);
|
VTMatchInfo mainMatchInfo = createRandomMatch(db);
|
||||||
VTMatch mainMatch = addMatch(matchSet, mainMatchInfo);
|
VTMatch mainMatch = addMatch(matchSet, mainMatchInfo);
|
||||||
final VTAssociation association = mainMatch.getAssociation();
|
SpyAssociationHook spyHook = new SpyAssociationHook();
|
||||||
|
|
||||||
db.addAssociationHook(mockHook);
|
db.addAssociationHook(spyHook);
|
||||||
mainMatch.getAssociation().setAccepted();
|
mainMatch.getAssociation().setAccepted();
|
||||||
mainMatch.getAssociation().clearStatus();
|
mainMatch.getAssociation().clearStatus();
|
||||||
|
|
||||||
new Verifications() {
|
assertTrue(spyHook.acceptedCalled);
|
||||||
{
|
assertTrue(spyHook.clearedCalled);
|
||||||
mockHook.associationAccepted(association);
|
|
||||||
mockHook.associationCleared(association);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -756,8 +742,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
||||||
|
|
||||||
VTMarkupItem markupItem = VTTestUtils.createRandomMarkupItemStub(mainMatch);
|
VTMarkupItem markupItem = VTTestUtils.createRandomMarkupItemStub(mainMatch);
|
||||||
Collection<VTMarkupItem> items =
|
Collection<VTMarkupItem> items = mainAssociation.getMarkupItems(TaskMonitor.DUMMY);
|
||||||
mainAssociation.getMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);
|
|
||||||
assertEquals(1, items.size());
|
assertEquals(1, items.size());
|
||||||
|
|
||||||
mainAssociation.setRejected();
|
mainAssociation.setRejected();
|
||||||
|
@ -784,8 +769,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
assertEquals(VTAssociationStatus.AVAILABLE, mainAssociation.getStatus());
|
||||||
|
|
||||||
VTMarkupItem markupItem = VTTestUtils.createRandomMarkupItemStub(mainMatch);
|
VTMarkupItem markupItem = VTTestUtils.createRandomMarkupItemStub(mainMatch);
|
||||||
Collection<VTMarkupItem> items =
|
Collection<VTMarkupItem> items = mainAssociation.getMarkupItems(TaskMonitor.DUMMY);
|
||||||
mainAssociation.getMarkupItems(TaskMonitorAdapter.DUMMY_MONITOR);
|
|
||||||
assertEquals(1, items.size());
|
assertEquals(1, items.size());
|
||||||
|
|
||||||
mainAssociation.setAccepted();
|
mainAssociation.setAccepted();
|
||||||
|
@ -831,7 +815,7 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
// implementation for a test dummy.
|
// implementation for a test dummy.
|
||||||
VTAssociationDB associationDB = (VTAssociationDB) newMatch.getAssociation();
|
VTAssociationDB associationDB = (VTAssociationDB) newMatch.getAssociation();
|
||||||
setInstanceField("markupManager", associationDB,
|
setInstanceField("markupManager", associationDB,
|
||||||
new MarkupItemManagerImplDummy(associationDB));
|
new DummyMarkupItemManagerImpl(associationDB));
|
||||||
|
|
||||||
return newMatch;
|
return newMatch;
|
||||||
}
|
}
|
||||||
|
@ -847,9 +831,9 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
// Inner Classes
|
// Inner Classes
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
|
|
||||||
private class MarkupItemManagerImplDummy extends MarkupItemManagerImpl {
|
private class DummyMarkupItemManagerImpl extends MarkupItemManagerImpl {
|
||||||
|
|
||||||
MarkupItemManagerImplDummy(VTAssociationDB associationDB) {
|
DummyMarkupItemManagerImpl(VTAssociationDB associationDB) {
|
||||||
super(associationDB);
|
super(associationDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,4 +843,26 @@ public class VTAssociationDBTest extends VTBaseTestCase {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SpyAssociationHook implements AssociationHook {
|
||||||
|
|
||||||
|
boolean acceptedCalled;
|
||||||
|
boolean clearedCalled;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void associationAccepted(VTAssociation association) {
|
||||||
|
acceptedCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void associationCleared(VTAssociation association) {
|
||||||
|
clearedCalled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markupItemStatusChanged(VTMarkupItem markupItem) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
package ghidra.feature.vt.db;
|
package ghidra.feature.vt.db;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -25,27 +24,41 @@ import generic.test.AbstractGenericTest;
|
||||||
import ghidra.feature.vt.api.db.VTSessionDB;
|
import ghidra.feature.vt.api.db.VTSessionDB;
|
||||||
import ghidra.feature.vt.api.main.*;
|
import ghidra.feature.vt.api.main.*;
|
||||||
import ghidra.framework.model.DomainFile;
|
import ghidra.framework.model.DomainFile;
|
||||||
|
import ghidra.framework.model.TestDummyDomainFile;
|
||||||
import ghidra.program.database.map.AddressMap;
|
import ghidra.program.database.map.AddressMap;
|
||||||
|
import ghidra.program.model.StubFunctionManager;
|
||||||
|
import ghidra.program.model.StubProgram;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.mem.Memory;
|
import ghidra.program.model.mem.Memory;
|
||||||
|
import ghidra.program.model.mem.StubMemory;
|
||||||
import ghidra.program.model.symbol.*;
|
import ghidra.program.model.symbol.*;
|
||||||
import mockit.*;
|
|
||||||
|
|
||||||
public class VTBaseTestCase extends AbstractGenericTest {
|
public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
@Injectable
|
|
||||||
Program sourceProgram, destinationProgram;
|
private DomainFile sourceDomainFile = new TestDummyDomainFile(null, "SourceDomainFile") {
|
||||||
@Mocked
|
@Override
|
||||||
FunctionManager functionManager;
|
public String getFileID() {
|
||||||
@Mocked
|
return "Source Program " + testID;
|
||||||
Listing listing;
|
}
|
||||||
@Mocked
|
};
|
||||||
SymbolTable symbolTable;
|
private DomainFile destinationDomainFile =
|
||||||
@Injectable
|
new TestDummyDomainFile(null, "DestinationDomainFile") {
|
||||||
DomainFile sourceDomainFile, destinationDomainFile;
|
@Override
|
||||||
@Mocked
|
public String getFileID() {
|
||||||
Memory memory;
|
return "Destination Program " + testID;
|
||||||
AddressMap addressMap = new AddressMapTestDummy();
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Program sourceProgram = new VTStubProgram(sourceDomainFile);
|
||||||
|
private Program destinationProgram = new VTStubProgram(destinationDomainFile);
|
||||||
|
private FunctionManager functionManager = new VTSTubFunctionManager();
|
||||||
|
private Listing listing = new VTStubListing();
|
||||||
|
private SymbolTable symbolTable = new VTStubSymbolTable();
|
||||||
|
private Memory memory = new VTStubMemory();
|
||||||
|
|
||||||
|
private AddressMap addressMap = new AddressMapTestDummy();
|
||||||
|
|
||||||
private static String[] randomTags = { "TAG1", "TAG2", "TAG3" };
|
private static String[] randomTags = { "TAG1", "TAG2", "TAG3" };
|
||||||
private static GenericAddressSpace space =
|
private static GenericAddressSpace space =
|
||||||
new GenericAddressSpace("Test", 32, AddressSpace.TYPE_RAM, 3);
|
new GenericAddressSpace("Test", 32, AddressSpace.TYPE_RAM, 3);
|
||||||
|
@ -57,9 +70,6 @@ public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
testID++;
|
testID++;
|
||||||
setupCommonExpectations();
|
|
||||||
setupSourceProgramExpectations();
|
|
||||||
setupDestinationProgramExpectations();
|
|
||||||
db = createVTSession();
|
db = createVTSession();
|
||||||
transactionID = db.startTransaction("Test");
|
transactionID = db.startTransaction("Test");
|
||||||
}
|
}
|
||||||
|
@ -75,107 +85,6 @@ public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
VTTestUtils.class);
|
VTTestUtils.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCommonExpectations() {
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
functionManager.getFunctionContaining((Address) any);
|
|
||||||
minTimes = 0;
|
|
||||||
result = null;
|
|
||||||
|
|
||||||
functionManager.getFunctionAt((Address) any);
|
|
||||||
minTimes = 0;
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
listing.getCodeUnitAt((Address) any);
|
|
||||||
minTimes = 0;
|
|
||||||
result = null;
|
|
||||||
|
|
||||||
listing.getCommentAddressIterator(anyInt, null, true);
|
|
||||||
minTimes = 0;
|
|
||||||
result = new EmptyAddressIterator();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
symbolTable.getPrimarySymbolIterator((AddressSetView) any, true);
|
|
||||||
minTimes = 0;
|
|
||||||
result = new SymbolIteratorAdapter(new ArrayList<Symbol>().iterator());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupDestinationProgramExpectations() {
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
destinationDomainFile.getFileID();
|
|
||||||
result = "Destination Program " + testID;
|
|
||||||
destinationProgram.getDomainFile();
|
|
||||||
result = destinationDomainFile;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setupProgramExpectations(destinationProgram);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupSourceProgramExpectations() {
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
sourceDomainFile.getFileID();
|
|
||||||
result = "Source Program " + testID;
|
|
||||||
sourceProgram.getDomainFile();
|
|
||||||
result = sourceDomainFile;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setupProgramExpectations(sourceProgram);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupProgramExpectations(final Program program) {
|
|
||||||
new Expectations() {
|
|
||||||
{
|
|
||||||
program.addConsumer(any);
|
|
||||||
minTimes = 0;
|
|
||||||
program.release(any);
|
|
||||||
minTimes = 0;
|
|
||||||
program.getUniqueProgramID();
|
|
||||||
minTimes = 0;
|
|
||||||
result = testID;
|
|
||||||
|
|
||||||
program.getMemory();
|
|
||||||
minTimes = 0;
|
|
||||||
result = memory;
|
|
||||||
|
|
||||||
program.getAddressMap();
|
|
||||||
minTimes = 0;
|
|
||||||
result = addressMap;
|
|
||||||
|
|
||||||
program.getFunctionManager();
|
|
||||||
minTimes = 0;
|
|
||||||
result = functionManager;
|
|
||||||
|
|
||||||
program.getListing();
|
|
||||||
minTimes = 0;
|
|
||||||
result = listing;
|
|
||||||
|
|
||||||
program.getAddressFactory();
|
|
||||||
minTimes = 0;
|
|
||||||
result = null;
|
|
||||||
|
|
||||||
program.getSymbolTable();
|
|
||||||
minTimes = 0;
|
|
||||||
result = symbolTable;
|
|
||||||
|
|
||||||
program.getModificationNumber();
|
|
||||||
minTimes = 0;
|
|
||||||
result = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getRandomInt() {
|
public static int getRandomInt() {
|
||||||
return getRandomInt(0, Integer.MAX_VALUE);
|
return getRandomInt(0, Integer.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
@ -190,7 +99,7 @@ public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a random match.
|
* Create a random match.
|
||||||
* @param session the match set manager to use when creating a random tag or
|
* @param session the match set manager to use when creating a random tag or
|
||||||
* null if you don't want to create a random tag.
|
* null if you don't want to create a random tag.
|
||||||
* @return the match
|
* @return the match
|
||||||
*/
|
*/
|
||||||
|
@ -200,8 +109,9 @@ public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a random match
|
* Create a random match
|
||||||
* @param association the association to use for the source and destination address.
|
* @param sourceAddress the source address
|
||||||
* @param session the match set manager to use when creating a random tag or
|
* @param destinationAddress the destination address
|
||||||
|
* @param session the match set manager to use when creating a random tag or
|
||||||
* null if you don't want to create a random tag.
|
* null if you don't want to create a random tag.
|
||||||
* @return the match
|
* @return the match
|
||||||
*/
|
*/
|
||||||
|
@ -237,4 +147,111 @@ public class VTBaseTestCase extends AbstractGenericTest {
|
||||||
String name = randomTags[randomInt];
|
String name = randomTags[randomInt];
|
||||||
return session.createMatchTag(name);
|
return session.createMatchTag(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================================
|
||||||
|
// Inner Classes
|
||||||
|
//=================================================================================================
|
||||||
|
|
||||||
|
private class VTStubMemory extends StubMemory {
|
||||||
|
@Override
|
||||||
|
public AddressRangeIterator getAddressRanges() {
|
||||||
|
return new EmptyAddressRangeIterator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VTStubSymbolTable extends StubSymbolTable {
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getPrimarySymbolIterator(AddressSetView asv, boolean forward) {
|
||||||
|
return SymbolIterator.EMPTY_ITERATOR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VTStubListing extends StubListing {
|
||||||
|
@Override
|
||||||
|
public CodeUnit getCodeUnitAt(Address addr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressIterator getCommentAddressIterator(int commentType, AddressSetView addrSet,
|
||||||
|
boolean forward) {
|
||||||
|
return new EmptyAddressIterator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VTSTubFunctionManager extends StubFunctionManager {
|
||||||
|
@Override
|
||||||
|
public Function getFunctionContaining(Address addr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Function getFunctionAt(Address entryPoint) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class VTStubProgram extends StubProgram {
|
||||||
|
|
||||||
|
private DomainFile domainFile;
|
||||||
|
|
||||||
|
VTStubProgram(DomainFile domainFile) {
|
||||||
|
this.domainFile = domainFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DomainFile getDomainFile() {
|
||||||
|
return domainFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getUniqueProgramID() {
|
||||||
|
return testID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addConsumer(Object consumer) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void release(Object consumer) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Memory getMemory() {
|
||||||
|
return memory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressMap getAddressMap() {
|
||||||
|
return addressMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FunctionManager getFunctionManager() {
|
||||||
|
return functionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Listing getListing() {
|
||||||
|
return listing;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressFactory getAddressFactory() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolTable getSymbolTable() {
|
||||||
|
return symbolTable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getModificationNumber() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
*/
|
*/
|
||||||
package ghidra.feature.vt.db;
|
package ghidra.feature.vt.db;
|
||||||
|
|
||||||
import static ghidra.feature.vt.db.VTTestUtils.createProgramCorrelator;
|
import static ghidra.feature.vt.db.VTTestUtils.*;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,8 +31,6 @@ import ghidra.feature.vt.api.util.VTAssociationStatusException;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.program.model.address.Address;
|
import ghidra.program.model.address.Address;
|
||||||
import ghidra.util.Msg;
|
import ghidra.util.Msg;
|
||||||
import mockit.Mock;
|
|
||||||
import mockit.MockUp;
|
|
||||||
|
|
||||||
public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
||||||
|
|
||||||
|
@ -52,10 +50,6 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public VTDomainObjectEventsTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
@ -71,19 +65,14 @@ public class VTDomainObjectEventsTest extends VTBaseTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T extends GhidraTimer> void disableDocsTimer() {
|
private <T extends GhidraTimer> void disableDocsTimer() {
|
||||||
// The DomainObjectChangeSupport class uses a timer. In SOP, the timer fires its
|
// The DomainObjectChangeSupport class uses a timer. In SOP, the timer fires its
|
||||||
// events on the Swing thread.
|
// events on the Swing thread.
|
||||||
// We are in a headless environment. Resultingly, we cannot use the Swing thread to
|
// We are in a headless environment. Resultingly, we cannot use the Swing thread to
|
||||||
// synchronize events when we flush them. Here we mock the timer, preventing it
|
// synchronize events when we flush them. Here we mock the timer, preventing it
|
||||||
// from starting. Without the timer, we can rely on our flushing of the queued events.
|
// from starting. Without the timer, we can rely on our flushing of the queued events.
|
||||||
|
|
||||||
new MockUp<T>() {
|
// TODO Not sure we need to disable this timer any more. Leaving this comment here for
|
||||||
@Mock
|
// a while in case we get sporadic test failures
|
||||||
public void start() {
|
|
||||||
// never let the timer start
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,28 +28,23 @@ import ghidra.feature.vt.api.impl.VersionTrackingChangeRecord;
|
||||||
import ghidra.feature.vt.api.main.*;
|
import ghidra.feature.vt.api.main.*;
|
||||||
import ghidra.feature.vt.db.DummyTestProgramCorrelator;
|
import ghidra.feature.vt.db.DummyTestProgramCorrelator;
|
||||||
import ghidra.feature.vt.db.VTBaseTestCase;
|
import ghidra.feature.vt.db.VTBaseTestCase;
|
||||||
import ghidra.feature.vt.gui.plugin.VTController;
|
import ghidra.feature.vt.gui.plugin.*;
|
||||||
import ghidra.feature.vt.gui.plugin.VTControllerListener;
|
import ghidra.feature.vt.gui.util.MatchInfo;
|
||||||
import ghidra.framework.data.DummyDomainObject;
|
import ghidra.framework.data.DummyDomainObject;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.DomainObjectChangeRecord;
|
||||||
|
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||||
|
import ghidra.framework.options.Options;
|
||||||
import ghidra.framework.plugintool.ServiceProvider;
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
import ghidra.program.model.listing.Program;
|
import ghidra.program.model.listing.Program;
|
||||||
import mockit.*;
|
|
||||||
|
|
||||||
public class TagFilterTest extends VTBaseTestCase {
|
public class TagFilterTest extends VTBaseTestCase {
|
||||||
@Mocked
|
|
||||||
VTController controller;
|
private VTController controller;
|
||||||
@Mocked
|
|
||||||
DomainFile domainFile;
|
|
||||||
|
|
||||||
private TagFilter tagFilter;
|
private TagFilter tagFilter;
|
||||||
private TestTagFilterChooser excludedTagChooser;
|
private TestTagFilterChooser excludedTagChooser;
|
||||||
|
|
||||||
private VTControllerListener listener;
|
private VTControllerListener listener = new StubControllerListener();
|
||||||
|
|
||||||
public TagFilterTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Before
|
@Before
|
||||||
|
@ -69,7 +64,7 @@ public class TagFilterTest extends VTBaseTestCase {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Test
|
@Test
|
||||||
public void testFilterWithNoTags() {
|
public void testFilterWithNoTags() {
|
||||||
//
|
//
|
||||||
// test that a match set with no tags applied has no items filtered
|
// test that a match set with no tags applied has no items filtered
|
||||||
//
|
//
|
||||||
VTSession session = controller.getSession();
|
VTSession session = controller.getSession();
|
||||||
|
@ -117,7 +112,7 @@ public class TagFilterTest extends VTBaseTestCase {
|
||||||
public void testMatchesPassFilterWithIncludedTags() {
|
public void testMatchesPassFilterWithIncludedTags() {
|
||||||
//
|
//
|
||||||
// Test that an applied filter will include only those tags chosen to pass the filter
|
// Test that an applied filter will include only those tags chosen to pass the filter
|
||||||
//
|
//
|
||||||
VTMatchTag fooTag = new TestMatchTag("Foo");
|
VTMatchTag fooTag = new TestMatchTag("Foo");
|
||||||
VTMatchTag barTag = new TestMatchTag("Bar");
|
VTMatchTag barTag = new TestMatchTag("Bar");
|
||||||
VTMatchTag bazTag = new TestMatchTag("Baz");
|
VTMatchTag bazTag = new TestMatchTag("Baz");
|
||||||
|
@ -239,7 +234,7 @@ public class TagFilterTest extends VTBaseTestCase {
|
||||||
|
|
||||||
assertPassesFilter(fooTagMatch1, untaggedMatch1, barTagMatch1);
|
assertPassesFilter(fooTagMatch1, untaggedMatch1, barTagMatch1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// now filter out an item and then remove that item
|
// now filter out an item and then remove that item
|
||||||
//
|
//
|
||||||
excludedTagChooser.setExcludedTags(fooTag);
|
excludedTagChooser.setExcludedTags(fooTag);
|
||||||
|
@ -338,23 +333,54 @@ public class TagFilterTest extends VTBaseTestCase {
|
||||||
|
|
||||||
// controller creation
|
// controller creation
|
||||||
private VTController createController() {
|
private VTController createController() {
|
||||||
final VTSession session = createSession();
|
VTSession session = createSession();
|
||||||
|
return new StubVTController() {
|
||||||
|
@Override
|
||||||
|
public VTSession getSession() {
|
||||||
|
return session;
|
||||||
|
}
|
||||||
|
|
||||||
new Expectations() {
|
@Override
|
||||||
{
|
public void addListener(VTControllerListener l) {
|
||||||
controller.addListener(with(new ListenerDelegate()));
|
// stub
|
||||||
controller.getSession();
|
|
||||||
result = session;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return controller;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ListenerDelegate implements Delegate<VTControllerListener> {
|
class StubControllerListener implements VTControllerListener {
|
||||||
void validate(VTControllerListener l) {
|
void validate(VTControllerListener l) {
|
||||||
listener = l;
|
listener = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionChanged(VTSession session) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void matchSelected(MatchInfo matchInfo) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionUpdated(DomainObjectChangedEvent ev) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markupItemSelected(VTMarkupItem markupItem) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void optionsChanged(Options options) {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disposed() {
|
||||||
|
// stub
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private VTSessionDB createSession() {
|
private VTSessionDB createSession() {
|
||||||
|
|
|
@ -0,0 +1,251 @@
|
||||||
|
/* ###
|
||||||
|
* IP: GHIDRA
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package ghidra.feature.vt.gui.plugin;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import docking.ActionContext;
|
||||||
|
import ghidra.app.plugin.core.colorizer.ColorizingService;
|
||||||
|
import ghidra.feature.vt.api.main.*;
|
||||||
|
import ghidra.feature.vt.gui.task.VtTask;
|
||||||
|
import ghidra.feature.vt.gui.util.MatchInfo;
|
||||||
|
import ghidra.framework.model.DomainFile;
|
||||||
|
import ghidra.framework.model.DomainObjectChangedEvent;
|
||||||
|
import ghidra.framework.options.SaveState;
|
||||||
|
import ghidra.framework.options.ToolOptions;
|
||||||
|
import ghidra.framework.plugintool.PluginTool;
|
||||||
|
import ghidra.framework.plugintool.ServiceProvider;
|
||||||
|
import ghidra.program.model.address.AddressSetView;
|
||||||
|
import ghidra.program.model.listing.*;
|
||||||
|
import ghidra.program.model.symbol.Symbol;
|
||||||
|
import ghidra.program.util.AddressCorrelation;
|
||||||
|
import ghidra.program.util.ProgramLocation;
|
||||||
|
|
||||||
|
public class StubVTController implements VTController {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addListener(VTControllerListener listener) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeListener(VTControllerListener listener) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VTSession getSession() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openVersionTrackingSession(DomainFile domainFile) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openVersionTrackingSession(VTSession session) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean closeVersionTrackingSession() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeCurrentSessionIgnoringChanges() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readConfigState(SaveState saveState) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeConfigState(SaveState saveState) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Program getSourceProgram() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Program getDestinationProgram() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkForUnSavedChanges() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressCorrelation getCorrelator(Function source, Function destination) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressCorrelation getCorrelator(Data source, Data destination) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VTMarkupItem getCurrentMarkupForLocation(ProgramLocation location, Program program) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VTMarkupItem> getMarkupItems(ActionContext context) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ToolOptions getOptions() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getParentComponent() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServiceProvider getServiceProvider() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersionTrackingSessionName() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void refresh() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MatchInfo getMatchInfo() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PluginTool getTool() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedMatch(VTMatch match) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MatchInfo getMatchInfo(VTMatch match) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectedMarkupItem(VTMarkupItem markupItem) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressCorrelatorManager getCorrelator() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void domainObjectChanged(DomainObjectChangedEvent ev) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void optionsChanged(ToolOptions options, String optionName, Object oldValue,
|
||||||
|
Object newValue) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gotoSourceLocation(ProgramLocation location) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void gotoDestinationLocation(ProgramLocation location) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runVTTask(VtTask task) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getSourceSymbol(VTAssociation association) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getDestinationSymbol(VTAssociation association) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressSetView getSelectionInSourceTool() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressSetView getSelectionInDestinationTool() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectionInSourceTool(AddressSetView sourceSet) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSelectionInDestinationTool(AddressSetView destinationSet) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void markupItemStatusChanged(VTMarkupItem markupItem) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ColorizingService getSourceColorizingService() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ColorizingService getDestinationColorizingService() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,7 +20,8 @@ import java.util.List;
|
||||||
|
|
||||||
import ghidra.program.database.function.OverlappingFunctionException;
|
import ghidra.program.database.function.OverlappingFunctionException;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.data.*;
|
import ghidra.program.model.data.DataType;
|
||||||
|
import ghidra.program.model.data.DataTypeManager;
|
||||||
import ghidra.program.model.lang.*;
|
import ghidra.program.model.lang.*;
|
||||||
import ghidra.program.model.mem.MemBuffer;
|
import ghidra.program.model.mem.MemBuffer;
|
||||||
import ghidra.program.model.symbol.Namespace;
|
import ghidra.program.model.symbol.Namespace;
|
||||||
|
@ -35,7 +36,7 @@ import ghidra.util.task.TaskMonitor;
|
||||||
* for all methods in the Listing interface. Any method that is needed for your test can then
|
* for all methods in the Listing interface. Any method that is needed for your test can then
|
||||||
* be overridden so it can provide its own test implementation and return value.
|
* be overridden so it can provide its own test implementation and return value.
|
||||||
*/
|
*/
|
||||||
public class ListingStub implements Listing {
|
public class StubListing implements Listing {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CodeUnit getCodeUnitAt(Address addr) {
|
public CodeUnit getCodeUnitAt(Address addr) {
|
||||||
|
@ -304,8 +305,7 @@ public class ListingStub implements Listing {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Data createData(Address addr, DataType dataType)
|
public Data createData(Address addr, DataType dataType) throws CodeUnitInsertionException {
|
||||||
throws CodeUnitInsertionException {
|
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,15 +32,15 @@ import ghidra.util.task.TaskMonitor;
|
||||||
* for all methods in the Memory interface. Any method that is needed for your test can then
|
* for all methods in the Memory interface. Any method that is needed for your test can then
|
||||||
* be overridden so it can provide its own test implementation and return value.
|
* be overridden so it can provide its own test implementation and return value.
|
||||||
*/
|
*/
|
||||||
public class MemoryStub extends AddressSet implements Memory {
|
public class StubMemory extends AddressSet implements Memory {
|
||||||
byte[] myMemoryBytes;
|
byte[] myMemoryBytes;
|
||||||
MemoryBlock myMemoryBlock;
|
MemoryBlock myMemoryBlock;
|
||||||
|
|
||||||
public MemoryStub() {
|
public StubMemory() {
|
||||||
this(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 });
|
this(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemoryStub(byte[] bytes) {
|
public StubMemory(byte[] bytes) {
|
||||||
super();
|
super();
|
||||||
this.myMemoryBytes = bytes;
|
this.myMemoryBytes = bytes;
|
||||||
AddressSpace space = new GenericAddressSpace("Mem", 32, AddressSpace.TYPE_RAM, 0);
|
AddressSpace space = new GenericAddressSpace("Mem", 32, AddressSpace.TYPE_RAM, 0);
|
|
@ -31,7 +31,7 @@ import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.exception.InvalidInputException;
|
import ghidra.util.exception.InvalidInputException;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
|
|
||||||
public class FunctionManagerTestDouble implements FunctionManager {
|
public class StubFunctionManager implements FunctionManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProgramDB getProgram() {
|
public ProgramDB getProgram() {
|
|
@ -39,7 +39,7 @@ import ghidra.util.exception.CancelledException;
|
||||||
import ghidra.util.exception.DuplicateNameException;
|
import ghidra.util.exception.DuplicateNameException;
|
||||||
import ghidra.util.task.TaskMonitor;
|
import ghidra.util.task.TaskMonitor;
|
||||||
|
|
||||||
public class ProgramTestDouble implements Program {
|
public class StubProgram implements Program {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int startTransaction(String description) {
|
public int startTransaction(String description) {
|
|
@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
import generic.test.AbstractGTest;
|
import generic.test.AbstractGTest;
|
||||||
import ghidra.program.model.ProgramTestDouble;
|
import ghidra.program.model.StubProgram;
|
||||||
import ghidra.program.model.address.*;
|
import ghidra.program.model.address.*;
|
||||||
import ghidra.program.model.listing.*;
|
import ghidra.program.model.listing.*;
|
||||||
import ghidra.program.model.mem.*;
|
import ghidra.program.model.mem.*;
|
||||||
|
@ -249,7 +249,7 @@ public class DataUtilitiesTest extends AbstractGTest {
|
||||||
//================================================================
|
//================================================================
|
||||||
|
|
||||||
private Program createProgram() {
|
private Program createProgram() {
|
||||||
return new ProgramTestDouble() {
|
return new StubProgram() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AddressFactory getAddressFactory() {
|
public AddressFactory getAddressFactory() {
|
||||||
|
@ -268,7 +268,7 @@ public class DataUtilitiesTest extends AbstractGTest {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyMemory extends MemoryStub {
|
private class MyMemory extends StubMemory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MemoryBlock getBlock(Address addr) {
|
public MemoryBlock getBlock(Address addr) {
|
||||||
|
@ -335,7 +335,7 @@ public class DataUtilitiesTest extends AbstractGTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyListing extends ListingStub {
|
private class MyListing extends StubListing {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Data getDataContaining(Address address) {
|
public Data getDataContaining(Address address) {
|
||||||
|
|
|
@ -0,0 +1,309 @@
|
||||||
|
/* ###
|
||||||
|
* IP: GHIDRA
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package ghidra.program.model.symbol;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import ghidra.program.model.address.*;
|
||||||
|
import ghidra.program.model.listing.*;
|
||||||
|
import ghidra.util.exception.DuplicateNameException;
|
||||||
|
import ghidra.util.exception.InvalidInputException;
|
||||||
|
|
||||||
|
public class StubSymbolTable implements SymbolTable {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol createLabel(Address addr, String name, SourceType source)
|
||||||
|
throws InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol createLabel(Address addr, String name, Namespace namespace, SourceType source)
|
||||||
|
throws InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeSymbolSpecial(Symbol sym) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getSymbol(long symbolID) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getSymbol(String name, Address addr, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getGlobalSymbol(String name, Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Symbol> getGlobalSymbols(String name) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Symbol> getLabelOrFunctionSymbols(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getNamespaceSymbol(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getLibrarySymbol(String name) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getClassSymbol(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getParameterSymbol(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getLocalVariableSymbol(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Symbol> getSymbols(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getVariableSymbol(String name, Function function) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Namespace getNamespace(String name, Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbols(String name) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getAllSymbols(boolean includeDynamicSymbols) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getSymbol(Reference ref) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getPrimarySymbol(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol[] getSymbols(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbolsAsIterator(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol[] getUserSymbols(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbols(Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbols(long namespaceID) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasSymbol(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getDynamicSymbolID(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbolIterator(String searchStr, boolean caseSensitive) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbols(AddressSetView set, SymbolType type, boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getNumSymbols() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbolIterator() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getDefinedSymbols() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Symbol getExternalSymbol(String name) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getExternalSymbols(String name) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getExternalSymbols() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbolIterator(boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getSymbolIterator(Address startAddr, boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getPrimarySymbolIterator(boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getPrimarySymbolIterator(Address startAddr, boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getPrimarySymbolIterator(AddressSetView asv, boolean forward) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addExternalEntryPoint(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeExternalEntryPoint(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExternalEntryPoint(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AddressIterator getExternalEntryPointIterator() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LabelHistory[] getLabelHistory(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<LabelHistory> getLabelHistory() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasLabelHistory(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Namespace getNamespace(Address addr) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<GhidraClass> getClassNamespaces() {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GhidraClass createClass(Namespace parent, String name, SourceType source)
|
||||||
|
throws DuplicateNameException, InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SymbolIterator getChildren(Symbol parentSymbol) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Library createExternalLibrary(String name, SourceType source)
|
||||||
|
throws DuplicateNameException, InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Namespace createNameSpace(Namespace parent, String name, SourceType source)
|
||||||
|
throws DuplicateNameException, InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GhidraClass convertNamespaceToClass(Namespace namespace) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Namespace getOrCreateNameSpace(Namespace parent, String name, SourceType source)
|
||||||
|
throws DuplicateNameException, InvalidInputException {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -284,7 +284,7 @@ public class AcyclicCallGraphBuilderTest extends AbstractGenericTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private FunctionManager createFunctionManager() {
|
private FunctionManager createFunctionManager() {
|
||||||
return new FunctionManagerTestDouble() {
|
return new StubFunctionManager() {
|
||||||
@Override
|
@Override
|
||||||
public Function getFunctionAt(Address addr) {
|
public Function getFunctionAt(Address addr) {
|
||||||
return functionMap.get(addr);
|
return functionMap.get(addr);
|
||||||
|
@ -294,7 +294,7 @@ public class AcyclicCallGraphBuilderTest extends AbstractGenericTest {
|
||||||
|
|
||||||
private Program createProgram() {
|
private Program createProgram() {
|
||||||
final FunctionManager funMgr = createFunctionManager();
|
final FunctionManager funMgr = createFunctionManager();
|
||||||
return new ProgramTestDouble() {
|
return new StubProgram() {
|
||||||
@Override
|
@Override
|
||||||
public ReferenceManager getReferenceManager() {
|
public ReferenceManager getReferenceManager() {
|
||||||
return refState;
|
return refState;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue