use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification in project binnavi by google.
the class PostgreSQLNotificationParserTest method testCommentTableNotificationParser1.
@Test
public void testCommentTableNotificationParser1() {
CommentManager.get(provider).initializeGlobalInstructionComment(instruction, Lists.newArrayList(comment1, comment2, comment3));
final String COMMENTS_TABLE_NOTIFICATION_1 = "bn_comments UPDATE 3333 2222 " + CommonTestObjects.TEST_USER_3.getUserId() + " AAA";
final CommentNotification result = PostgreSQLCommentNotificationParser.processCommentNotification(new MockPGNotification("comment_changes", COMMENTS_TABLE_NOTIFICATION_1), provider);
assertNotNull(result);
final CommentNotificationContainer container = (CommentNotificationContainer) result;
final IComment comment = container.getCurrentComment();
assertEquals(comment3, comment);
final IComment testComment = new CComment(3333, CommonTestObjects.TEST_USER_3, comment2, "AAA");
assertEquals(testComment, container.getNewComment());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification 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());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification in project binnavi by google.
the class PostgreSQLNotificationParserTest method testFunctionNodeCommentParsingAppendCommentUnknownModule.
@Test
public void testFunctionNodeCommentParsingAppendCommentUnknownModule() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_function_nodes UPDATE 2 6666 4608 3333");
final CommentNotification result = PostgreSQLCommentNotificationParser.processFunctionNodeCommentNotification(notification, provider);
assertNull(result);
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGlobalEdgeCommentParsingDeleteLastComment.
@Test
public void testGlobalEdgeCommentParsingDeleteLastComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_global_edge_comments DELETE 1 1 4608 4614");
Collection<CommentNotification> result = PostgreSQLCommentNotificationParser.processEdgeGlobalCommentNotification(notification, provider);
assertEquals(1, result.size());
final EdgeCommentNotificationContainer container = (EdgeCommentNotificationContainer) Iterables.getFirst(result, null);
final INaviEdge edge = container.getEdge();
assertEquals(1111, edge.getId());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
assertEquals(CommentScope.GLOBAL, container.getScope());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.interfaces.CommentNotification 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());
}
Aggregations