Java Code Examples for javax.transaction.NotSupportedException

The following examples show how to use javax.transaction.NotSupportedException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: lastaflute   Source File: LazyUserTransaction.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void doBegin() throws NotSupportedException, SystemException {
    if (canLazyTransaction()) {
        if (!isLazyTransactionLazyBegun()) { // first transaction
            incrementHierarchyLevel();
            toBeLazyTransaction(); // not begin real transaction here for lazy
        } else { // lazy now, this begin() means nested transaction
            if (!isLazyTransactionRealBegun()) { // not begun lazy transaction yet
                beginRealTransactionLazily(); // forcedly begin outer transaction before e.g. 'requiresNew' scope
                suspendForcedlyBegunLazyTransactionIfNeeds(); // like requires new transaction
            }
            incrementHierarchyLevel();
            superDoBegin(); // nested transaction is not lazy fixedly
        }
    } else { // normal transaction
        superDoBegin();
    }
}
 
Example 2
Source Project: spring-analysis-note   Source File: JtaTransactionManagerTests.java    License: MIT License 6 votes vote down vote up
@Test
public void jtaTransactionManagerWithNotSupportedExceptionOnNestedBegin() throws Exception {
	UserTransaction ut = mock(UserTransaction.class);
	given(ut.getStatus()).willReturn(Status.STATUS_ACTIVE);
	willThrow(new NotSupportedException("not supported")).given(ut).begin();

	try {
		JtaTransactionManager ptm = newJtaTransactionManager(ut);
		TransactionTemplate tt = new TransactionTemplate(ptm);
		tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
		tt.execute(new TransactionCallbackWithoutResult() {
			@Override
			protected void doInTransactionWithoutResult(TransactionStatus status) {
				// something transactional
			}
		});
		fail("Should have thrown NestedTransactionNotSupportedException");
	}
	catch (NestedTransactionNotSupportedException ex) {
		// expected
	}
}
 
Example 3
Source Project: boost   Source File: JPAResource.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void createThing(StringBuilder builder)
        throws NamingException, NotSupportedException, SystemException, IllegalStateException, SecurityException,
        HeuristicMixedException, HeuristicRollbackException, RollbackException {
    Context ctx = new InitialContext();
    // Before getting an EntityManager, start a global transaction
    UserTransaction tran = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    tran.begin();

    // Now get the EntityManager from JNDI
    EntityManager em = (EntityManager) ctx.lookup(JNDI_NAME);
    builder.append("Creating a brand new Thing with " + em.getDelegate().getClass()).append(newline);

    // Create a Thing object and persist it to the database
    Thing thing = new Thing();
    em.persist(thing);

    // Commit the transaction
    tran.commit();
    int id = thing.getId();
    builder.append("Created Thing " + id + ":  " + thing).append(newline);
}
 
Example 4
Source Project: boost   Source File: JPAResource.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void createThing(StringBuilder builder)
        throws NamingException, NotSupportedException, SystemException, IllegalStateException, SecurityException,
        HeuristicMixedException, HeuristicRollbackException, RollbackException {
    Context ctx = new InitialContext();
    // Before getting an EntityManager, start a global transaction
    UserTransaction tran = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    tran.begin();

    // Now get the EntityManager from JNDI
    EntityManager em = (EntityManager) ctx.lookup(JNDI_NAME);
    builder.append("Creating a brand new Thing with " + em.getDelegate().getClass()).append(newline);

    // Create a Thing object and persist it to the database
    Thing thing = new Thing();
    em.persist(thing);

    // Commit the transaction
    tran.commit();
    int id = thing.getId();
    builder.append("Created Thing " + id + ":  " + thing).append(newline);
}
 
