Search in sources :

Example 51 with MockDatabase

use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase 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);
}
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 52 with MockDatabase

use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase 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);
}
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 53 with MockDatabase

use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase 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);
}
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 54 with MockDatabase

use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.

the class DatabaseTest method testViewTagManager.

@Test
public void testViewTagManager() {
    final MockDatabase mockDatabase = new MockDatabase();
    final Database database = new Database(mockDatabase);
    final TagManager manager1 = database.getViewTagManager();
    final TagManager manager2 = database.getViewTagManager();
    assertNotNull(manager1);
    assertEquals(manager1, manager2);
}
Also used : TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) 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 55 with MockDatabase

use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.

the class DatabaseTest method testSetDescription.

@Test
public void testSetDescription() {
    final MockDatabaseListener listener = new MockDatabaseListener();
    final MockDatabase mockDatabase = new MockDatabase();
    final Database database = new Database(mockDatabase);
    database.addListener(listener);
    database.setDescription("Fark 1");
    assertEquals("changedDescription;", listener.events);
    assertEquals("Fark 1", database.getDescription());
    assertEquals("Fark 1", mockDatabase.getConfiguration().getDescription());
    mockDatabase.getConfiguration().setDescription("Fark 2");
    assertEquals("changedDescription;changedDescription;", listener.events);
    assertEquals("Fark 2", database.getDescription());
    assertEquals("Fark 2", mockDatabase.getConfiguration().getDescription());
    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)

Aggregations

MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)59 Test (org.junit.Test)31 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)29 Date (java.util.Date)29 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)28 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)24 Before (org.junit.Before)23 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)20 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)19 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)19 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)14 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)13 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)12 DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)11 Tree (com.google.security.zynamics.zylib.types.trees.Tree)10 ArrayList (java.util.ArrayList)10 CFunction (com.google.security.zynamics.binnavi.disassembly.CFunction)9 CProjectTreeModel (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel)8 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)8 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)8