Search in sources :

Example 6 with InstructionCommentNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.InstructionCommentNotificationContainer in project binnavi by google.

the class PostgreSQLNotificationParserTest method testGlobalInstructionCommentParsingAppend.

@Test
public void testGlobalInstructionCommentParsingAppend() {
    new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
    MockPGNotification notification = new MockPGNotification("comment_changes", "bn_instructions UPDATE 1 4608 3333");
    final CommentNotification result = PostgreSQLCommentNotificationParser.processInstructionGlobalCommentNotification(notification, provider);
    assertNotNull(result);
    final InstructionCommentNotificationContainer container = (InstructionCommentNotificationContainer) result;
    final INaviInstruction instruction = container.getInstruction();
    assertEquals(new CAddress(4608), instruction.getAddress());
    assertEquals(CommentOperation.APPEND, container.getOperation());
    assertEquals(new Integer(3333), container.getCommentId());
    assertEquals(CommentScope.GLOBAL, container.getScope());
}
Also used : CommentNotification(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) InstructionCommentNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.InstructionCommentNotificationContainer) INaviInstruction(com.google.security.zynamics.binnavi.disassembly.INaviInstruction) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Aggregations

InstructionCommentNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.InstructionCommentNotificationContainer)6 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)6 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)6 CommentNotification (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification)4 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)4 Test (org.junit.Test)4 CommentOperation (com.google.security.zynamics.binnavi.disassembly.CommentManager.CommentOperation)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)2 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)2 BigInteger (java.math.BigInteger)2 Matcher (java.util.regex.Matcher)2 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)1