Package org.springmodules.jcr

Examples of org.springmodules.jcr.JcrTemplate


    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
        JcrTemplate template = new JcrTemplate(sf);
        template.save();
      }
    });

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


    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
          JcrTemplate template = new JcrTemplate(sf);
          template.execute(new JcrCallback() {
            public Object doInJcr(Session se) throws RepositoryException {
              se.save();
              throw new RuntimeException();
            }
View Full Code Here

    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
        JcrTemplate template = new JcrTemplate(sf);
        template.execute(new JcrCallback() {
          public Object doInJcr(Session se) throws RepositoryException {
            se.save();
            return null;
          }
View Full Code Here

    tt.setIsolationLevel(TransactionDefinition.ISOLATION_SERIALIZABLE);
    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
          JcrTemplate template = new JcrTemplate(sf);
          template.execute(new JcrCallback() {
            public Object doInJcr(Session session) throws RepositoryException {
              return null;
            }
          });
        }
View Full Code Here

    assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));

    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
        JcrTemplate template = new JcrTemplate(sf);
        template.save();
      }
    });

    assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
    TransactionSynchronizationManager.unbindResource(sf);
View Full Code Here

    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
          JcrTemplate template = new JcrTemplate(sf);
          template.save();
        }
      });

    }
    catch (UnexpectedRollbackException e) {
View Full Code Here

   * Will automatically create a JcrTemplate for the given SessionFactory.
   * @see #createJcrTemplate
   * @see #setJcrTemplate
   */
  public final void setSessionFactory(SessionFactory sessionFactory) {
    this.template = new JcrTemplate(sessionFactory);
  }
View Full Code Here

    sfCtrl.verify();
  }

  public void testJcrDaoSupportWithJcrTemplate() throws Exception {

    JcrTemplate template = new JcrTemplate();
    JcrDaoSupport dao = new JcrDaoSupport() {
      public void smth() {
      };
    };
View Full Code Here

  public void testConvertException() {
    JcrDaoSupport dao = new JcrDaoSupport() {
    };
    MockControl tCtrl = MockClassControl.createControl(JcrTemplate.class);
    JcrTemplate t = (JcrTemplate) tCtrl.getMock();

    RepositoryException ex = new RepositoryException();

    tCtrl.expectAndReturn(t.convertJcrAccessException(ex), null);
    dao.setTemplate(t);
    dao.convertJcrAccessException(ex);

  }
View Full Code Here

TOP

Related Classes of org.springmodules.jcr.JcrTemplate

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.