Example 5
Source Project: boost   Source File: JPAResource.java    License: Eclipse Public License 1.0 6 votes vote down vote up
public void createThing(StringBuilder builder)
        throws NamingException, NotSupportedException, SystemException, IllegalStateException, SecurityException,
        HeuristicMixedException, HeuristicRollbackException, RollbackException {
    Context ctx = new InitialContext();
    // Before getting an EntityManager, start a global transaction
    UserTransaction tran = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    tran.begin();

    // Now get the EntityManager from JNDI
    EntityManager em = (EntityManager) ctx.lookup(JNDI_NAME);
    builder.append("Creating a brand new Thing with " + em.getDelegate().getClass()).append(newline);

    // Create a Thing object and persist it to the database
    Thing thing = new Thing();
    em.persist(thing);

    // Commit the transaction
    tran.commit();
    int id = thing.getId();
    builder.append("Created Thing " + id + ":  " + thing).append(newline);
}
 
Example 6
Source Project: cdi   Source File: JtaTransaction.java    License: Apache License 2.0 6 votes vote down vote up
private void attemptBegin() {
    logger.debug("Beginning JTA transaction if required and possible.");

    if (userTransaction != null) {
        try {
            if (owned) {
                logger.debug("Beginning BMT transaction.");
                userTransaction.begin();
            } else {
                logger.debug("Did not try to begin non-owned BMT transaction.");
            }
        } catch (SystemException | NotSupportedException ex) {
            logger.warn("Had trouble trying to start BMT transaction.", ex);
        }
    } else {
        if (registry != null) {
            logger.debug("Not allowed to begin CMT transaction, the current transaction status is {}.",
                    statusToString(registry.getTransactionStatus()));
        } else {
            logger.warn("No JTA APIs available in this context. No begin done.");
        }
    }
}
 
Example 7
private void createUsers() throws HeuristicRollbackException, RollbackException, HeuristicMixedException, SystemException, NotSupportedException
    {
        txn = transactionService.getUserTransaction();
        txn.begin();
        for (UserInfo user : userInfos)
        {
            String username = user.getUserName();
            NodeRef nodeRef = personService.getPersonOrNull(username);
            boolean create = nodeRef == null;
            if (create)
            {
                PropertyMap testUser = new PropertyMap();
                testUser.put(ContentModel.PROP_USERNAME, username);
                testUser.put(ContentModel.PROP_FIRSTNAME, user.getFirstName());
                testUser.put(ContentModel.PROP_LASTNAME, user.getLastName());
                testUser.put(ContentModel.PROP_EMAIL, user.getUserName() + "@acme.test");
                testUser.put(ContentModel.PROP_PASSWORD, "password");

                nodeRef = personService.createPerson(testUser);
            }
            userNodeRefs.add(nodeRef);
//            System.out.println((create ? "create" : "existing")+" user " + username + " nodeRef=" + nodeRef);
        }
        txn.commit();
    }
 
Example 8
Source Project: microprofile-sandbox   Source File: JPAResource.java    License: Apache License 2.0 6 votes vote down vote up
public void createThing(StringBuilder builder)
        throws NamingException, NotSupportedException, SystemException, IllegalStateException, SecurityException,
        HeuristicMixedException, HeuristicRollbackException, RollbackException {
    Context ctx = new InitialContext();
    // Before getting an EntityManager, start a global transaction
    UserTransaction tran = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    tran.begin();

    // Now get the EntityManager from JNDI
    EntityManager em = (EntityManager) ctx.lookup(JNDI_NAME);
    builder.append("Creating a brand new Thing with " + em.getDelegate().getClass()).append(newline);

    // Create a Thing object and persist it to the database
    Thing thing = new Thing();
    em.persist(thing);

    // Commit the transaction
    tran.commit();
    int id = thing.getId();
    builder.append("Created Thing " + id + ":  " + thing).append(newline);
}
 
Example 9
Source Project: microprofile-sandbox   Source File: JPAResource.java    License: Apache License 2.0 6 votes vote down vote up
public void createThing(StringBuilder builder)
        throws NamingException, NotSupportedException, SystemException, IllegalStateException, SecurityException,
        HeuristicMixedException, HeuristicRollbackException, RollbackException {
    Context ctx = new InitialContext();
    // Before getting an EntityManager, start a global transaction
    UserTransaction tran = (UserTransaction) ctx.lookup("java:comp/UserTransaction");
    tran.begin();

    // Now get the EntityManager from JNDI
    EntityManager em = (EntityManager) ctx.lookup(JNDI_NAME);
    builder.append("Creating a brand new Thing with " + em.getDelegate().getClass()).append(newline);

    // Create a Thing object and persist it to the database
    Thing thing = new Thing();
    em.persist(thing);

    // Commit the transaction
    tran.commit();
    int id = thing.getId();
    builder.append("Created Thing " + id + ":  " + thing).append(newline);
}
 
