Package org.hibernate.engine

Examples of org.hibernate.engine.SessionFactoryImplementor.openSession()


      sessionControl.reset();

      tm.getTransaction();
      tmControl.setReturnValue(transaction, 6);

      sf.openSession();
      sfControl.setReturnValue(session, 1);
      sf.getTransactionManager();
      sfControl.setReturnValue(tm, 6);
      session.isOpen();
      sessionControl.setReturnValue(true, 4);
View Full Code Here


    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    sf.getTransactionManager();
    sfControl.setReturnValue(tm, 2);
    sf.openSession();
    sfControl.setReturnValue(session, 1);
    session.isOpen();
    sessionControl.setReturnValue(true, 1);
    session.setFlushMode(FlushMode.NEVER);
    sessionControl.setVoidCallable(1);
View Full Code Here

  @Test
  public void testTransactionWithPropagationSupportsAndCurrentSession() throws Exception {
    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);

    given(sf.openSession()).willReturn(session);
    given(session.getSessionFactory()).willReturn(sf);
    given(session.getFlushMode()).willReturn(FlushMode.MANUAL);

    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean() {
      @Override
View Full Code Here

    given(tm.getTransaction()).willReturn(transaction);

    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);
    given(sf.getTransactionManager()).willReturn(tm);
    given(sf.openSession()).willReturn(session);
    given(session.isOpen()).willReturn(true);
    given(session.getFlushMode()).willReturn(FlushMode.AUTO);

    JtaTransactionManager ptm = new JtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
View Full Code Here

        Status.STATUS_ACTIVE, Status.STATUS_ACTIVE);
    given(tm.getTransaction()).willReturn(transaction1);
    given(tm.suspend()).willReturn(tx1);
    given(tm.getTransaction()).willReturn(transaction2);
    given(sf.getTransactionManager()).willReturn(tm);
    given(sf.openSession()).willReturn(session1, session2);
    given(session1.isOpen()).willReturn(true);
    given(session2.isOpen()).willReturn(true);
    given(session1.getFlushMode()).willReturn(FlushMode.AUTO);
    given(session2.getFlushMode()).willReturn(FlushMode.AUTO);
View Full Code Here

    TransactionManager tm = mock(TransactionManager.class);
    MockJtaTransaction transaction = new MockJtaTransaction();
    given(tm.getTransaction()).willReturn(transaction);
    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);
    given(sf.openSession()).willReturn(session);
    given(sf.getTransactionManager()).willReturn(tm);
    given(session.isOpen()).willReturn(true);
    given(session.getFlushMode()).willReturn(FlushMode.AUTO);

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

    TransactionManager tm = mock(TransactionManager.class);
    MockJtaTransaction transaction = new MockJtaTransaction();
    given(tm.getTransaction()).willReturn(transaction);
    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);
    given(sf.openSession()).willReturn(session);
    given(sf.getTransactionManager()).willReturn(tm);
    given(session.isOpen()).willReturn(true);

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    HibernateTemplate ht = new HibernateTemplate(sf);
View Full Code Here

    MockJtaTransaction transaction = new MockJtaTransaction();
    given(tm.getTransaction()).willReturn(transaction);
    given(tm.getStatus()).willReturn(Status.STATUS_NO_TRANSACTION);
    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);
    given(sf.openSession()).willReturn(session);
    given(sf.getTransactionManager()).willReturn(tm);
    given(session.isOpen()).willReturn(true);

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    final HibernateTemplate ht = new HibernateTemplate(sf);
View Full Code Here

    MockJtaTransaction transaction = new MockJtaTransaction();
    given(tm.getTransaction()).willReturn(transaction);
    final HibernateException flushEx = new HibernateException("flush failure");
    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session = mock(Session.class);
    given(sf.openSession()).willReturn(session);
    given(sf.getTransactionManager()).willReturn(tm);
    given(session.isOpen()).willReturn(true);
    given(session.getFlushMode()).willReturn(FlushMode.AUTO);
    willThrow(flushEx).given(session).flush();
View Full Code Here

        transaction2);

    final SessionFactoryImplementor sf = mock(SessionFactoryImplementor.class);
    final Session session1 = mock(Session.class);
    final Session session2 = mock(Session.class);
    given(sf.openSession()).willReturn(session1, session2);
    given(sf.getTransactionManager()).willReturn(tm);
    given(session1.getFlushMode()).willReturn(FlushMode.AUTO);
    given(session2.getFlushMode()).willReturn(FlushMode.AUTO);

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
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.