Hi,

This seems to be related to this thread:
http://www.nabble.com/PageLinkTarget%2C-where-did-it-go--to21022001.html#a21022001

/Serge


Michał Jedynak wrote:
> 
> Hi there,
> 
> I've integrated spring security to my sample tapestry5 application
> (I'm using version 5.0.18) based on tapestry-spring-security
> (http://www.localhost.nu/java/tapestry-spring-security), but now my
> unit tests that use PageTester don't work, because there is no
> Authentication object in SecurityContext.
> 
> I thought about creating SecurityContext, something like:
> 
> SecurityContext securityContext = new SecurityContextImpl();
> User user = new User();
> user.setId(1L);
> user.setUsername("user");
> user.setPassword("password");
> UsernamePasswordAuthenticationToken token =
>     new UsernamePasswordAuthenticationToken(
>       user.getUsername(), user.getPassword(), user.getAuthorities());
> token.setDetails(user);
> securityContext.setAuthentication(token);
> 
> and adding it to the rendered page through PageTester, as it is
> described in
> http://tapestry.apache.org/tapestry5/guide/unit-testing-pages.html:
> 
> PageTester tester = new PageTester(appPackage, appName,
> "src/main/webapp");
> Object[] context = new Object[]{ "abc", 123 };
> Document doc = tester.invoke(new ComponentInvocation(new
> PageLinkTarget("MyPage"), context));
> 
> However this doesn't work, ComponentInvocation is an interface and I
> don't know how to initialize properly ComponentInvocationImpl.
> Anyone care to help?
> 
> 
> 
> 
> 
> -- 
> Michał Jedynak
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Tapestry-5-with-Spring-Security---problem-with-unit-tests.-tp21126486p21129652.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to