use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class DatabaseTest method testGetDebuggerTemplateManager.
@Test
public void testGetDebuggerTemplateManager() {
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
final DebuggerTemplateManager manager1 = database.getDebuggerTemplateManager();
final DebuggerTemplateManager manager2 = database.getDebuggerTemplateManager();
assertNotNull(manager1);
assertEquals(manager1, manager2);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class DatabaseTest method testConnect.
@Test
public void testConnect() throws CouldntLoadDriverException, CouldntConnectException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidDatabaseFormatException, CouldntLoadDataException, InvalidDatabaseVersionException {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
mockDatabase.getContent().m_modules.add(CModuleFactory.get());
mockDatabase.getContent().m_projects.add(CProjectFactory.get());
final Database database = new Database(mockDatabase);
database.addListener(listener);
database.connect();
assertTrue(database.isConnected());
database.load();
listener.m_allowClosing = false;
database.close();
listener.m_allowClosing = true;
database.close();
assertEquals("openedDatabase;loadedDatabase;closingDatabase;closingDatabase;closedDatabase;", listener.events);
assertEquals("Database 'Mock Database' [Unloaded]", database.toString());
database.dispose();
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class DatabaseTest method testCreateProject.
@Test
public void testCreateProject() throws CouldntSaveDataException, CouldntDeleteException {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
database.addListener(listener);
final Project newProject = database.createProject("Hannes");
mockDatabase.getContent().addProject("Fork");
assertEquals("addedProject;addedProject;", listener.events);
assertEquals(2, database.getProjects().size());
database.deleteProject(newProject);
assertEquals("addedProject;addedProject;deletedProject;", listener.events);
assertEquals(1, database.getProjects().size());
database.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class DatabaseTest method testSetAutoConnect.
@Test
public void testSetAutoConnect() {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
database.addListener(listener);
database.setAutoConnect(false);
assertEquals("changedAutoConnect;", listener.events);
assertFalse(database.isAutoConnect());
assertFalse(mockDatabase.getConfiguration().isAutoConnect());
mockDatabase.getConfiguration().setAutoConnect(true);
assertEquals("changedAutoConnect;changedAutoConnect;", listener.events);
assertTrue(database.isAutoConnect());
assertTrue(mockDatabase.getConfiguration().isAutoConnect());
database.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class DatabaseTest method testNodeTagManager.
@Test
public void testNodeTagManager() {
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
final TagManager manager1 = database.getNodeTagManager();
final TagManager manager2 = database.getNodeTagManager();
assertNotNull(manager1);
assertEquals(manager1, manager2);
}
Aggregations