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"));
}
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);
}
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();
}
}
}
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());
}
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);
}
Aggregations