Examples of SessionFactory


Examples of org.springmodules.jcr.SessionFactory


  protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
      FilterChain filterChain) throws ServletException, IOException {

    SessionFactory sf = lookupSessionFactory(request);
   
    Session session = null;
    boolean participate = false;

    if (TransactionSynchronizationManager.hasResource(sf)) {
      // Do not modify the Session: just set the participate
      // flag.
      participate = true;
    }
    else {
      logger.debug("Opening JCR session in OpenSessionInViewFilter");
      session = SessionFactoryUtils.getSession(sf, true);
      TransactionSynchronizationManager.bindResource(sf, sf.getSessionHolder(session));
    }

    try {
      filterChain.doFilter(request, response);
    }
View Full Code Here

Examples of org.springmodules.jcr.SessionFactory

    /*
     * Test method for 'org.springmodules.jcr.jackrabbit.JcrInterceptor.createSessionHolder(Session)'
     */
    public void testCreateSessionHolder() throws Exception {
      MockControl sfCtrl = MockControl.createControl(SessionFactory.class);
      SessionFactory sf = (SessionFactory) sfCtrl.getMock();
        MockControl sessionControl = MockControl.createControl(Session.class);

        MockControl xaSessionControl = MockControl.createControl(XASession.class);
        XASession xaSession = (XASession)xaSessionControl.getMock();

View Full Code Here

Examples of org.springmodules.jcr.SessionFactory

*/
public class OpenSessionInViewTests extends TestCase {

    public void testOpenSessionInViewInterceptor() throws Exception {
        MockControl sfControl = MockControl.createControl(SessionFactory.class);
        SessionFactory sf = (SessionFactory) sfControl.getMock();
        MockControl sessionControl = MockControl.createControl(Session.class);
        Session session = (Session) sessionControl.getMock();

        OpenSessionInViewInterceptor interceptor = new OpenSessionInViewInterceptor();
       
        MockServletContext sc = new MockServletContext();
        MockHttpServletRequest request = new MockHttpServletRequest(sc);
        MockHttpServletResponse response = new MockHttpServletResponse();

        sfControl.expectAndReturn(sf.getSession(), session);
        SessionHolder holder = new SessionHolder(session);
        sfControl.expectAndReturn(sf.getSessionHolder(session), holder);
        sfControl.replay();
        sessionControl.replay();
       
        interceptor.setSessionFactory(sf);
        interceptor.afterPropertiesSet();
View Full Code Here

Examples of org.springmodules.jcr.SessionFactory

        sessionControl.verify();
    }

    public void testOpenSessionInViewFilter() throws Exception {
        MockControl sfControl = MockControl.createControl(SessionFactory.class);
        final SessionFactory sf = (SessionFactory) sfControl.getMock();
        MockControl sessionControl = MockControl.createControl(Session.class);
        final Session session = (Session) sessionControl.getMock();

        // set up the session factory
        sfControl.expectAndReturn(sf.getSession(), session);
        final SessionHolder holder = new SessionHolder(session);
        sfControl.expectAndReturn(sf.getSessionHolder(session), holder);
       
        session.logout();
        sessionControl.setVoidCallable(1);
       
        sfControl.replay();
        sessionControl.replay();
       

        // set up the second session factory
        MockControl sf2Control = MockControl.createControl(SessionFactory.class);
        final SessionFactory sf2 = (SessionFactory) sf2Control.getMock();
        MockControl session2Control = MockControl.createControl(Session.class);
        final Session session2 = (Session) session2Control.getMock();
       

        sf2Control.expectAndReturn(sf2.getSession(), session2);
        final SessionHolder holder2 = new SessionHolder(session2);
        sf2Control.expectAndReturn(sf2.getSessionHolder(session2), holder2);
        session2.logout();
        session2Control.setVoidCallable(1);
       
        //session2Control.expectAndReturn(session2.getRepository(), repo);
        sf2Control.replay();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.