Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract class MongoSpec extends Specification {
MongoDatastore mongoDatastore

@Shared
Session session
Session mongoSession

/**
* @return Obtains the mapping context
Expand Down Expand Up @@ -104,13 +104,13 @@ abstract class MongoSpec extends Specification {

void setup() {
boolean existing = mongoDatastore.hasCurrentSession()
session = existing ? mongoDatastore.currentSession : DatastoreUtils.bindSession(mongoDatastore.connect())
mongoSession = existing ? mongoDatastore.currentSession : DatastoreUtils.bindSession(mongoDatastore.connect())
}

void cleanup() {
if (!mongoDatastore.hasCurrentSession()) {
TransactionSynchronizationManager.unbindResource(mongoDatastore)
DatastoreUtils.closeSessionOrRegisterDeferredClose(session, mongoDatastore)
DatastoreUtils.closeSessionOrRegisterDeferredClose(mongoSession, mongoDatastore)
}
}

Expand Down