Search in sources :

Example 6 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CAddressSpaceNodeTest method testListenersRemoved.

@Test
public void testListenersRemoved() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CAddressSpaceNode node = new CAddressSpaceNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, m_addressSpace, m_container);
    node.dispose();
    m_container.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Test(org.junit.Test)

Example 7 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CAddressSpaceNodeTest method testUnloadedClosed.

@Test
public void testUnloadedClosed() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CAddressSpaceNode node = new CAddressSpaceNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, m_addressSpace, m_container);
    assertEquals("Address Space (?)", node.toString());
    m_addressSpace.load();
    assertEquals("Address Space (0)", node.toString());
    final MockModule unloadedModule = new MockModule(m_provider, false);
    m_addressSpace.getContent().addModule(new MockModule(m_provider, true));
    m_addressSpace.getContent().addModule(unloadedModule);
    assertEquals("Address Space (2)", node.toString());
    assertEquals(2, node.getChildCount());
    m_addressSpace.getContent().removeModule(unloadedModule);
    assertEquals("Address Space (1)", node.toString());
    assertEquals(1, node.getChildCount());
    m_addressSpace.close();
    node.dispose();
    m_container.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Test(org.junit.Test)

Example 8 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CAddressSpaceNodeTest method testUnloaded.

@Test
public void testUnloaded() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    final CAddressSpaceNode node = new CAddressSpaceNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, m_addressSpace, m_container);
    assertEquals("Address Space (?)", node.toString());
    m_addressSpace.load();
    assertEquals("Address Space (0)", node.toString());
    final MockModule unloadedModule = new MockModule(m_provider, false);
    m_addressSpace.getContent().addModule(new MockModule(m_provider, true));
    m_addressSpace.getContent().addModule(unloadedModule);
    assertEquals("Address Space (2)", node.toString());
    assertEquals(2, node.getChildCount());
    m_addressSpace.getContent().removeModule(unloadedModule);
    assertEquals("Address Space (1)", node.toString());
    assertEquals(1, node.getChildCount());
    node.dispose();
    m_container.dispose();
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")).isEmpty());
    assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Test(org.junit.Test)

Example 9 with CAddressSpaceNode

use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode in project binnavi by google.

the class CAddressSpaceNodeTest method testChangingName.

@Test
public void testChangingName() throws CouldntSaveDataException {
    final CAddressSpaceNode node = new CAddressSpaceNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, m_addressSpace, m_container);
    assertEquals("Address Space (?)", node.toString());
    m_addressSpace.getConfiguration().setName("Hannes");
    assertEquals("Hannes (?)", node.toString());
}
Also used : CAddressSpaceNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Test(org.junit.Test)

Aggregations

CAddressSpaceNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.AddressSpace.CAddressSpaceNode)9 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 Test (org.junit.Test)5 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)3 CModuleNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Module.CModuleNode)2 INaviAddressSpace (com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)2 CTracesNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Traces.CTracesNode)1 CProjectViewsContainerNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode)1 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)1 List (java.util.List)1 TreePath (javax.swing.tree.TreePath)1