use of com.google.security.zynamics.binnavi.disassembly.Modules.MockModule in project binnavi by google.
the class PostgreSQLNotificationParserTest method testTypeInstanceCommentParsingDeleteComment.
@Test
public void testTypeInstanceCommentParsingDeleteComment() throws CouldntSaveDataException, CouldntLoadDataException {
final INaviModule module = new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
module.getContent().getSections().createSection("A", new CAddress(0), new CAddress(1234), SectionPermission.READ, null);
final TypeInstance fakeInstance = module.getContent().getTypeInstanceContainer().createInstance("TYPE INSTANCE", null, module.getTypeManager().getTypes().get(0), module.getContent().getSections().getSection(0), 0);
final PGNotification notification = new MockPGNotification("comment_changes", "bn_type_instances UPDATE 1 " + fakeInstance.getId() + " null");
final CommentNotification result = PostgreSQLCommentNotificationParser.processTypeInstanceCommentNotification(notification, provider);
assertNotNull(result);
final TypeInstanceCommentNotificationContainer container = (TypeInstanceCommentNotificationContainer) result;
assertNotNull(container);
final TypeInstance instance = container.getInstance();
assertEquals(fakeInstance.getId(), instance.getId());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.MockModule in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGlobalEdgeCommentParsingAppendNewComment.
@Test
public void testGlobalEdgeCommentParsingAppendNewComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_global_edge_comments UPDATE 1 1 4608 4614 3333");
final 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.APPEND, container.getOperation());
assertEquals(new Integer(3333), container.getCommentId());
assertEquals(CommentScope.GLOBAL, container.getScope());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.MockModule in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGroupNodeCommentParsingDeleteComment.
@Test
public void testGroupNodeCommentParsingDeleteComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_group_nodes UPDATE 8888 null");
final CommentNotification result = PostgreSQLCommentNotificationParser.processGroupNodeCommentNotification(notification, provider);
assertNotNull(result);
final GroupNodeCommentNotificationContainer container = (GroupNodeCommentNotificationContainer) result;
final INaviGroupNode groupNode = container.getNode();
assertEquals(8888, groupNode.getId());
assertEquals(CommentOperation.DELETE, container.getOperation());
assertNull(container.getCommentId());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.MockModule in project binnavi by google.
the class PostgreSQLNotificationParserTest method testLocalInstructionCommentParsingAppend.
@Test
public void testLocalInstructionCommentParsingAppend() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_codenode_instructions UPDATE 1 1111 0 4608 3333");
CommentNotification result = PostgreSQLCommentNotificationParser.processNodeLocalInstructionCommentNotification(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.LOCAL, container.getScope());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.MockModule in project binnavi by google.
the class PostgreSQLNotificationParserTest method testGroupNodeCommentParsingAppendComment.
@Test
public void testGroupNodeCommentParsingAppendComment() {
new MockModule(provider, Lists.newArrayList(mockView), Lists.newArrayList(mockFunction));
MockPGNotification notification = new MockPGNotification("comment_changes", "bn_group_nodes UPDATE 8888 3333");
final CommentNotification result = PostgreSQLCommentNotificationParser.processGroupNodeCommentNotification(notification, provider);
assertNotNull(result);
final GroupNodeCommentNotificationContainer container = (GroupNodeCommentNotificationContainer) result;
final INaviGroupNode groupNode = container.getNode();
assertEquals(8888, groupNode.getId());
assertEquals(CommentOperation.APPEND, container.getOperation());
assertEquals(new Integer(3333), container.getCommentId());
}
Aggregations