use of org.springframework.aop.aspectj.annotation.AspectJProxyFactory in project irida by phac-nml.
the class RunAsUserAspectTest method setup.
@Before
public void setup() {
aspect = new RunAsUserAspect();
annotatedClass = new AnnotatedClass();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(annotatedClass);
proxyFactory.addAspect(aspect);
annotatedClass = proxyFactory.getProxy();
submittingUser = new User("tom", null, null, "Test", "User", null);
submittingUser.setSystemRole(Role.ROLE_USER);
adminUser = new User("admin", null, null, "admin", "User", null);
PreAuthenticatedAuthenticationToken initialAuth = new PreAuthenticatedAuthenticationToken(adminUser, null, Lists.newArrayList(Role.ROLE_ADMIN));
// Set initial context
SecurityContext context = SecurityContextHolder.createEmptyContext();
context.setAuthentication(initialAuth);
SecurityContextHolder.setContext(context);
}
use of org.springframework.aop.aspectj.annotation.AspectJProxyFactory in project irida by phac-nml.
the class ValidateMethodParametersAspectTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
AnnotatedMethodsClass target = new AnnotatedMethodsClass();
AnnotatedInterfaceImpl interfaceProxyTarget = new AnnotatedInterfaceImpl();
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(target);
AspectJProxyFactory interfaceProxyFactory = new AspectJProxyFactory(interfaceProxyTarget);
aspect = new ValidMethodParametersAspect(validator);
proxyFactory.addAspect(aspect);
interfaceProxyFactory.addAspect(aspect);
proxy = proxyFactory.getProxy();
interfaceProxy = interfaceProxyFactory.getProxy();
}
Aggregations