use of org.apache.jackrabbit.api.security.principal.JackrabbitPrincipal in project jackrabbit by apache.
the class EveryonePrincipalTest method testEveryonePrincipal3.
public void testEveryonePrincipal3() {
Principal everyone = EveryonePrincipal.getInstance();
Principal someotherEveryone = new JackrabbitPrincipal() {
public String getName() {
return EveryonePrincipal.NAME;
}
@Override
public boolean equals(Object o) {
if (o instanceof JackrabbitPrincipal) {
return getName().equals(((JackrabbitPrincipal) o).getName());
}
return false;
}
@Override
public int hashCode() {
return getName().hashCode();
}
};
assertEquals(someotherEveryone, everyone);
assertEquals(everyone, someotherEveryone);
}
use of org.apache.jackrabbit.api.security.principal.JackrabbitPrincipal in project jackrabbit by apache.
the class PrincipalManagerTest method testJackrabbitPrincipal.
/**
* Test if a group which is not item based will be wrapped by a JackrabbitPrincipal implementation.
* @throws NotExecutableException
* @throws RepositoryException
*/
public void testJackrabbitPrincipal() throws NotExecutableException, RepositoryException {
final PrincipalProvider testProvider = new CustomPrincipalProvider();
testProvider.init(new Properties());
PrincipalManagerImpl principalManager = new PrincipalManagerImpl(superuser, new PrincipalProvider[] { testProvider });
Principal principalFromManager = principalManager.getPrincipal(TESTGROUP_NAME);
assertTrue(principalFromManager instanceof JackrabbitPrincipal);
}
use of org.apache.jackrabbit.api.security.principal.JackrabbitPrincipal in project jackrabbit-oak by apache.
the class PrincipalImplTest method testEquals.
@Test
public void testEquals() {
List<Principal> principals = new ArrayList<Principal>();
principals.add(new PrincipalImpl("name"));
principals.add(new TestPrincipal("name"));
principals.add(new JackrabbitPrincipal() {
@Override
public String getName() {
return "name";
}
});
for (Principal p : principals) {
assertEquals(principal, p);
}
}
Aggregations