Search in sources :

Example 11 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.

the class DatabaseTest method testSetDriver.

@Test
public void testSetDriver() {
    final MockDatabaseListener listener = new MockDatabaseListener();
    final MockDatabase mockDatabase = new MockDatabase();
    final Database database = new Database(mockDatabase);
    database.addListener(listener);
    database.setDriver("Fark 1");
    assertEquals("changedDriver;", listener.events);
    assertEquals("Fark 1", database.getDriver());
    assertEquals("Fark 1", mockDatabase.getConfiguration().getDriver());
    mockDatabase.getConfiguration().setDriver("Fark 2");
    assertEquals("changedDriver;changedDriver;", listener.events);
    assertEquals("Fark 2", database.getDriver());
    assertEquals("Fark 2", mockDatabase.getConfiguration().getDriver());
    database.removeListener(listener);
}
Also used : MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Test(org.junit.Test)

Example 12 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.

the class CAddressSpaceNodeMenuBuilder method getPluginAddressSpaces.

/**
   * Returns the API address space objects for the address spaces for which the menu was built.
   *
   * @return The API address space objects.
   */
private List<AddressSpace> getPluginAddressSpaces() {
    final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
    for (final Database database : manager) {
        if (database.getNative() == m_database) {
            for (final Project project : database.getProjects()) {
                if (project.getNative() == m_project) {
                    final List<AddressSpace> allSpaces = project.getAddressSpaces();
                    final List<AddressSpace> menuSpaces = new ArrayList<AddressSpace>();
                    for (final INaviAddressSpace addressSpace : m_addressSpaces) {
                        menuSpaces.add(ObjectFinders.getObject(addressSpace, allSpaces));
                    }
                    return menuSpaces;
                }
            }
        }
    }
    throw new IllegalStateException("IE01159: Unknown database");
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace) AddressSpace(com.google.security.zynamics.binnavi.API.disassembly.AddressSpace) DatabaseManager(com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) ArrayList(java.util.ArrayList) INaviAddressSpace(com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)

Example 13 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.

the class ProjectFactory method get.

public static Project get() {
    final MockSqlProvider provider = new MockSqlProvider();
    final Date creationDate = new Date();
    final Date modificationDate = new Date();
    final CProject internalProject = new CProject(123, "Name", "Comment", creationDate, modificationDate, 55, new FilledList<DebuggerTemplate>(), provider);
    final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
    final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
    final Database db = new Database(new MockDatabase());
    return new Project(db, internalProject, nodeTagManager, viewTagManager);
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) Date(java.util.Date) Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProject(com.google.security.zynamics.binnavi.disassembly.CProject) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)

Example 14 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.

the class ModuleFactory method get.

public static Module get(final INaviModule module) {
    final MockSqlProvider provider = new MockSqlProvider();
    final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
    final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
    final Database db = new Database(new MockDatabase());
    return new Module(db, module, nodeTagManager, viewTagManager);
}
Also used : TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule)

Example 15 with Database

use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.

the class ModuleFactory method get.

public static Module get(final INaviModule module, final SQLProvider provider) {
    final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
    final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
    final Database db = new Database(new MockDatabase());
    return new Module(db, module, nodeTagManager, viewTagManager);
}
Also used : TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule)

Aggregations

Database (com.google.security.zynamics.binnavi.API.disassembly.Database)26 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)19 Test (org.junit.Test)15 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)9 Module (com.google.security.zynamics.binnavi.API.disassembly.Module)8 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)7 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)7 Tree (com.google.security.zynamics.zylib.types.trees.Tree)7 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)6 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)6 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)6 DatabaseManager (com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager)4 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)4 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 Date (java.util.Date)3 Before (org.junit.Before)3 View (com.google.security.zynamics.binnavi.API.disassembly.View)2 CDatabase (com.google.security.zynamics.binnavi.Database.CDatabase)2 SQLProvider (com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider)2