PolicyRegistration policyRegistration = new JBossPolicyRegistration();
registerPolicy(policyRegistration);
WebResource er = getResource(policyRegistration);
er.setPolicyContextID(this.contextID);
er.setServletRequest(new TestHttpServletRequest(p, uri, "GET"));
assertEquals(AuthorizationContext.PERMIT,
pc.authorize(er, getSubject(), getRoleGroup()));
Principal principal = new SimplePrincipal("Notjduke");
HttpServletRequest hsr = new TestHttpServletRequest(principal, uri, "GET");
//Now change the ejb principal
er.setServletRequest(hsr);
assertEquals(AuthorizationContext.DENY,
pc.authorize(er, getSubject(), getRoleGroup()));
}