Example 10
Source Project: scipio-erp   Source File: TransactionUtil.java    License: Apache License 2.0 6 votes vote down vote up
protected static void internalBegin(UserTransaction ut, int timeout) throws SystemException, NotSupportedException {
    // set the timeout for THIS transaction
    if (timeout > 0) {
        ut.setTransactionTimeout(timeout);
        if (Debug.verboseOn()) {
            Debug.logVerbose("Set transaction timeout to : " + timeout + " seconds", module);
        }
    }

    // begin the transaction
    ut.begin();
    if (Debug.verboseOn()) {
        Debug.logVerbose("Transaction begun", module);
    }

    // reset the timeout to the default
    if (timeout > 0) {
        ut.setTransactionTimeout(0);
    }
}
 
Example 11
@Test
public void testFind() throws ResourceException, NotSupportedException, SystemException {
	MicroserviceResourceFactory msrFactory = mock(MicroserviceResourceFactory.class);
	MicroserviceXAResource xa = new MicroserviceXAResource("a", mock(CommitRollbackCallback.class));
	when(msrFactory.build()).thenReturn(xa);
	MicroserviceResourceProducer.registerMicroserviceResourceFactory("a", msrFactory);
	MicroserviceResourceProducer producer = MicroserviceResourceProducer.getProducers().values().iterator().next();

       BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
       try{
       	tm.begin();

       	//TEST
       	producer.getTransactionAssistant(); //enlists resource into TX and means we can then go find it
       	
       	XAResource found = producer.findXAResourceHolder(xa).getXAResource();
       	assertEquals(xa, found);
       }finally{
       	tm.rollback();
       }
}
 
Example 12
@Test
public void jtaTransactionManagerWithNotSupportedExceptionOnNestedBegin() throws Exception {
	UserTransaction ut = mock(UserTransaction.class);
	given(ut.getStatus()).willReturn(Status.STATUS_ACTIVE);
	willThrow(new NotSupportedException("not supported")).given(ut).begin();

	try {
		JtaTransactionManager ptm = newJtaTransactionManager(ut);
		TransactionTemplate tt = new TransactionTemplate(ptm);
		tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_NESTED);
		tt.execute(new TransactionCallbackWithoutResult() {
			@Override
			protected void doInTransactionWithoutResult(TransactionStatus status) {
				// something transactional
			}
		});
		fail("Should have thrown NestedTransactionNotSupportedException");
	}
	catch (NestedTransactionNotSupportedException ex) {
		// expected
	}
}
 
Example 13
public void begin() throws NotSupportedException, SystemException {
	XidFactory transactionXidFactory = this.beanFactory.getTransactionXidFactory();

	CompensableTransaction compensable = this.getCompensableTransactionQuietly();
	if (compensable == null || compensable.getTransaction() != null) {
		throw new SystemException(XAException.XAER_PROTO);
	}

	CompensableArchive archive = compensable.getCompensableArchive();

	// The current confirm/cancel operation has been assigned an xid.
	TransactionXid compensableXid = archive == null ? null : (TransactionXid) archive.getCompensableXid();
	TransactionXid transactionXid = compensableXid != null //
			? transactionXidFactory.createGlobalXid(compensableXid.getGlobalTransactionId())
			: transactionXidFactory.createGlobalXid();

	TransactionContext compensableContext = compensable.getTransactionContext();
	TransactionContext transactionContext = compensableContext.clone();
	transactionContext.setXid(transactionXid);

	this.invokeBegin(transactionContext, false);
}
 
