summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgidijus Vaishnora2011-07-02 06:11:08 (EDT)
committerEgidijus Vaishnora2011-07-02 06:11:08 (EDT)
commit48edf5bcd21ed19a8597ebcd176a02f346213fc7 (patch)
tree6affcc71db22773a4038fad4a06fe79ad6bd56c5
parent870845223bba81a04eb21a02318dda05e0d16789 (diff)
downloadcdo-48edf5bcd21ed19a8597ebcd176a02f346213fc7.zip
cdo-48edf5bcd21ed19a8597ebcd176a02f346213fc7.tar.gz
cdo-48edf5bcd21ed19a8597ebcd176a02f346213fc7.tar.bz2
[349793] Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349793
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF44
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java104
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java1
4 files changed, 128 insertions, 22 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
index cc0e3ca..c5fe46b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.tests/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.tests;singleton:=true
-Bundle-Version: 4.0.0.qualifier
+Bundle-Version: 4.0.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -35,25 +35,25 @@ Require-Bundle: org.eclipse.net4j.tests;bundle-version="[4.0.0,5.0.0)";visibilit
org.eclipse.emf.cdo.workspace;bundle-version="[4.0.0,5.0.0)"
Import-Package: org.apache.derby.jdbc;version="[10.0.0,11.0.0)",
org.h2.jdbcx;version="[1.0.0,2.0.0)"
-Export-Package: base;version="4.0.0",
- base.impl;version="4.0.0",
- base.util;version="4.0.0",
- derived;version="4.0.0",
- derived.impl;version="4.0.0",
- derived.util;version="4.0.0",
- interface_;version="4.0.0",
- interface_.impl;version="4.0.0",
- interface_.util;version="4.0.0",
- org.eclipse.emf.cdo.tests;version="4.0.0",
- org.eclipse.emf.cdo.tests.bugzilla;version="4.0.0",
- org.eclipse.emf.cdo.tests.bundle;version="4.0.0",
- org.eclipse.emf.cdo.tests.config;version="4.0.0",
- org.eclipse.emf.cdo.tests.config.impl;version="4.0.0",
- org.eclipse.emf.cdo.tests.defs;version="4.0.0",
- org.eclipse.emf.cdo.tests.offline;version="4.0.0",
- org.eclipse.emf.cdo.tests.revisioncache;version="4.0.0",
- org.eclipse.emf.cdo.tests.util;version="4.0.0",
- reference;version="4.0.0",
- reference.impl;version="4.0.0",
- reference.util;version="4.0.0"
+Export-Package: base;version="4.0.100",
+ base.impl;version="4.0.100",
+ base.util;version="4.0.100",
+ derived;version="4.0.100",
+ derived.impl;version="4.0.100",
+ derived.util;version="4.0.100",
+ interface_;version="4.0.100",
+ interface_.impl;version="4.0.100",
+ interface_.util;version="4.0.100",
+ org.eclipse.emf.cdo.tests;version="4.0.100",
+ org.eclipse.emf.cdo.tests.bugzilla;version="4.0.100",
+ org.eclipse.emf.cdo.tests.bundle;version="4.0.100",
+ org.eclipse.emf.cdo.tests.config;version="4.0.100",
+ org.eclipse.emf.cdo.tests.config.impl;version="4.0.100",
+ org.eclipse.emf.cdo.tests.defs;version="4.0.100",
+ org.eclipse.emf.cdo.tests.offline;version="4.0.100",
+ org.eclipse.emf.cdo.tests.revisioncache;version="4.0.100",
+ org.eclipse.emf.cdo.tests.util;version="4.0.100",
+ reference;version="4.0.100",
+ reference.impl;version="4.0.100",
+ reference.util;version="4.0.100"
Eclipse-BuddyPolicy: dependent
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
index 5ee103a..96bbed5 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AllConfigs.java
@@ -228,5 +228,6 @@ public abstract class AllConfigs extends ConfigTestSuite
testClasses.add(Bugzilla_342135_Test.class);
testClasses.add(Bugzilla_343332_Test.class);
testClasses.add(Bugzilla_343471_Test.class);
+ testClasses.add(Bugzilla_349793_Test.class);
}
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java
new file mode 100644
index 0000000..cce8fd3
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_349793_Test.java
@@ -0,0 +1,104 @@
+/**
+ * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.common.commit.CDOCommitInfo;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.tests.AbstractCDOTest;
+import org.eclipse.emf.cdo.tests.model1.Category;
+import org.eclipse.emf.cdo.tests.model1.Model1Factory;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.util.CommitException;
+import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
+
+import org.eclipse.net4j.util.event.IEvent;
+import org.eclipse.net4j.util.event.IListener;
+
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author Egidijus Vaisnora
+ */
+public class Bugzilla_349793_Test extends AbstractCDOTest
+{
+ /**
+ * Creates new transaction at the same time when notification has been sent
+ */
+ public void testOpeningTransactionDuringInvalidation() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction tx = session.openTransaction();
+ CDOResource resource = tx.createResource(getResourcePath("test"));
+
+ Model1Factory factory = getModel1Factory();
+ Category cat = factory.createCategory();
+ resource.getContents().add(cat);
+ tx.commit();
+
+ final CountDownLatch invalidationLatch = new CountDownLatch(1);
+ final CountDownLatch testExecutionLatch = new CountDownLatch(1);
+ tx.addListener(new IListener()
+ {
+ public void notifyEvent(IEvent event)
+ {
+ if (event instanceof CDOViewInvalidationEvent)
+ {
+ try
+ {
+ testExecutionLatch.countDown();
+ invalidationLatch.await();
+ }
+ catch (InterruptedException ex)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ });
+
+ long timestamp = doSecondSessionSync();
+ testExecutionLatch.await();
+ CDOTransaction freshTransaction = session.openTransaction();
+ invalidationLatch.countDown();
+
+ // wait for update from server
+ freshTransaction.waitForUpdate(timestamp, DEFAULT_TIMEOUT);
+
+ session.close();
+ }
+
+ private long doSecondSessionSync() throws CommitException
+ {
+ CDOSession session = openSession();
+ CDOTransaction tx = session.openTransaction();
+ CDOResource resource = tx.getResource(getResourcePath("test"));
+
+ Category cat = (Category)resource.getContents().get(0);
+ cat.setName("dirty");
+ CDOCommitInfo info;
+
+ try
+ {
+ info = tx.commit();
+ }
+ catch (CommitException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+
+ long timeStamp = info.getTimeStamp();
+ msg(timeStamp);
+
+ session.close();
+ return timeStamp;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
index a35d2e4..e336e1c 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/session/CDOSessionImpl.java
@@ -1402,6 +1402,7 @@ public abstract class CDOSessionImpl extends Container<CDOView> implements Inter
{
view.setSession(this);
view.setViewID(++lastViewID);
+ view.setLastUpdateTime(getLastUpdateTime());
views.add(view);
}