This content has been marked as final.
Show 4 replies
-
1. Re: TestNG and EJB3 interceptors
pmuir Oct 31, 2007 8:08 AM (in response to fbenvegna)Try making it a Seam interceptor rather than an EJB interceptor - this will certainly work.
-
2. Re: TestNG and EJB3 interceptors
fbenvegna Nov 5, 2007 10:18 AM (in response to fbenvegna)SeamInterceptor doesn't work
@Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Interceptors(DomainValidator.class) public @interface Validated { }
@Stateless @Validated @Interceptors(SeamInterceptor.class) @Name("groupManager") @TransactionAttribute(TransactionAttributeType.SUPPORTS) public class GroupManager extends AbstractManager implements IGroupManager { ... ... }
@Interceptor public class DomainValidator { @AroundInvoke public Object validate(InvocationContext invocationContext) throws Exception { Method method = invocationContext.getMethod(); Object[] parameters = invocationContext.getParameters(); Object instance = invocationContext.getTarget(); System.out.println("========================================>"); return invocationContext.proceed(); } }
Please, help me
Have you any idea ? -
3. Re: TestNG and EJB3 interceptors
fbenvegna Nov 7, 2007 5:51 AM (in response to fbenvegna)I tried with Seam 2.0.0.GA... doesn't work too!
Testing EJB3 interceptors is very important because many business operation and validation must be tested without deployment on AS. -
4. Re: TestNG and EJB3 interceptors
fbenvegna Nov 8, 2007 5:18 AM (in response to fbenvegna)My problem was test.
I add a @BeforeMethod method inside test class for creating EJB and interceptor works fine.
I don't know if it's a good solution.
If you have any idea or comment, tell me please.@BeforeMethod public void before() throws Exception { if (groupManager == null) new FacesRequest() { protected void invokeApplication() throws Exception { groupManager = (IGroupManager) Component .getInstance("groupManager"); } }.run(); }