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");
}
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"));
}
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);
}
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);
}
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;
}
Aggregations