use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class PostgreSQLProviderTest method testTraceFunctionsDeleteTrace1.
@Test
public void testTraceFunctionsDeleteTrace1() throws CouldntLoadDataException, LoadCancelledException, CouldntDeleteException, CouldntSaveDataException {
final CProject project = getProvider().createProject("SOME_NEW_PROJECT");
getProvider().createTrace(project, "SOME_TRACE_NAME_ONE", "SOME_TRACE_DESCRIPTION_ONE");
getProvider().createTrace(project, "SOME_TRACE_NAME_TWO", "SOME_TRACE_DESCRIPTION_TWO");
project.load();
final int projectTraceCount = project.getContent().getTraceCount();
assertEquals(2, projectTraceCount);
PostgreSQLTraceFunctions.deleteTrace((AbstractSQLProvider) getProvider(), project.getContent().getTraces().get(0));
project.close();
final List<INaviProject> projects = getProvider().loadProjects();
INaviProject project2 = null;
for (final INaviProject cProject : projects) {
if (cProject.getConfiguration().getId() == project.getConfiguration().getId()) {
project2 = cProject;
}
}
project2.load();
assertEquals(projectTraceCount - 1, project2.getContent().getTraceCount());
}
use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class PostgreSQLProviderTest method testTraceFunctionsCreateTrace2.
@Test
public void testTraceFunctionsCreateTrace2() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final CProject project = getProvider().createProject("SOME_NEW_PROJECT");
getProvider().createTrace(project, "SOME_TRACE_NAME", "SOME_TRACE_DESCRIPTION");
project.load();
final String name = "Very new name";
final String description = "Super cool description";
final int projectTraceCount = project.getContent().getTraceCount();
PostgreSQLTraceFunctions.createTrace((AbstractSQLProvider) getProvider(), project, name, description);
project.close();
final List<INaviProject> projects = getProvider().loadProjects();
INaviProject project2 = null;
for (final INaviProject cProject : projects) {
if (project.getConfiguration().getId() == cProject.getConfiguration().getId()) {
project2 = cProject;
}
}
project2.load();
assertEquals(projectTraceCount + 1, project2.getContent().getTraceCount());
assertEquals(description, project2.getContent().getTraces().get(project2.getContent().getTraces().size() - 1).getDescription());
}
use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class PostgreSQLProviderTest method testCAddressSpaceLoaderLoadAddressSpaces4.
@Test(expected = NullPointerException.class)
public void testCAddressSpaceLoaderLoadAddressSpaces4() throws CouldntLoadDataException {
final CProject project = (CProject) getProvider().loadProjects().get(0);
PostgreSQLAddressSpaceLoader.loadAddressSpaces((AbstractSQLProvider) getProvider(), project, null, null);
}
use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class CProjectModulesModelTest method testSimple.
@Test
public void testSimple() throws CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
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");
m_addressSpace.load();
final CModule module1 = new CModule(1, "Name 1", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), null, Integer.MAX_VALUE, false, m_provider);
m_addressSpace.getContent().addModule(module1);
final CModule module2 = new CModule(2, "Name 2", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider), null, Integer.MAX_VALUE, false, m_provider);
m_addressSpace.getContent().addModule(module2);
final CProjectModulesModel model = new CProjectModulesModel(m_addressSpace);
assertEquals(2, model.getRowCount());
assertEquals("Name 1", model.getValueAt(0, 0));
assertEquals("Name 2", model.getValueAt(1, 0));
}
use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.
the class CAddressSpaceNodeTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, 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);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
m_container = new CProjectContainer(m_database, m_project, m_addressSpace);
}
Aggregations