{
// Init test.
UserPrincipal user = new UserPrincipalImpl("anon");
RolePrincipal role1 = new RolePrincipalImpl("anonrole1");
RolePrincipal role2 = new RolePrincipalImpl("anonrole2");
GroupPrincipal group1 = new GroupPrincipalImpl("anongroup1");
GroupPrincipal group2 = new GroupPrincipalImpl("anongroup2");
PortletPermission perm1 = new PortletPermission("anontestportlet", "view");
PortletPermission perm2 = new PortletPermission("anontestportlet", "view, edit");
PortletPermission perm3 = new PortletPermission("anontestportlet", "view, edit, secure");
PortletPermission perm4 = new PortletPermission("anontestportlet", "view, edit, secure, minimized");
try
{
ums.addUser(user.getName(), "password");
rms.addRole(role1.getName());
rms.addRole(role2.getName());
gms.addGroup(group1.getName());
gms.addGroup(group2.getName());
pms.addPermission(perm1);
pms.addPermission(perm2);
pms.addPermission(perm3);
pms.addPermission(perm4);
pms.grantPermission(role1, perm1);