Example 14
protected void invokeRollbackInBegin(TransactionContext transactionContext) throws NotSupportedException, SystemException {
	TransactionParticipant transactionCoordinator = this.beanFactory.getTransactionNativeParticipant();

	CompensableTransaction compensable = this.getCompensableTransactionQuietly();
	TransactionContext compensableContext = compensable.getTransactionContext();

	TransactionXid compensableXid = compensableContext.getXid();
	TransactionXid transactionXid = transactionContext.getXid();
	try {
		transactionCoordinator.end(transactionContext, XAResource.TMFAIL);
		transactionCoordinator.rollback(transactionXid);
	} catch (XAException tex) {
		logger.info("{}> begin-transaction: error occurred while starting jta-transaction: {}",
				ByteUtils.byteArrayToString(compensableXid.getGlobalTransactionId()),
				ByteUtils.byteArrayToString(transactionXid.getGlobalTransactionId()), tex);
	}
}
 
Example 15
public void compensableRecoverySuspend() throws NotSupportedException, SystemException {
	CompensableManager compensableManager = this.beanFactory.getCompensableManager();
	CompensableTransaction compensable = compensableManager.getCompensableTransactionQuietly();
	if (compensable == null) {
		throw new IllegalStateException();
	}

	TransactionContext transactionContext = compensable.getTransactionContext();
	if (transactionContext.isCoordinator() == false) {
		throw new IllegalStateException();
	}

	TransactionParticipant compensableCoordinator = this.beanFactory.getCompensableNativeParticipant();

	TransactionContext compensableContext = compensable.getTransactionContext();
	try {
		compensableCoordinator.end(compensableContext, XAResource.TMSUCCESS);
	} catch (XAException ex) {
		logger.error("Error occurred while suspending an compensable transaction!", ex);
		throw new SystemException(ex.getMessage());
	}
}
 
Example 16
@Override
protected State start() {
    try {
        final Transaction transaction = transactionManager.getTransaction();
        final Transaction current;
        if (transaction == null) {
            transactionManager.begin();
            current = transactionManager.getTransaction();
        } else {
            current = transaction;
        }
        return new State(transaction, current);
    } catch (final SystemException | NotSupportedException se) {
        throw new TransactionalException(se.getMessage(), se);
    }
}
 
Example 17
Source Project: spring-analysis-note   Source File: JtaTransactionManager.java    License: MIT License 5 votes vote down vote up
@Override
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
	TransactionManager tm = getTransactionManager();
	Assert.state(tm != null, "No JTA TransactionManager available");
	if (timeout >= 0) {
		tm.setTransactionTimeout(timeout);
	}
	tm.begin();
	return new ManagedTransactionAdapter(tm);
}
 
Example 18
Source Project: spring-analysis-note   Source File: SimpleTransactionFactory.java    License: MIT License 5 votes vote down vote up
@Override
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
	if (timeout >= 0) {
		this.transactionManager.setTransactionTimeout(timeout);
	}
	this.transactionManager.begin();
	return new ManagedTransactionAdapter(this.transactionManager);
}
 
Example 19
Source Project: java-technology-stack   Source File: JtaTransactionManager.java    License: MIT License 5 votes vote down vote up
@Override
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
	TransactionManager tm = getTransactionManager();
	Assert.state(tm != null, "No JTA TransactionManager available");
	if (timeout >= 0) {
		tm.setTransactionTimeout(timeout);
	}
	tm.begin();
	return new ManagedTransactionAdapter(tm);
}
 
Example 20
Source Project: java-technology-stack   Source File: SimpleTransactionFactory.java    License: MIT License 5 votes vote down vote up
@Override
public Transaction createTransaction(@Nullable String name, int timeout) throws NotSupportedException, SystemException {
	if (timeout >= 0) {
		this.transactionManager.setTransactionTimeout(timeout);
	}
	this.transactionManager.begin();
	return new ManagedTransactionAdapter(this.transactionManager);
}
 
