Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fluegge2010-07-04 14:57:57 +0000
committerMartin Fluegge2010-07-04 14:57:57 +0000
commita03f77c35ea2e74e02bd8da81c80fde8b228b482 (patch)
tree0ebf77b203958f735fd4ef93161baab2e76c2c65 /plugins
parentfa19c7e84d578f772198bc4cf20015ecc7756e0e (diff)
downloadcdo-a03f77c35ea2e74e02bd8da81c80fde8b228b482.tar.gz
cdo-a03f77c35ea2e74e02bd8da81c80fde8b228b482.tar.xz
cdo-a03f77c35ea2e74e02bd8da81c80fde8b228b482.zip
[316444] Provide an option to prevent containment cycles
https://bugs.eclipse.org/bugs/show_bug.cgi?id=316444
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java69
1 files changed, 43 insertions, 26 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
index 9334fe2e2f..55561c998e 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_316444_Test.java
@@ -205,6 +205,7 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
ThreadA threadA = new ThreadA(resourcePath);
threadA.start();
+ sleepIfNeeded();
threadX.start();
threadX.join(DEFAULT_TIMEOUT);
@@ -296,8 +297,9 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
ThreadA threadA = new ThreadA(RESOURCE_PATH);
ThreadB threadB = new ThreadB(RESOURCE_PATH);
- threadB.start();
threadA.start();
+ sleepIfNeeded();
+ threadB.start();
threadA.join(DEFAULT_TIMEOUT);
threadB.join(DEFAULT_TIMEOUT);
@@ -318,7 +320,15 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
session.close();
msg("finished");
}
+ }
+ private void sleepIfNeeded()
+ {
+ if (isConfig(LEGACY))
+ {
+ // sleep in legacy while Bug 318816 is not solved
+ sleep(1000);
+ }
}
private void checkInitialGraph(NodeB root, NodeB A, NodeB B, NodeB C, NodeB D, NodeB E)
@@ -405,10 +415,8 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
catch (Exception e)
{
exceptions.add(e);
-
}
}
-
}
/**
@@ -429,35 +437,44 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
@Override
public void run()
{
- msg("Started Thread B " + session);
- CDOTransaction transaction = session.openTransaction();
- Resource resource = transaction.getResource(resourcePath, true);
+ try
+ {
+ msg("Started Thread B " + session);
+ CDOTransaction transaction = session.openTransaction();
- NodeB root = (NodeB)resource.getContents().get(0);
- assertEquals("root", root.getName());
- NodeB C = getElementFromGraphNodeB(root, "C");
- NodeB D = getElementFromGraphNodeB(root, "D");
+ Resource resource = transaction.getResource(resourcePath, true);
+
+ NodeB root = (NodeB)resource.getContents().get(0);
+ assertEquals("root", root.getName());
+ NodeB C = getElementFromGraphNodeB(root, "C");
+ NodeB D = getElementFromGraphNodeB(root, "D");
- assertEquals("C", C.getName());
- assertEquals("D", D.getName());
+ assertEquals("C", C.getName());
+ assertEquals("D", D.getName());
- C.getChildren().add(D);
+ C.getChildren().add(D);
+
+ try
+ {
+ transaction.commit();
+ }
+ catch (CommitException ex)
+ {
+ msg("Finished (Passed) Thread B " + session);
+ // passed
+ return;
+ }
+
+ exceptions.add(new ThreadBShouldHaveThrownAnExceptionException("Thread B should have thrown an exception"));
+
+ session.close();
- try
- {
- transaction.commit();
}
- catch (CommitException ex)
+ catch (Exception e)
{
- msg("Finished (Passed) Thread B " + session);
- // passed
- return;
+ exceptions.add(e);
+ msg("Finished Thread B " + session);
}
-
- exceptions.add(new ThreadBShouldHaveThrownAnExceptionException("Thread B should have thrown an exception"));
-
- session.close();
- msg("Finished Thread B " + session);
}
}
@@ -473,7 +490,7 @@ public class Bugzilla_316444_Test extends AbstractCDOTest
super(resourcePath);
msg("Starting Thread X");
session = (CDOSession)openSession(REPOSITORY_NAME);
- idSessionA = session.getSessionID();
+ idSessionB = session.getSessionID();
}
@Override

Back to the top