Package org.jboss.weld.ejb

Examples of org.jboss.weld.ejb.SessionBeanInterceptor


        return ShrinkWrap.create(BeanArchive.class).addPackage(SessionBeanInterceptorTest.class.getPackage());
    }

    @Test
    public void testSessionBeanInterceptor(final BeanManager manager) throws Throwable {
        final SessionBeanInterceptor interceptor = new SessionBeanInterceptor();
        final AtomicReference<Object> result = new AtomicReference<Object>();
        // ctx.proceed() returns true if and only if the request scope is active
        final InvocationContext ctx = new DummyInvocationContext() {
            @Override
            public Object proceed() throws Exception {
                return manager.getContext(RequestScoped.class).isActive();
            }
        };

        // spawn a new thread an run the interceptor in it to verify that the interceptor properly starts the request context
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    result.set(interceptor.aroundInvoke(ctx));
                } catch (Exception e) {
                    result.set(e);
                }
            }
        });
View Full Code Here


                .addClass(Utils.class);
    }

    @Test
    public void testSessionBeanInterceptorTrulySerializable() throws ClassNotFoundException, IOException {
        SessionBeanInterceptor interceptor = new SessionBeanInterceptor();
        Utils.deserialize(Utils.serialize(interceptor));
    }
View Full Code Here

TOP

Related Classes of org.jboss.weld.ejb.SessionBeanInterceptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.