Example 21
@Test
public void testGetTransactionAssistant() throws ResourceException, NotSupportedException, SystemException {
	MicroserviceResourceFactory msrFactory = mock(MicroserviceResourceFactory.class);
	MicroserviceXAResource xa = new MicroserviceXAResource("a", null);
	when(msrFactory.build()).thenReturn(xa);
	MicroserviceResourceProducer.registerMicroserviceResourceFactory("a", msrFactory);
	MicroserviceResourceProducer producer = MicroserviceResourceProducer.getProducers().values().iterator().next();
	
       BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
       try{
       	tm.begin();

       	//TEST
   		TransactionAssistant ta = producer.getTransactionAssistant();
   		assertNotNull(ta);
   		
   		//check its enlisted in TX
   		assertEquals(1, TransactionContextHelper.currentTransaction().getEnlistedResourcesUniqueNames().size());
   		assertEquals("a", TransactionContextHelper.currentTransaction().getEnlistedResourcesUniqueNames().iterator().next());
   		
       	//TEST
   		ta.close();

   		//cannot check its delisted from TX, because that happens during deconstruction of the transaction, becuase the TX is a global one
   		
   		//close also removed it from the holders - so check its gone
   		assertNull(producer.findXAResourceHolder(xa));
       }finally{
       	tm.rollback();
       }
}
 
Example 22
Source Project: remote-monitoring-services-java   Source File: JobsController.java    License: MIT License 5 votes vote down vote up
@Authorize("CreateJobs")
public CompletionStage<Result> scheduleJobAsync()
    throws NotSupportedException, ExternalDependencyException, InvalidInputException {
    JsonNode json = request().body().asJson();
    final JobApiModel jobApiModel = fromJson(json, JobApiModel.class);

    if (jobApiModel.getUpdateTwin() != null) {
        return jobService.scheduleTwinUpdateAsync(
            jobApiModel.getJobId(),
            jobApiModel.getQueryCondition(),
            jobApiModel.getUpdateTwin(),
            jobApiModel.getStartTimeUtc() == null ?
                DateTime.now(DateTimeZone.UTC).toDate() : jobApiModel.getStartTimeUtc(),
            jobApiModel.getMaxExecutionTimeInSeconds() == null ?
                3600 : jobApiModel.getMaxExecutionTimeInSeconds())
            .thenApply(job -> ok(toJson(new JobApiModel(job))));
    }

    if (jobApiModel.getMethodParameter() != null) {
        return jobService.scheduleDeviceMethodAsync(
            jobApiModel.getJobId(),
            jobApiModel.getQueryCondition(),
            jobApiModel.getMethodParameter().toServiceModel(),
            jobApiModel.getStartTimeUtc() == null ?
                DateTime.now(DateTimeZone.UTC).toDate() : jobApiModel.getStartTimeUtc(),
            jobApiModel.getMaxExecutionTimeInSeconds() == null ?
                3600 : jobApiModel.getMaxExecutionTimeInSeconds())
            .thenApply(job -> ok(toJson(new JobApiModel(job))));
    }

    throw new NotSupportedException();
}
 
Example 23
@Test
public void testRunWithTxnOfExecutingThread() throws SystemException, NotSupportedException {
    ThreadContext threadContext = ThreadContext.builder()
            .propagated()
            .unchanged(ThreadContext.TRANSACTION)
            .cleared(ThreadContext.ALL_REMAINING)
            .build();

    UserTransaction ut = getUserTransaction("testRunWithTxnOfExecutingThread");

    if (threadContext == null || ut == null) {
        return; // the implementation does not support transaction propagation
    }

    Callable<Boolean> isInTransaction =
            threadContext.contextualCallable(() -> ut.getStatus() == Status.STATUS_ACTIVE);

    ut.begin();

    try {
        Assert.assertTrue(isInTransaction.call());
    }
    catch (Exception e) {
        Assert.fail("testRunWithTxnOfExecutingThread: a transaction should have been active");
    }
    finally {
        ut.rollback();
    }
}
 
Example 24
Source Project: javaee8-cookbook   Source File: AsyncTask.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public User call() throws Exception {
    performLookups();
    try {
        userTransaction.begin();
        User user = userBean.getUser();
        userTransaction.commit();
        return user;
    } catch (IllegalStateException | SecurityException | HeuristicMixedException | HeuristicRollbackException | NotSupportedException | RollbackException | SystemException e) {
        userTransaction.rollback();
        return null;
    }
}
 
Example 25
/**
 * Begin a transaction.
 *
 * @throws NotSupportedException when a nested transaction is attempted.
 * @throws SystemException when a serious error occurs.
 */
