Search in sources :

Example 11 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class PostgreSQLProviderTest method testAssignDebuggerAddressSpace1.

@Test
public void testAssignDebuggerAddressSpace1() throws CouldntSaveDataException, CouldntLoadDataException {
    final CProject project = getProvider().createProject("ADDRESS_SPACE_PROJECT_123");
    getProvider().createAddressSpace(project, "ADDRESS_SPACE_123");
    final CAddressSpace addressSpace = getProvider().loadAddressSpaces(project).get(0);
    getProvider().assignDebugger(addressSpace, getProvider().loadDebuggers().getDebugger(0));
    getProvider().assignDebugger(addressSpace, null);
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 12 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace 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());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) CProjectNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) Test(org.junit.Test)

Example 13 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace 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());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) CProjectNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) Test(org.junit.Test)

Example 14 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace 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());
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) CProjectNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) Test(org.junit.Test)

Example 15 with CAddressSpace

use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.

the class CProjectContentTest method testClose.

@Test
public void testClose() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
    assertNotNull(projectContent);
    final CAddressSpace spaceOne = projectContent.createAddressSpace("Address Space 1");
    spaceOne.load();
    final CAddressSpace spaceTwo = projectContent.createAddressSpace("Address Space 2");
    spaceTwo.load();
    final CAddressSpace spaceThree = projectContent.createAddressSpace("Address Space 3");
    spaceThree.load();
    final CAddressSpace spaceFour = projectContent.createAddressSpace("Address Space 4");
    spaceFour.load();
    @SuppressWarnings("unused") final INaviView viewOne = projectContent.createView(new MockView(m_provider), "View 1 Name", "View 1 description");
    projectContent.close();
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) Test(org.junit.Test)

Aggregations

CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)23 Test (org.junit.Test)17 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)9 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)8 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)6 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)6 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)5 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)4 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)4 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)4 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)4 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)4 CProjectNode (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Project.CProjectNode)3 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)3 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)3 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)3 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3