Search in sources :

Example 91 with INaviView

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

the class PostgreSQLProviderTest method testCViewFunctionsSaveSettings.

@Test
public void testCViewFunctionsSaveSettings() throws CouldntLoadDataException, LoadCancelledException, CPartialLoadException, CouldntSaveDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final List<INaviView> views = module.getContent().getViewContainer().getViews();
    final INaviView view = views.get(264);
    view.load();
    final Map<String, String> settings = new HashMap<String, String>();
    settings.put("foo", "bar");
    PostgreSQLViewFunctions.saveSettings((AbstractSQLProvider) getProvider(), (CView) view, settings);
    view.close();
    view.load();
    final Map<String, String> settings2 = PostgreSQLViewFunctions.loadSettings((AbstractSQLProvider) getProvider(), (CView) view);
    assertTrue(settings2.containsKey("foo"));
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) HashMap(java.util.HashMap) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 92 with INaviView

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

the class PostgreSQLProviderTest method testInstructionFunctionsSetReplacement1.

@Test
public void testInstructionFunctionsSetReplacement1() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException, MaybeNullException, CouldntSaveDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final INaviFunction function = module.getContent().getFunctionContainer().getFunction("sub_1004565");
    final INaviView view = module.getContent().getViewContainer().getView(function);
    view.load();
    final IInstruction instruction = Iterables.get(view.getContent().getBasicBlocks().get(0).getInstructions(), 7);
    final IOperandTreeNode node = instruction.getOperands().get(1).getRootNode().getChildren().get(0).getChildren().get(0).getChildren().get(0).getChildren().get(1);
    PostgreSQLInstructionFunctions.setReplacement((AbstractSQLProvider) getProvider(), (COperandTreeNode) node, "replacement4");
    view.close();
    final INaviModule module2 = getProvider().loadModules().get(0);
    module2.load();
    final INaviFunction function2 = module2.getContent().getFunctionContainer().getFunction("sub_1004565");
    final INaviView view2 = module2.getContent().getViewContainer().getView(function2);
    view2.load();
    final IInstruction instruction2 = Iterables.get(view2.getContent().getBasicBlocks().get(0).getInstructions(), 7);
    instruction2.getOperands().get(1).getRootNode().getChildren().get(0).getChildren().get(0).getChildren().get(0).getChildren().get(1);
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) IOperandTreeNode(com.google.security.zynamics.zylib.disassembly.IOperandTreeNode) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) IInstruction(com.google.security.zynamics.zylib.disassembly.IInstruction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 93 with INaviView

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

the class PostgreSQLProviderTest method testLoadView.

@Test
public void testLoadView() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException {
    // TEST: Case 450 - Read Edge Comments fails if graph has only one node
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    for (final INaviView view : module.getContent().getViewContainer().getViews()) {
        if (view.getNodeCount() == 1) {
            view.load();
            view.close();
        }
    }
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 94 with INaviView

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

the class PostgreSQLProviderTest method testCViewFunctionsSetName1.

@Test
public void testCViewFunctionsSetName1() throws CouldntLoadDataException, LoadCancelledException, CPartialLoadException, CouldntSaveDataException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final List<INaviView> views = module.getContent().getViewContainer().getViews();
    final INaviView view = views.get(264);
    view.load();
    PostgreSQLViewFunctions.setName((AbstractSQLProvider) getProvider(), (CView) view, "furzel");
    view.close();
    module.close();
    final INaviModule module2 = getProvider().loadModules().get(0);
    module2.load();
    final List<INaviView> views2 = module2.getContent().getViewContainer().getViews();
    final INaviView view2 = views2.get(264);
    view2.load();
    assertEquals("furzel", view2.getName());
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 95 with INaviView

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

the class PostgreSQLProviderTest method testInstructionFunctionSetGlobalReplacement1.

@Test
public void testInstructionFunctionSetGlobalReplacement1() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CPartialLoadException, MaybeNullException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final INaviFunction function = module.getContent().getFunctionContainer().getFunction("sub_1004565");
    final INaviView view = module.getContent().getViewContainer().getView(function);
    view.load();
    final IInstruction instruction = Iterables.get(view.getContent().getBasicBlocks().get(0).getInstructions(), 4);
    final INaviOperandTreeNode node = (INaviOperandTreeNode) instruction.getOperands().get(1).getRootNode().getChildren().get(0).getChildren().get(0).getChildren().get(0);
    getProvider().setGlobalReplacement(node, "replacement");
    view.close();
    final INaviModule module2 = getProvider().loadModules().get(0);
    module2.load();
    final INaviFunction function2 = module2.getContent().getFunctionContainer().getFunction("sub_1004565");
    final INaviView view2 = module2.getContent().getViewContainer().getView(function2);
    view2.load();
    final IInstruction instruction2 = Iterables.get(view2.getContent().getBasicBlocks().get(0).getInstructions(), 4);
    instruction2.getOperands().get(1).getRootNode().getChildren().get(0).getChildren().get(0).getChildren().get(0);
}
Also used : INaviOperandTreeNode(com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) IInstruction(com.google.security.zynamics.zylib.disassembly.IInstruction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)121 Test (org.junit.Test)54 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)29 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)26 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)18 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)14 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)11 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)10 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)10 ArrayList (java.util.ArrayList)10 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)9 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)8 HashMap (java.util.HashMap)8 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)7 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)7 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)7 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)7 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)7 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)6