use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class CProjectContainerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
m_provider = new MockSqlProvider();
m_module = new MockModule(m_provider);
m_database = new MockDatabase(m_provider);
m_function = new MockFunction(m_provider);
m_project = new CProject(123, "Name", "Comment", new Date(), new Date(), 55, new FilledList<DebuggerTemplate>(), m_provider);
m_project.load();
m_space = m_project.getContent().createAddressSpace("space");
m_space.load();
m_space.getContent().addModule(m_module);
m_debugger = new DebuggerTemplate(2, "gdb", "local", 2222, m_provider);
m_space.getConfiguration().setDebuggerTemplate(m_debugger);
m_listener = new MockAddressSpaceListener();
m_space.addListener(m_listener);
m_module.load();
CFunctionContainerHelper.addFunction(m_module.getContent().getFunctionContainer(), m_function);
final CView view = m_module.getContent().getViewContainer().createView("foo", "bar");
@SuppressWarnings("unused") final MockViewContainer mockViewContainer = new MockViewContainer();
final MockViewListener listener = new MockViewListener();
view.addListener(listener);
}
use of com.google.security.zynamics.binnavi.disassembly.CProject 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.disassembly.CProject in project binnavi by google.
the class CDatabaseNodeTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, SecurityException, FileReadException, CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
ConfigManager.instance().read();
m_database = new MockDatabase(m_provider);
m_project = new CProject(1, "Mock Project", "Mock Project Description", new Date(), new Date(), 0, new ArrayList<DebuggerTemplate>(), m_provider);
m_project.load();
m_addressSpace = m_project.getContent().createAddressSpace("Address Space");
final CProjectTreeModel model = new CProjectTreeModel(m_tree);
model.setRoot(new DefaultMutableTreeNode());
m_tree.setModel(model);
}
Aggregations