use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.CodeNodeCommentNotificationContainer in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGlobalCodeNodeCommentParsingAppendNewComment.
@Test
public void testGlobalCodeNodeCommentParsingAppendNewComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_global_node_comments UPDATE 1 4608 3333");
final Collection<CommentNotification> result = PostgreSQLCommentNotificationParser.processNodeGlobalCommentNotification(notification, provider);
assertEquals(1, result.size());
final CodeNodeCommentNotificationContainer container = (CodeNodeCommentNotificationContainer) Iterables.getFirst(result, null);
final INaviCodeNode node = container.getNode();
assertEquals(1111, node.getId());
assertEquals(new CAddress(4608), node.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.containers.CodeNodeCommentNotificationContainer in project binnavi by google.
the class PostgreSQLNotificationParserTest method testLocalCodeNodeCommentParsingDelete.
@Test
public void testLocalCodeNodeCommentParsingDelete() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_code_nodes UPDATE 1 1111 4608 null");
final CommentNotification result = PostgreSQLCommentNotificationParser.processNodeLocalNodeCommentNotification(notification, provider);
assertNotNull(result);
final CodeNodeCommentNotificationContainer container = (CodeNodeCommentNotificationContainer) result;
final INaviCodeNode node = container.getNode();
assertEquals(1111, node.getId());
assertEquals(new CAddress(4608), node.getAddress());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
assertEquals(CommentScope.LOCAL, container.getScope());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.CodeNodeCommentNotificationContainer in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGlobalCodeNodeCommentParsingAppendFirstComment.
@Test
public void testGlobalCodeNodeCommentParsingAppendFirstComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_global_node_comments INSERT 1 4608 3333");
final Collection<CommentNotification> result = PostgreSQLCommentNotificationParser.processNodeGlobalCommentNotification(notification, provider);
assertEquals(1, result.size());
final CodeNodeCommentNotificationContainer container = (CodeNodeCommentNotificationContainer) Iterables.getFirst(result, null);
final INaviCodeNode node = container.getNode();
assertEquals(1111, node.getId());
assertEquals(new CAddress(4608), node.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.containers.CodeNodeCommentNotificationContainer in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGlobalCodeNodeCommentParsingDeleteComment.
@Test
public void testGlobalCodeNodeCommentParsingDeleteComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_global_node_comments DELETE 1 4608");
final Collection<CommentNotification> result = PostgreSQLCommentNotificationParser.processNodeGlobalCommentNotification(notification, provider);
assertEquals(1, result.size());
final CodeNodeCommentNotificationContainer container = (CodeNodeCommentNotificationContainer) Iterables.getFirst(result, null);
final INaviCodeNode node = container.getNode();
assertEquals(1111, node.getId());
assertEquals(new CAddress(4608), node.getAddress());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
assertEquals(CommentScope.GLOBAL, container.getScope());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.CodeNodeCommentNotificationContainer in project binnavi by google.
the class PostgreSQLNotificationParserTest method testLocalCodeNodeCommentParsingAppend.
@Test
public void testLocalCodeNodeCommentParsingAppend() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_code_nodes UPDATE 1 1111 4608 3333");
CommentNotification result = PostgreSQLCommentNotificationParser.processNodeLocalNodeCommentNotification(notification, provider);
assertNotNull(result);
final CodeNodeCommentNotificationContainer container = (CodeNodeCommentNotificationContainer) result;
final INaviCodeNode node = container.getNode();
assertEquals(1111, node.getId());
assertEquals(new CAddress(4608), node.getAddress());
assertEquals(CommentOperation.APPEND, container.getOperation());
assertEquals(new Integer(3333), container.getCommentId());
assertEquals(CommentScope.LOCAL, container.getScope());
}
Aggregations