test_class.file: se-jcr-commons/src/test/java/org/springframework/extensions/jcr/JcrInterceptorTest.java
test_class.identifier: JcrInterceptorTest
test_case.body: @Test
      public void testInterceptorWithPrebound() {
          SessionFactory sessionFactory = createMock(SessionFactory.class);
          Session session = createMock(Session.class);
  
          replay(sessionFactory, session);
  
          TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
          JcrInterceptor interceptor = new JcrInterceptor();
          interceptor.setSessionFactory(sessionFactory);
          interceptor.afterPropertiesSet();
          try {
              interceptor.invoke(new TestInvocation(sessionFactory));
          } catch (Throwable t) {
              fail("Should not have thrown Throwable: " + t.getMessage());
          } finally {
              TransactionSynchronizationManager.unbindResource(sessionFactory);
          }
  
          verify(sessionFactory, session);
      }
test_case.class_method_signature: JcrInterceptorTest.testInterceptorWithPrebound()
test_case.full_signature: @Test public void testInterceptorWithPrebound()
test_case.identifier: testInterceptorWithPrebound
test_case.invocations: createMock createMock replay bindResource setSessionFactory afterPropertiesSet invoke fail getMessage unbindResource verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInterceptorWithPrebound()
focal_class.declarator: LOG = LoggerFactory.getLogger(JcrInterceptor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(JcrInterceptor.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.file: se-jcr-commons/src/main/java/org/springframework/extensions/jcr/JcrInterceptor.java
focal_class.identifier: JcrInterceptor
focal_class.interfaces: implements MethodInterceptor
focal_class.class_method_signature: JcrInterceptor.invoke(MethodInvocation methodInvocation)
focal_class.full_signature: public Object invoke(MethodInvocation methodInvocation)
focal_class.identifier: invoke
focal_class.modifiers: public
focal_class.parameters: (MethodInvocation methodInvocation)
focal_class.return: Object
focal_class.signature: Object invoke(MethodInvocation methodInvocation)
focal_class.superclass: extends JcrAccessor
focal_method.body: public Object invoke(MethodInvocation methodInvocation) throws Throwable {
          boolean existingTransaction = false;
          Session session = SessionFactoryUtils.getSession(getSessionFactory(), true);
          if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
              LOG.debug("Found thread-bound Session for JCR interceptor");
              existingTransaction = true;
          } else {
              LOG.debug("Using new Session for JCR interceptor");
              TransactionSynchronizationManager.bindResource(getSessionFactory(), getSessionFactory().getSessionHolder(session));
          }
          try {
              Object retVal = methodInvocation.proceed();
              // flushIfNecessary(session, existingTransaction);
              return retVal;
          } finally {
              if (existingTransaction) {
                  LOG.debug("Not closing pre-bound JCR Session after interceptor");
              } else {
                  TransactionSynchronizationManager.unbindResource(getSessionFactory());
                  SessionFactoryUtils.releaseSession(session, getSessionFactory());
              }
          }
      }
focal_method.class_method_signature: JcrInterceptor.invoke(MethodInvocation methodInvocation)
focal_method.full_signature: public Object invoke(MethodInvocation methodInvocation)
focal_method.identifier: invoke
focal_method.invocations: getSession getSessionFactory hasResource getSessionFactory debug debug bindResource getSessionFactory getSessionHolder getSessionFactory proceed debug unbindResource getSessionFactory releaseSession getSessionFactory
focal_method.modifiers: public
focal_method.parameters: (MethodInvocation methodInvocation)
focal_method.return: Object
focal_method.signature: Object invoke(MethodInvocation methodInvocation)