Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-02-02 02:56:42 -0500
committerEike Stepper2019-02-02 02:56:42 -0500
commit86157bcc07f74557fee87e30a7b230fada8f4cd8 (patch)
treeb1cb53be85e168dc6fbab3b463371086f0806e9a /plugins/org.eclipse.emf.cdo.tests/src
parent7217380110c2353c2a6df073614f3a046135952f (diff)
downloadcdo-86157bcc07f74557fee87e30a7b230fada8f4cd8.tar.gz
cdo-86157bcc07f74557fee87e30a7b230fada8f4cd8.tar.xz
cdo-86157bcc07f74557fee87e30a7b230fada8f4cd8.zip
[544057] CDOObject.cdoReadLock().isLockedByOthers() returns true if lock is held by myself
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544057
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.tests/src')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
index a7845661d6..493f7cf67e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/LockingManagerTest.java
@@ -867,6 +867,29 @@ public class LockingManagerTest extends AbstractLockingTest
assertEquals(false, repo.getLockingManager().hasLock(LockType.READ, view, cdoCompany.cdoID()));
}
+ public void testReadLockedByOthers() throws Exception
+ {
+ Company company = getModel1Factory().createCompany();
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource res = transaction.createResource(getResourcePath("/res1"));
+ res.getContents().add(company);
+ transaction.commit();
+ assertFalse(CDOUtil.getCDOObject(company).cdoReadLock().isLockedByOthers());
+
+ transaction.lockObjects(CDOUtil.getCDOObjects(company), LockType.READ, DEFAULT_TIMEOUT);
+ assertReadLock(true, company);
+ assertWriteLock(false, company);
+ assertFalse(CDOUtil.getCDOObject(company).cdoReadLock().isLockedByOthers());
+
+ CDOView view = session.openView();
+ Company viewCompany = view.getObject(company);
+ assertReadLock(false, viewCompany);
+ assertWriteLock(false, viewCompany);
+ assertTrue(CDOUtil.getCDOObject(viewCompany).cdoReadLock().isLockedByOthers());
+ }
+
public void testBugzilla_270345() throws Exception
{
Company company1 = getModel1Factory().createCompany();

Back to the top