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 MockSqlProvider provider = new MockSqlProvider();
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, 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, internalModule, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.
the class DatabaseManagerTest method testLifecycle.
@Test
public void testLifecycle() {
final MockDatabaseManagerListener listener = new MockDatabaseManagerListener();
final DatabaseManager manager = new DatabaseManager(CDatabaseManager.instance());
manager.addListener(listener);
manager.addDatabase("Description", "Driver", "Host", "Name", "User", "Password", "identity", true, false);
final IDatabase internalDatabase = CDatabaseManager.instance().iterator().next();
assertEquals("Description", internalDatabase.getConfiguration().getDescription());
assertEquals("Driver", internalDatabase.getConfiguration().getDriver());
assertEquals("User", internalDatabase.getConfiguration().getUser());
assertEquals("Password", internalDatabase.getConfiguration().getPassword());
assertTrue(internalDatabase.getConfiguration().isSavePassword());
assertFalse(internalDatabase.getConfiguration().isAutoConnect());
assertEquals(1, manager.getDatabases().size());
assertEquals("addedDatabase;", listener.events);
assertEquals("Database Manager ['Description']", manager.toString());
final Database database = manager.getDatabases().get(0);
manager.removeDatabase(database);
assertEquals(0, manager.getDatabases().size());
assertEquals("addedDatabase;removedDatabase;", listener.events);
manager.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.
the class DatabaseTest method testSetPassword.
@Test
public void testSetPassword() {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
database.addListener(listener);
database.setPassword("Fark 1");
assertEquals("changedPassword;", listener.events);
assertEquals("Fark 1", database.getPassword());
assertEquals("Fark 1", mockDatabase.getConfiguration().getPassword());
mockDatabase.getConfiguration().setPassword("Fark 2");
assertEquals("changedPassword;changedPassword;", listener.events);
assertEquals("Fark 2", database.getPassword());
assertEquals("Fark 2", mockDatabase.getConfiguration().getPassword());
database.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.
the class DatabaseTest method testSetHost.
@Test
public void testSetHost() {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
database.addListener(listener);
database.setHost("Fark 1");
assertEquals("changedHost;", listener.events);
assertEquals("Fark 1", database.getHost());
assertEquals("Fark 1", mockDatabase.getConfiguration().getHost());
mockDatabase.getConfiguration().setHost("Fark 2");
assertEquals("changedHost;changedHost;", listener.events);
assertEquals("Fark 2", database.getHost());
assertEquals("Fark 2", mockDatabase.getConfiguration().getHost());
database.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.API.disassembly.Database in project binnavi by google.
the class DatabaseTest method testSetSavePassword.
@Test
public void testSetSavePassword() {
final MockDatabaseListener listener = new MockDatabaseListener();
final MockDatabase mockDatabase = new MockDatabase();
final Database database = new Database(mockDatabase);
database.addListener(listener);
database.setSavePassword(false);
assertEquals("changedSavePassword;", listener.events);
assertFalse(database.isSavePassword());
assertFalse(mockDatabase.getConfiguration().isSavePassword());
mockDatabase.getConfiguration().setSavePassword(true);
assertEquals("changedSavePassword;changedSavePassword;", listener.events);
assertTrue(database.isSavePassword());
assertTrue(mockDatabase.getConfiguration().isSavePassword());
database.removeListener(listener);
}
Aggregations