Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-04-24 04:24:49 -0400
committerEike Stepper2018-04-24 04:24:49 -0400
commit3b9bf918e6e6029c6165bead0c4222dd6ff13fea (patch)
tree2c48282ed80114ca1061b3240caa159a73dfab9e /plugins/org.eclipse.emf.cdo.tests/src
parent8d9891fd33bda115e575d274a04cf32746f3debc (diff)
downloadcdo-3b9bf918e6e6029c6165bead0c4222dd6ff13fea.tar.gz
cdo-3b9bf918e6e6029c6165bead0c4222dd6ff13fea.tar.xz
cdo-3b9bf918e6e6029c6165bead0c4222dd6ff13fea.zip
[430528] CDO Server Exporter doesn't handle DetachedRevisions
https://bugs.eclipse.org/bugs/show_bug.cgi?id=430528
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/BackupTest.java45
1 files changed, 45 insertions, 0 deletions
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 b3042e3a15..e765c4c72f 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
@@ -10,15 +10,19 @@
*/
package org.eclipse.emf.cdo.tests;
+import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.lob.CDOBlob;
import org.eclipse.emf.cdo.common.lob.CDOClob;
+import org.eclipse.emf.cdo.common.revision.CDORevision;
import org.eclipse.emf.cdo.common.revision.CDORevisionData;
+import org.eclipse.emf.cdo.common.revision.CDORevisionHandler;
import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.server.CDOServerExporter;
import org.eclipse.emf.cdo.server.CDOServerImporter;
import org.eclipse.emf.cdo.session.CDOSession;
import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.tests.bundle.OM;
+import org.eclipse.emf.cdo.tests.config.IRepositoryConfig;
import org.eclipse.emf.cdo.tests.model1.Customer;
import org.eclipse.emf.cdo.tests.model1.PurchaseOrder;
import org.eclipse.emf.cdo.tests.model1.SalesOrder;
@@ -40,6 +44,7 @@ import org.eclipse.net4j.util.io.IOUtil;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -567,6 +572,46 @@ public class BackupTest extends AbstractCDOTest
System.out.println(customer2);
}
+ @CleanRepositoriesBefore(reason = "Inactive repository required")
+ @Requires(IRepositoryConfig.CAPABILITY_BRANCHING)
+ public void testImportDetachedRevision() throws Exception
+ {
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/res1"));
+ PurchaseOrder purchaseOrder = getModel1Factory().createPurchaseOrder();
+ purchaseOrder.setDate(new Date(1234567));
+ resource.getContents().add(purchaseOrder);
+ transaction.commit();
+ resource.getContents().clear();
+ transaction.commit();
+ session.close();
+
+ InternalRepository repo1 = getRepository();
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ CDOServerExporter.XML exporter = new CDOServerExporter.XML(repo1);
+ exporter.exportRepository(baos);
+
+ InternalRepository repo2 = getRepository("repo2", false);
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ CDOServerImporter.XML importer = new CDOServerImporter.XML(repo2);
+ importer.importRepository(bais);
+
+ EClass eClass = getModel1Package().getPurchaseOrder();
+ CDOSession session2 = openSession("repo2");
+ CDOBranch branch = session2.getBranchManager().getMainBranch();
+ session2.getRevisionManager().handleRevisions(eClass, branch, true, 0, false, new CDORevisionHandler()
+ {
+ public boolean handleRevision(CDORevision revision)
+ {
+ fail("No PurchaseOrder revision should be visible by now.");
+ return true;
+ }
+ });
+ }
+
private Customer initExtResource(ResourceSet resourceSet)
{
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());

Back to the top