Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2019-11-04 06:56:58 -0500
committerEike Stepper2019-11-04 06:56:58 -0500
commit9ca6a5b419a5212e3d2b06f414c6aff27fa032ba (patch)
treee0ec6e5bffaf4e98824c910de1175777055fc595
parented1936308a9bda32a089da21fc2a9a5c4cdfffaa (diff)
downloadcdo-9ca6a5b419a5212e3d2b06f414c6aff27fa032ba.tar.gz
cdo-9ca6a5b419a5212e3d2b06f414c6aff27fa032ba.tar.xz
cdo-9ca6a5b419a5212e3d2b06f414c6aff27fa032ba.zip
[552512] CDOServerExporter does not release the Session
https://bugs.eclipse.org/bugs/show_bug.cgi?id=552512
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java19
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java12
2 files changed, 25 insertions, 6 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
index 9026b16fa6..fdb3881988 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/AbstractCDOTest.java
@@ -90,6 +90,25 @@ public abstract class AbstractCDOTest extends ConfigTest
super.doTearDown();
}
+ /**
+ * Closes the given session and waits until the server-side session is closed, too.
+ * In TCP scenarios the latter does not happen synchronously, which can confuse tests that count sessions.
+ */
+ public void closeSession(CDOSession session) throws InterruptedException
+ {
+ final int sessionID = session.getSessionID();
+ session.close();
+
+ new PollingTimeOuter()
+ {
+ @Override
+ protected boolean successful()
+ {
+ return getRepository().getSessionManager().getSession(sessionID) == null;
+ }
+ }.assertNoTimeOut();
+ }
+
public InternalSession serverSession(CDOSession session)
{
String repositoryName = session.getRepositoryInfo().getName();
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
index 08eef2813e..c42e97cb46 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/BackupTest.java
@@ -188,7 +188,7 @@ public class BackupTest extends AbstractCDOTest
salesOrder.getOrderDetails().add(getModel1Factory().createOrderDetail());
resource.getContents().add(salesOrder);
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport();
}
@@ -203,7 +203,7 @@ public class BackupTest extends AbstractCDOTest
purchaseOrder.setDate(new Date(1234567));
resource.getContents().add(purchaseOrder);
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport();
}
@@ -305,7 +305,7 @@ public class BackupTest extends AbstractCDOTest
CDOResource resource = transaction.createResource(getResourcePath("/res1"));
resource.getContents().add(createPoligon(new Point(1, 2), new Point(3, 1), new Point(4, 5)));
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport();
}
@@ -325,7 +325,7 @@ public class BackupTest extends AbstractCDOTest
resource.getContents().add(salesOrder);
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport(false);
@@ -354,7 +354,7 @@ public class BackupTest extends AbstractCDOTest
transaction.commit();
resource.getContents().clear();
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport();
@@ -385,7 +385,7 @@ public class BackupTest extends AbstractCDOTest
resource.getContents().add(polygon);
transaction.commit();
- session.close();
+ closeSession(session);
doExportImport();

Back to the top