use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLProviderTest method testFunctionFunctionsSetNameConstructor2.
@Test(expected = NullPointerException.class)
public void testFunctionFunctionsSetNameConstructor2() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final INaviFunction function1 = module.getContent().getFunctionContainer().getFunctions().get(0);
getProvider().setName(function1, null);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction 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);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLNotificationParserTest method testFunctionNodeCommentParsingAppendComment.
@Test
public void testFunctionNodeCommentParsingAppendComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_function_nodes UPDATE 1 6666 4608 3333");
final CommentNotification result = PostgreSQLCommentNotificationParser.processFunctionNodeCommentNotification(notification, provider);
assertNotNull(result);
final FunctionNodeCommentNotificationContainer container = (FunctionNodeCommentNotificationContainer) result;
final INaviFunction function = container.getNode().getFunction();
assertEquals(new CAddress(4608), function.getAddress());
assertEquals(CommentOperation.APPEND, container.getOperation());
assertEquals(new Integer(3333), container.getCommentId());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLNotificationParserTest method testFunctionCommentParsingDeleteComment.
@Test
public void testFunctionCommentParsingDeleteComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_functions UPDATE 1 4608 null");
final CommentNotification result = PostgreSQLCommentNotificationParser.processFunctionCommentNotification(notification, provider);
assertNotNull(result);
final FunctionCommentNotificationContainer container = (FunctionCommentNotificationContainer) result;
final INaviFunction function = container.getFunction();
assertEquals(new CAddress(4608), function.getAddress());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviFunction in project binnavi by google.
the class PostgreSQLNotificationParserTest method testFunctionCommentParsingAppendComment.
@Test
public void testFunctionCommentParsingAppendComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_functions UPDATE 1 4608 3333");
final CommentNotification result = PostgreSQLCommentNotificationParser.processFunctionCommentNotification(notification, provider);
assertNotNull(result);
final FunctionCommentNotificationContainer container = (FunctionCommentNotificationContainer) result;
final INaviFunction function = container.getFunction();
assertEquals(new CAddress(4608), function.getAddress());
assertEquals(CommentOperation.APPEND, container.getOperation());
assertEquals(new Integer(3333), container.getCommentId());
}
Aggregations