Search in sources :

Example 96 with UniqueTestUserGenerator

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.UniqueTestUserGenerator in project binnavi by google.

the class PostgreSQLSectionCommentTests method deleteSectionComment5.

@Test
public void deleteSectionComment5() throws CouldntDeleteException, CouldntSaveDataException, CouldntLoadDataException {
    final List<IComment> comments = section.getComments() == null ? new ArrayList<IComment>() : section.getComments();
    final IComment lastComment = comments.size() == 0 ? null : Iterables.getLast(comments);
    final String commentString = " TEST DELETE Section COMMENT ";
    final IUser user = new UniqueTestUserGenerator(getProvider()).nextActiveUser();
    final int commentId = getProvider().appendSectionComment(section.getModule().getConfiguration().getId(), section.getId(), commentString, user.getUserId());
    final IComment newComment = new CComment(commentId, user, lastComment, commentString);
    final ArrayList<IComment> storedComments = getProvider().loadCommentById(commentId);
    assertNotNull(storedComments);
    assertEquals(comments.size() + 1, storedComments.size());
    assertEquals(newComment, storedComments.get(storedComments.size() - 1));
    getProvider().deleteSectionComment(section.getModule().getConfiguration().getId(), section.getId(), commentId, newComment.getUser().getUserId());
    final ArrayList<IComment> commentsAfterDelete = getProvider().loadCommentById(commentId);
    assertNotNull(commentsAfterDelete);
    assertTrue(commentsAfterDelete.isEmpty());
}
Also used : CComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment) IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) IUser(com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser) UniqueTestUserGenerator(com.google.security.zynamics.binnavi.Database.PostgreSQL.UniqueTestUserGenerator) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

UniqueTestUserGenerator (com.google.security.zynamics.binnavi.Database.PostgreSQL.UniqueTestUserGenerator)96 IUser (com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser)95 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)95 Test (org.junit.Test)95 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)89 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)89 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)8 INaviTextNode (com.google.security.zynamics.binnavi.disassembly.INaviTextNode)8 CNaviViewEdge (com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge)2 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)2 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)2 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)1 CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)1 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)1 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)1 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)1 Before (org.junit.Before)1