Search in sources :

Example 31 with TraceList

use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.

the class CPostgreSQLModuleContentTest method testCreateTrace.

@Test
public void testCreateTrace() throws LoadCancelledException, CouldntLoadDataException, CouldntSaveDataException {
    final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
    module.load();
    final CModuleContent moduleContent1 = module.getContent();
    assertNotNull(moduleContent1);
    final TraceList trace = moduleContent1.getTraceContainer().createTrace("name", "desc");
    assertNotNull(trace);
    try {
        moduleContent1.getTraceContainer().createTrace(null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        moduleContent1.getTraceContainer().createTrace("name", null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        moduleContent1.close();
        moduleContent1.getTraceContainer().createTrace("name2", "desc2");
        fail();
    } catch (final IllegalStateException e) {
    }
}
Also used : TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 32 with TraceList

use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.

the class CPostgreSQLModuleContentTest method testCModuleContentConstructor.

@Test
public void testCModuleContentConstructor() throws LoadCancelledException, CouldntLoadDataException {
    final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
    module.load();
    final ListenerProvider<IModuleListener> listeners = new ListenerProvider<IModuleListener>();
    final CCallgraph callgraph = module.getContent().getNativeCallgraph();
    final IFilledList<INaviFunction> functions = new FilledList<INaviFunction>();
    functions.add(module.getContent().getFunctionContainer().getFunctions().get(0));
    final ICallgraphView nativeCallgraph = module.getContent().getViewContainer().getNativeCallgraphView();
    final ImmutableList<IFlowgraphView> nativeFlowgraphs = module.getContent().getViewContainer().getNativeFlowgraphViews();
    final List<INaviView> customViews = new ArrayList<INaviView>();
    final ImmutableBiMap<INaviView, INaviFunction> viewFunctionMap = new ImmutableBiMap.Builder<INaviView, INaviFunction>().build();
    new Pair<HashMap<INaviView, INaviFunction>, HashMap<INaviFunction, INaviView>>(null, null);
    final IFilledList<TraceList> traces = new FilledList<TraceList>();
    final SectionContainer sections = new SectionContainer(new SectionContainerBackend(getProvider(), module));
    final TypeInstanceContainer instances = new TypeInstanceContainer(new TypeInstanceContainerBackend(getProvider(), module, module.getTypeManager(), sections), getProvider());
    final CModuleContent moduleContent1 = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, sections, instances);
    assertNotNull(moduleContent1);
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(null, null, null, null, null, null, null, null, null, null, sections, instances);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, null, null, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), null, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
}
Also used : IFlowgraphView(com.google.security.zynamics.binnavi.disassembly.IFlowgraphView) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) ArrayList(java.util.ArrayList) TypeInstanceContainerBackend(com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceContainerBackend) Pair(com.google.security.zynamics.zylib.general.Pair) SectionContainerBackend(com.google.security.zynamics.binnavi.disassembly.types.SectionContainerBackend) CCallgraph(com.google.security.zynamics.binnavi.disassembly.CCallgraph) ICallgraphView(com.google.security.zynamics.binnavi.disassembly.ICallgraphView) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) ImmutableBiMap(com.google.common.collect.ImmutableBiMap) SectionContainer(com.google.security.zynamics.binnavi.disassembly.types.SectionContainer) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ListenerProvider(com.google.security.zynamics.zylib.general.ListenerProvider) TypeInstanceContainer(com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceContainer) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 33 with TraceList

use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList in project binnavi by google.

the class PostgreSQLProviderTest method testTraceFunctionsSetDescription4.

@Test(expected = NullPointerException.class)
public void testTraceFunctionsSetDescription4() throws CouldntSaveDataException {
    final INaviProject project = getProvider().createProject("SOME_PROJECT");
    getProvider().createTrace(project, "SOME_TRACE", "SOME_TRACE_DESCRIPTION");
    final TraceList trace = project.getContent().getTraces().get(0);
    PostgreSQLTraceFunctions.setDescription((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 34 with TraceList

use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList 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 35 with TraceList

use of com.google.security.zynamics.binnavi.debug.models.trace.TraceList 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)

Aggregations

TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)46 Test (org.junit.Test)26 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)14 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)11 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)10 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)10 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)10 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)9 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)7 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)7 TraceLogger (com.google.security.zynamics.binnavi.debug.models.trace.TraceLogger)7 ITraceListProvider (com.google.security.zynamics.binnavi.debug.models.trace.interfaces.ITraceListProvider)7 ArrayList (java.util.ArrayList)7 HashSet (java.util.HashSet)7 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)6 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)6 Trace (com.google.security.zynamics.binnavi.API.disassembly.Trace)5 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)5 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)5 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)4