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);
}
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);
}
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);
}
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());
}
Aggregations