This content has been marked as final.
Show 1 reply
-
1. Re: TestNG and user Principal
kirkor.grzegorz.bernas.com.pl Mar 15, 2010 1:03 PM (in response to kirkor.grzegorz.bernas.com.pl)I resolve my problem.
First of all, I used wrong context. This should be an new FacesRequest();
To set a principal, I need to override method getPrincipalName, without need of login.new FacesRequest() { public String getPrincipalName() { return "admin"; }; @Override protected void updateModelValues() throws Exception { setValue("#{identity.username}", "admin"); setValue("#{identity.password}", ""); } @Override protected void invokeApplication() { log.info(invokeMethod("#{identity.login}")); log.info("principal: " + getValue("#{userPrincipal.name}")); /* ... */ } }.run();
and it works,
@In Principal userPrincipal;
is injected.