@Override
public void begin() throws NotSupportedException, SystemException {
    DefaultTransaction transaction = (DefaultTransaction) getTransaction();
    if (transaction == null) {
        transaction = new DefaultTransaction();
        transaction.setTransactionManager(this);
        transaction.setTimeout(timeout);
        Thread currentThread = Thread.currentThread();
        threadTransactionMap.put(currentThread, transaction);
    } else {
        throw new NotSupportedException("Nested transactions are not supported");
    }
}
 
Example 26
/**
 * Test begin method.
 *
 * @throws Exception when a serious error occurs.
 */
@Test
public void testBegin() throws Exception {
    DefaultUserTransaction transaction = new DefaultUserTransaction(
            new DefaultTransactionManager());
    transaction.begin();
    assertThrows(NotSupportedException.class, transaction::begin);
}
 
Example 27
@Test
public void canVersionDocsWithoutSpecialInputFileNameExtension()
        throws HeuristicMixedException, IOException, SystemException,
        HeuristicRollbackException, NotSupportedException, RollbackException
{
    testCanVersionDocsWithoutSpecialInputFileNameExtension(file ->
        streamingNodeImporterFactory.getNodeImporter(resourceAsFile("classpath:bulkimport-autoversion/"+file)));
}
 
Example 28
@Before
public void setup() throws SystemException, NotSupportedException
{
    try
    {
        nodeService = (NodeService)ctx.getBean("nodeService");
        fileFolderService = (FileFolderService)ctx.getBean("fileFolderService");
        transactionService = (TransactionService)ctx.getBean("transactionService");
        bulkImporter = (MultiThreadedBulkFilesystemImporter)ctx.getBean("bulkFilesystemImporter");
        contentService = (ContentService)ctx.getBean("contentService");
        actionService = (ActionService)ctx.getBean("actionService");
        ruleService = (RuleService)ctx.getBean("ruleService");
        versionService = (VersionService)ctx.getBean("versionService");

        AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

        String s = "BulkFilesystemImport" + System.currentTimeMillis();

        txn = transactionService.getUserTransaction();
        txn.begin();

        AuthenticationUtil.pushAuthentication();
        AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName());

        StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, s);
        rootNodeRef = nodeService.getRootNode(storeRef);
        top = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName("{namespace}top"), ContentModel.TYPE_FOLDER).getChildRef();
        
        topLevelFolder = fileFolderService.create(top, s, ContentModel.TYPE_FOLDER);

        txn.commit();
    }
    catch(Throwable e)
    {
        fail(e.getMessage());
    }
}
 
Example 29
@Before
public void setup() throws SystemException, NotSupportedException
{
    super.setup();
    //change cmisHiddenConfing default value
    switchCmisHiddenConfig();
    
}
 
Example 30
public void testLockRevertedOnRollback() throws NotSupportedException, SystemException
{
    // Preconditions of test
    assertEquals(LockStatus.NO_LOCK, lockService.getLockStatus(noAspectNode));
    assertFalse(lockService.isLocked(noAspectNode));
    assertEquals(LockStatus.NO_LOCK, lockService.getLockStatus(rootNodeRef));
    assertFalse(lockService.isLocked(rootNodeRef));
    
    // Lock noAspectNode
    lockService.lock(noAspectNode, LockType.WRITE_LOCK, 0, Lifetime.EPHEMERAL);
    
    // Lock rootNodeRef
    lockService.lock(rootNodeRef, LockType.NODE_LOCK, 0, Lifetime.EPHEMERAL);
    
    // Sometime later, a refresh occurs (so this should not be reverted to unlocked, but to this state)
    lockService.lock(rootNodeRef, LockType.NODE_LOCK, 3600, Lifetime.EPHEMERAL);
    
    // Rollback
    TestTransaction.end();
    
    // This lock should not be present.
    assertEquals(LockStatus.NO_LOCK, lockService.getLockStatus(noAspectNode));
    assertFalse(lockService.isLocked(noAspectNode));
    
    // This lock should still be present.
    assertEquals(LockStatus.LOCK_OWNER, lockService.getLockStatus(rootNodeRef));
    assertTrue(lockService.isLocked(rootNodeRef));
}