use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testFunctionInform3Resolve.
@Test
public void testFunctionInform3Resolve() throws CouldntLoadDataException {
final INaviFunction forwardFunction = new MockFunction(provider);
function.setForwardedFunctionInternal(forwardFunction);
assertTrue(function.isForwarded());
assertEquals(forwardFunction.getAddress(), function.getForwardedFunctionAddress());
assertEquals(forwardFunction.getModule().getConfiguration().getId(), function.getForwardedFunctionModuleId());
final FunctionNotificationContainer container = new FunctionNotificationContainer(module.getConfiguration().getId(), module, function.getAddress(), "UPDATE");
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
assertFalse(function.isForwarded());
assertNull(function.getForwardedFunctionAddress());
assertEquals(0, function.getForwardedFunctionModuleId());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLProviderTest method testFunctionFunctionsSetDescription.
@Test
public void testFunctionFunctionsSetDescription() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final INaviModule module1 = getProvider().loadModules().get(0);
module1.load();
final INaviFunction function1 = module1.getContent().getFunctionContainer().getFunctions().get(25);
getProvider().setDescription(function1, "description");
module1.close();
final INaviModule module2 = getProvider().loadModules().get(0);
module2.load();
final INaviFunction function2 = module2.getContent().getFunctionContainer().getFunctions().get(25);
assertEquals("description", function2.getDescription());
module2.close();
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction 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.INaviFunction in project binnavi by google.
the class PostgreSQLProviderTest method testInstructionFunctionsAddReference5.
@Test(expected = NullPointerException.class)
public void testInstructionFunctionsAddReference5() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getProvider().loadModules().get(1);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunctions().get(1800);
function.load();
final IBlockNode basicBlock = function.getBasicBlocks().get(0);
final INaviInstruction instruction = Iterables.get(basicBlock.getInstructions(), 1);
final COperandTree tree = instruction.getOperands().get(0);
final INaviOperandTreeNode node = tree.getRootNode();
final IAddress address = instruction.getAddress();
PostgreSQLInstructionFunctions.addReference(getProvider(), node, address, null);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLProviderTest method testFunctionFunctionsSetName.
@Test
public void testFunctionFunctionsSetName() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
INaviModule module1 = getProvider().loadModules().get(0);
module1.load();
INaviFunction function1 = module1.getContent().getFunctionContainer().getFunctions().get(25);
getProvider().setName(function1, "name");
module1 = getProvider().loadModules().get(0);
module1.load();
function1 = module1.getContent().getFunctionContainer().getFunctions().get(25);
assertEquals("name", function1.getName());
}
Aggregations