Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-02-02 05:22:52 -0500
committerEike Stepper2019-02-02 05:22:52 -0500
commit5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05 (patch)
tree2aa8c9f6cc49a7b201ee468e5f6cf86283296d1a /plugins/org.eclipse.emf.cdo.tests/src
parentef98a8857ac4cd08c1c2793f4ba5e833be60bae2 (diff)
downloadcdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.tar.gz
cdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.tar.xz
cdo-5a214bcbdf877c8f9bcca90ad5d1d09ede54fc05.zip
[544060] Add optional fragment checks for CDOIDExternals
https://bugs.eclipse.org/bugs/show_bug.cgi?id=544060
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/bugzilla/Bugzilla_334995_Test.java74
1 files changed, 38 insertions, 36 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334995_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334995_Test.java
index a84f613b6f..79ea70ff09 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334995_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_334995_Test.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.emf.cdo.tests.bugzilla;
+import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.common.id.CDOID;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.session.CDOSession;
@@ -17,6 +18,8 @@ import org.eclipse.emf.cdo.tests.AbstractCDOTest;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
+import java.util.Map.Entry;
+
/**
* Bug 334995 - CDOTransaction corrupted by persisted + new resource with same URI
*
@@ -24,40 +27,41 @@ import org.eclipse.emf.cdo.util.CommitException;
*/
public class Bugzilla_334995_Test extends AbstractCDOTest
{
- // The following test seems obsolete because (as of bug xxxxxx) no local changes can create resource duplicates.
- //
- // public void test() throws CommitException
- // {
- // CDOID[] resourceIDs = persistResources("/res1");
- //
- // {
- // CDOSession session = openSession();
- // CDOTransaction transaction = session.openTransaction();
- //
- // CDOResource resource = transaction.createResource(getResourcePath("/res1"));
- // msg("New resource: " + resource);
- // msg("newObjects:");
- //
- // for (Entry<CDOID, CDOObject> entry : transaction.getNewObjects().entrySet())
- // {
- // msg(" " + entry + ", state: " + entry.getValue().cdoState());
- // assertNew(entry.getValue(), transaction);
- // }
- //
- // // Fetch the persisted resource that has the same URI
- // CDOResource resource1 = (CDOResource)transaction.getObject(resourceIDs[0]);
- // msg("Persisted resource: " + resource1);
- //
- // msg("newObjects:");
- // for (Entry<CDOID, CDOObject> entry : transaction.getNewObjects().entrySet())
- // {
- // msg(" " + entry + ", state: " + entry.getValue().cdoState());
- // assertNew(entry.getValue(), transaction);
- // }
- //
- // transaction.commit();
- // }
- // }
+ /**
+ * The following test seems obsolete because (as of bug xxxxxx) no local changes can create resource duplicates.
+ */
+ public void _test() throws CommitException
+ {
+ CDOID resourceID = persistResources("/res1")[0];
+
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+
+ CDOResource resource = transaction.createResource(getResourcePath("/res1"));
+ msg("New resource: " + resource);
+ msg("newObjects:");
+
+ for (Entry<CDOID, CDOObject> entry : transaction.getNewObjects().entrySet())
+ {
+ msg(" " + entry + ", state: " + entry.getValue().cdoState());
+ assertNew(entry.getValue(), transaction);
+ }
+
+ // Fetch the persisted resource that has the same URI
+ CDOResource resource1 = (CDOResource)transaction.getObject(resourceID);
+ msg("Persisted resource: " + resource1);
+
+ msg("newObjects:");
+ for (Entry<CDOID, CDOObject> entry : transaction.getNewObjects().entrySet())
+ {
+ msg(" " + entry + ", state: " + entry.getValue().cdoState());
+ assertNew(entry.getValue(), transaction);
+ }
+
+ transaction.commit();
+ }
+ }
public void testRename() throws CommitException
{
@@ -75,8 +79,6 @@ public class Bugzilla_334995_Test extends AbstractCDOTest
resource1.getContents().add(getModel1Factory().createAddress());
resource2.getContents().add(getModel1Factory().createAddress());
transaction.commit();
-
- session.close();
}
}

Back to the top