use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.
the class CDebuggerContainerNodeTest method testUnloaded.
@Test
public void testUnloaded() throws CouldntDeleteException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final DebuggerTemplate debugger1 = new DebuggerTemplate(1, "Debugger 1", "", 0, m_provider);
final DebuggerTemplate debugger2 = new DebuggerTemplate(2, "Debugger 2", "", 0, m_provider);
final CDebuggerContainerNode node = new CDebuggerContainerNode(m_tree, m_database);
assertEquals("Debuggers (0)", node.toString());
assertEquals(0, node.getChildCount());
m_database.getContent().getDebuggerTemplateManager().addDebugger(debugger1);
m_database.getContent().getDebuggerTemplateManager().addDebugger(debugger2);
assertEquals("Debuggers (2)", node.toString());
assertEquals(2, node.getChildCount());
assertEquals("Debugger 1", node.getChildAt(0).toString());
assertEquals("Debugger 2", node.getChildAt(1).toString());
m_database.getContent().getDebuggerTemplateManager().removeDebugger(debugger1);
assertEquals("Debuggers (1)", node.toString());
assertEquals(1, node.getChildCount());
assertEquals("Debugger 2", node.getChildAt(0).toString());
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database.getContent().getDebuggerTemplateManager(), "listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.
the class CModuleOverviewPanelTest method testChangingDebugger.
@Test
public void testChangingDebugger() throws CouldntSaveDataException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException {
final DebuggerTemplate template1 = new DebuggerTemplate(1, "A", "", 0, m_provider);
final DebuggerTemplate template2 = new DebuggerTemplate(1, "B", "", 0, m_provider);
m_database.getContent().getDebuggerTemplateManager().addDebugger(template1);
m_database.getContent().getDebuggerTemplateManager().addDebugger(template2);
m_project.getConfiguration().addDebugger(template1);
m_project.getConfiguration().addDebugger(template2);
sleep();
assertFalse(m_saveButton.isEnabled());
m_debuggerCombo.setSelectedIndex(3);
sleep();
assertTrue(m_saveButton.isEnabled());
m_module.getConfiguration().setDebuggerTemplate(template2);
sleep();
assertFalse(m_saveButton.isEnabled());
m_module.getConfiguration().setDebuggerTemplate(template1);
sleep();
assertFalse(m_saveButton.isEnabled());
testListenersRemoved();
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.
the class CModuleContainerNodeTest method testLoaded.
@Test
public void testLoaded() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CRawModule rawModule = new CRawModule(1, "", 0, false, m_provider);
final CModule module1 = new CModule(123, "Module 1", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), rawModule, Integer.MAX_VALUE, false, m_provider);
final CModule module2 = new CModule(123, "Module 2", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), rawModule, Integer.MAX_VALUE, false, m_provider);
m_database.getContent().addModule(module1);
m_database.getContent().addModule(module2);
final CModuleContainerNode node = new CModuleContainerNode(m_tree, m_database);
assertEquals("Modules (2)", node.toString());
assertEquals(2, node.getChildCount());
assertEquals("Module 1 (55/66)", node.getChildAt(0).toString());
assertEquals("Module 2 (55/66)", node.getChildAt(1).toString());
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")).isEmpty());
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database.getContent().getDebuggerTemplateManager(), "listeners"), "m_listeners")) == null);
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.
the class CProjectContainerNodeTest method testUnloaded.
@Test
public void testUnloaded() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CProject project1 = new CProject(123, "Project 1", "Comment", new Date(), new Date(), 55, new ArrayList<DebuggerTemplate>(), m_provider);
final CProject project2 = new CProject(123, "Project 2", "Comment", new Date(), new Date(), 55, new ArrayList<DebuggerTemplate>(), m_provider);
final CProjectContainerNode node = new CProjectContainerNode(m_tree, m_database);
assertEquals("Projects (0)", node.toString());
assertEquals(0, node.getChildCount());
m_database.addProject(project1);
m_database.addProject(project2);
assertEquals("Projects (2)", node.toString());
assertEquals(2, node.getChildCount());
assertEquals("Project 1 (55)", node.getChildAt(0).toString());
assertEquals("Project 2 (55)", node.getChildAt(1).toString());
m_database.getContent().delete(project1);
assertEquals("Projects (1)", node.toString());
assertEquals(1, node.getChildCount());
assertEquals("Project 2 (55)", node.getChildAt(0).toString());
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")).isEmpty());
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database.getContent().getDebuggerTemplateManager(), "listeners"), "m_listeners")) == null);
}
use of com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate in project binnavi by google.
the class CDebuggerNodeTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, SecurityException, FileReadException {
ConfigManager.instance().read();
m_database = new MockDatabase(m_provider);
m_template = new DebuggerTemplate(1, "My Debugger", "Bar", 123, m_provider);
final CProjectTreeModel model = new CProjectTreeModel(m_tree);
model.setRoot(new DefaultMutableTreeNode());
m_tree.setModel(model);
}
Aggregations