use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode in project binnavi by google.
the class CProjectNodeTest method testChangingName.
@Test
public void testChangingName() throws CouldntSaveDataException {
final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
assertEquals("Name (0)", node.toString());
m_project.getConfiguration().setName("Hannes");
assertEquals("Hannes (0)", node.toString());
}
use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode in project binnavi by google.
the class CProjectNodeTest method testUnloadedClosed.
@Test
public void testUnloadedClosed() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
assertEquals("Name (0)", node.toString());
m_project.load();
assertEquals("Name (1)", node.toString());
final CAddressSpace addressSpace = m_project.getContent().createAddressSpace("Fark");
assertEquals("Name (2)", node.toString());
m_project.getContent().removeAddressSpace(addressSpace);
assertEquals("Name (1)", node.toString());
m_project.close();
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode in project binnavi by google.
the class CProjectNodeTest method testUnloaded.
@Test
public void testUnloaded() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, LoadCancelledException {
final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
assertEquals("Name (0)", node.toString());
m_project.load();
assertEquals("Name (1)", node.toString());
final CAddressSpace addressSpace = m_project.getContent().createAddressSpace("Fark");
assertEquals("Name (2)", node.toString());
m_project.getContent().removeAddressSpace(addressSpace);
assertEquals("Name (1)", node.toString());
node.dispose();
final LinkedHashSet<?> viewListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(addressSpace, "m_listeners"), "m_listeners");
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
assertTrue(viewListeners.isEmpty());
}
use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode in project binnavi by google.
the class CProjectNodeTest method testLoaded.
@Test
public void testLoaded() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
m_project.load();
final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
assertEquals("Name (1)", node.toString());
final CAddressSpace addressSpace = m_project.getContent().createAddressSpace("Fark");
assertEquals("Name (2)", node.toString());
m_project.getContent().removeAddressSpace(addressSpace);
assertEquals("Name (1)", node.toString());
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode in project binnavi by google.
the class CProjectNodeTest method testListenersRemoved.
@Test
public void testListenersRemoved() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CProjectNode node = new CProjectNode(m_tree, new DefaultMutableTreeNode(), m_database, m_project, new CProjectContainer(m_database, m_project));
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")).isEmpty());
}
Aggregations