Search in sources :

Example 36 with INaviProject

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

the class PostgreSQLProviderTest method testTraceFuntionsSetName1.

@Test
public void testTraceFuntionsSetName1() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final INaviProject project = getProvider().createProject("SOME_PROJECT");
    getProvider().createTrace(project, "SOME_TRACE_2344", "SOME_TRACE_DESCRIPTION_1235");
    project.load();
    final TraceList trace = project.getContent().getTraces().get(0);
    assertEquals("SOME_TRACE_DESCRIPTION_1235", project.getContent().getTraces().get(0).getDescription());
    final String name = "boing boing";
    PostgreSQLTraceFunctions.setName((AbstractSQLProvider) getProvider(), trace, name);
    project.close();
    INaviProject project2 = null;
    for (final INaviProject cProject : getProvider().loadProjects()) {
        if (cProject.getConfiguration().getId() == project.getConfiguration().getId()) {
            project2 = cProject;
        }
    }
    getProvider().createTrace(project2, "SOME_TRACE_2", "SOME_TRACE_DESCRIPTION_2");
    project2.load();
    final TraceList trace2 = project2.getContent().getTraces().get(0);
    assertEquals(name, trace2.getName());
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 37 with INaviProject

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

the class PostgreSQLProviderTest method testCProjectFunctionsRemoveDebugger4.

@Test(expected = NullPointerException.class)
public void testCProjectFunctionsRemoveDebugger4() throws CouldntLoadDataException, CouldntSaveDataException {
    final INaviProject project = getProvider().loadProjects().get(0);
    PostgreSQLProjectFunctions.removeDebugger((AbstractSQLProvider) getProvider(), project, null);
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 38 with INaviProject

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

the class PostgreSQLProviderTest method testTraceFuntionsSetName4.

@Test(expected = NullPointerException.class)
public void testTraceFuntionsSetName4() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final INaviProject project = getProvider().createProject("SOME_PROJECT");
    getProvider().createTrace(project, "SOME_TRACE_2344", "SOME_TRACE_DESCRIPTION_1235");
    project.load();
    final TraceList trace = project.getContent().getTraces().get(0);
    PostgreSQLTraceFunctions.setName((AbstractSQLProvider) getProvider(), trace, null);
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 39 with INaviProject

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

the class CDatabase method close.

@Override
public boolean close() {
    Preconditions.checkArgument(isConnected(), "IE00664: Can not disconnect from the database because it is not connected");
    if (PostgreSQLNotificationProvider.contains(provider)) {
        PostgreSQLNotificationProvider.get(provider).unInitialize();
    }
    for (final IDatabaseListener listener : listeners) {
        try {
            if (!listener.closingDatabase(this)) {
                return false;
            }
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
    if (isLoaded()) {
        for (final INaviProject project : content.getProjects()) {
            if (project.isLoaded() && !project.close()) {
                return false;
            }
        }
    }
    provider.close();
    provider = null;
    for (final IDatabaseListener listener : listeners) {
        try {
            listener.closedDatabase(this);
        } catch (final Exception exception) {
            CUtilityFunctions.logException(exception);
        }
    }
    content = null;
    return true;
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) IDatabaseListener(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabaseListener) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CouldntInitializeDatabaseException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException) CouldntLoadDriverException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException) InvalidExporterDatabaseFormatException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidExporterDatabaseFormatException) SQLException(java.sql.SQLException) InvalidDatabaseException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseException) CouldntConnectException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) CouldntUpdateDatabaseException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntUpdateDatabaseException) InvalidDatabaseVersionException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseVersionException)

Example 40 with INaviProject

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

the class CViewsToProjectHandler method drop.

@SuppressWarnings("unchecked")
@Override
public void drop(final DefaultMutableTreeNode parentNode, final Object data) {
    final CProjectViewsContainerNode projectNode = (CProjectViewsContainerNode) parentNode;
    final INaviProject project = projectNode.getObject();
    final List<INaviView> views = (List<INaviView>) data;
    for (final INaviView view : views) {
        CProjectFunctions.copyView(m_parent, project, view);
    }
}
Also used : INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CProjectViewsContainerNode(com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.Nodes.Views.Project.CProjectViewsContainerNode) List(java.util.List)

Aggregations

INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)45 Test (org.junit.Test)31 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)27 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)6 ViewNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer)5 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)4 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)4 PostgreSQLViewNotificationParser (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser)4 CProject (com.google.security.zynamics.binnavi.disassembly.CProject)4 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)4 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)4 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)3 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)3 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)3 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)3 SQLException (java.sql.SQLException)3 ArrayList (java.util.ArrayList)3 CouldntConnectException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException)2 CouldntInitializeDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException)2 CouldntLoadDriverException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException)2