Search in sources :

Example 11 with CUserManager

use of com.google.security.zynamics.binnavi.Gui.Users.CUserManager in project binnavi by google.

the class CUserManagerTest method addUserTestWrongArgument2.

@Test(expected = IllegalStateException.class)
public void addUserTestWrongArgument2() throws CouldntSaveDataException {
    final CUserManager manager = CUserManager.get(m_sql);
    manager.addUser("ONE");
    manager.addUser("ONE");
}
Also used : CUserManager(com.google.security.zynamics.binnavi.Gui.Users.CUserManager) Test(org.junit.Test)

Example 12 with CUserManager

use of com.google.security.zynamics.binnavi.Gui.Users.CUserManager in project binnavi by google.

the class CUserManagerTest method deleteUserWrongArgumentTest2.

@Test(expected = IllegalStateException.class)
public void deleteUserWrongArgumentTest2() throws CouldntDeleteException {
    final CUserManager manager = CUserManager.get(m_sql);
    manager.deleteUser(new CUser(1, "FAKE USER"));
}
Also used : CUser(com.google.security.zynamics.binnavi.Gui.Users.CUser) CUserManager(com.google.security.zynamics.binnavi.Gui.Users.CUserManager) Test(org.junit.Test)

Example 13 with CUserManager

use of com.google.security.zynamics.binnavi.Gui.Users.CUserManager in project binnavi by google.

the class FunctionTest method testAppendFunctionComment.

@Test
public void testAppendFunctionComment() throws CouldntSaveDataException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException, CouldntLoadDataException {
    final MockFunctionListener listener = new MockFunctionListener();
    final Function function = new Function(ModuleFactory.get(), m_internalFunction2);
    function.addListener(listener);
    final CUserManager userManager = CUserManager.get(m_provider);
    final IUser user = userManager.addUser(" SET FUNCTION COMMENT TEST ");
    userManager.setCurrentActiveUser(user);
    final List<IComment> appendedComments = function.appendComment("Hannes");
    assertEquals(appendedComments, function.getComment());
    assertEquals(appendedComments, m_internalFunction2.getGlobalComment());
    assertEquals("appendedComment;", listener.events);
    final ArrayList<IComment> comments = Lists.newArrayList();
    comments.add(new CComment(12345, CommonTestObjects.TEST_USER_1, null, "FOO"));
    m_internalFunction2.initializeGlobalComment(comments);
    assertEquals(comments.get(0), function.getComment().get(0));
    assertEquals(comments.get(0), m_internalFunction2.getGlobalComment().get(0));
    assertEquals("appendedComment;initializedComments;", listener.events);
    function.removeListener(listener);
}
Also used : CFunction(com.google.security.zynamics.binnavi.disassembly.CFunction) 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) CUserManager(com.google.security.zynamics.binnavi.Gui.Users.CUserManager) Test(org.junit.Test)

Example 14 with CUserManager

use of com.google.security.zynamics.binnavi.Gui.Users.CUserManager in project binnavi by google.

the class GroupNodeTest method testSetText.

@Test
public void testSetText() throws CouldntSaveDataException, com.google.security.zynamics.binnavi.API.disassembly.CouldntSaveDataException, CouldntLoadDataException {
    final Database database = new Database(new MockDatabase());
    final SQLProvider provider = new MockSqlProvider();
    final MockModule mockModule = new MockModule();
    final TagManager nodeTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.NODE_TAG));
    final TagManager viewTagManager = new TagManager(new MockTagManager(com.google.security.zynamics.binnavi.Tagging.TagType.VIEW_TAG));
    final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
    final MockView mockView = new MockView();
    final View view = new View(module, mockView, nodeTagManager, viewTagManager);
    final INaviGroupNode internalGroupNode = new CGroupNode(0, 0, 0, 0, 0, Color.RED, false, false, new HashSet<CTag>(), new ArrayList<IComment>(), false, provider);
    final GroupNode node = new GroupNode(view, internalGroupNode, viewTagManager);
    final MockGroupNodeListener listener = new MockGroupNodeListener();
    final CUserManager userManager = CUserManager.get(provider);
    final IUser user = userManager.addUser(" TEST APPEND GROUP NODE COMMENT ");
    userManager.setCurrentActiveUser(user);
    node.addListener(listener);
    final List<IComment> comments = node.appendComment("Hannes");
    assertEquals("appendedComment;", listener.events);
    assertEquals(comments, node.getComment());
    node.removeListener(listener);
}
Also used : IComment(com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment) MockView(com.google.security.zynamics.binnavi.disassembly.MockView) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CGroupNode(com.google.security.zynamics.binnavi.disassembly.CGroupNode) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) SQLProvider(com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) MockView(com.google.security.zynamics.binnavi.disassembly.MockView) CUserManager(com.google.security.zynamics.binnavi.Gui.Users.CUserManager) MockTagManager(com.google.security.zynamics.binnavi.Tagging.MockTagManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) IUser(com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule) INaviGroupNode(com.google.security.zynamics.binnavi.disassembly.INaviGroupNode) CGroupNode(com.google.security.zynamics.binnavi.disassembly.CGroupNode) Test(org.junit.Test)

Example 15 with CUserManager

use of com.google.security.zynamics.binnavi.Gui.Users.CUserManager in project binnavi by google.

the class UniqueTestUserGenerator method nextActiveUser.

public IUser nextActiveUser() throws CouldntSaveDataException {
    final CUserManager userManager = CUserManager.get(provider);
    final IUser user = userManager.addUser(new BigInteger(130, random).toString(32));
    userManager.setCurrentActiveUser(user);
    return user;
}
Also used : IUser(com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser) BigInteger(java.math.BigInteger) CUserManager(com.google.security.zynamics.binnavi.Gui.Users.CUserManager)

Aggregations

CUserManager (com.google.security.zynamics.binnavi.Gui.Users.CUserManager)22 Test (org.junit.Test)20 IUser (com.google.security.zynamics.binnavi.Gui.Users.Interfaces.IUser)11 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)4 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)3 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)3 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)3 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)2 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)2 CUser (com.google.security.zynamics.binnavi.Gui.Users.CUser)2 CGroupNode (com.google.security.zynamics.binnavi.disassembly.CGroupNode)2 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)2 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)2 Date (java.util.Date)2 CModuleViewGenerator (com.google.security.zynamics.binnavi.Database.CModuleViewGenerator)1 SQLProvider (com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider)1 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)1 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)1 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)1 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)1